OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Atwist on August 27, 2012, 09:47:41 PM

Title: NIL value not allowed
Post by: Atwist on August 27, 2012, 09:47:41 PM
Hello,

I have a piece of programming designed with your help, I am getting an error message when I use the check boxes.
I understand that the check boxes are not allowed to be empty, but I do not use all the checkboxes.
Did the check boxes to "indeterminate", I think this is good.



Code (autolisp) Select

(defun c:cadtool_Main_TextButton1_OnClicked (/)
(dcl_Project_Unload "Cadtool" T)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurbloc) 1)
        (command "-purge" "B" "*" "N")
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurdim) 1)
(command "-purge" "D" "*" "N")
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlay) 1)
(command "-purge" "LA" "*" "N")
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlt) 1)
(command "-purge" "LT" "*" "N" "")
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurmat) 1)
(command "-purge" "MA" "*" "N" "")
)
Title: Re: NIL value not allowed
Post by: roy_043 on August 28, 2012, 12:36:18 AM
Your problem is the use of (dcl_Project_Unload "Cadtool" T). After this line the controls in the form no longer exist and (dcl_Control_Getvalue cadtool_Main_Chbpurbloc) etc. will fail.

Try this instead:

Code (autolisp) Select
(defun c:cadtool_Main_TextButton1_OnClicked ( / purBlockP purDimP)
  ; (dcl_Project_Unload "Cadtool" T) ; Don't do this!
  (if (= (dcl_Control_Getvalue cadtool_Main_Chbpurbloc) 1)
    (setq purBlockP T)
  )
  (if (= (dcl_Control_Getvalue cadtool_Main_Chbpurdim) 1)
    (setq purDimP T)
  )
  ; etc.
  (dcl_Form_Close cadtool_Main)
  (if purBlockP
    (command "-purge" "B" "*" "N")
  )
  (if purDimP
    (command "-purge" "D" "*" "N")
  )
  ; etc.
)
Title: Re: NIL value not allowed
Post by: Atwist on August 28, 2012, 02:54:40 AM
Thanks Roy,

I will try this
Title: Re: NIL value not allowed
Post by: Atwist on August 28, 2012, 05:48:26 AM
I made this, but I still get the error.
With Vlisp looked but it gives no error.
Personally I do not where the error is now

Code (autolisp) Select
(defun c:cadtool_Main_TextButton1_OnClicked ( / purBlockP purDimP purlayp purltP purmatP purshaP purtexsP purmlsP purtabsP purvisP purregP purallp)

(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurbloc) 1)
(setq purBlockP T)
    )
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurdim) 1)
(setq purDimP T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlay) 1)
(setq purlayp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlt) 1)
(setq purltp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurmat) 1)
(setq purmatp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpursha) 1)
(setq purshap T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurtexs) 1)
(setq purtexsp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurmls) 1)
(setq purmlsp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurtabs) 1)
(setq purtabsp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurvis) 1)
(setq purvisp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurreg) 1)
(setq purregp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurall) 1)
(setq purallp T)
)
(dcl_Form_Close cadtool_Main)
 
(if purBlockP
    (command "-purge" "B" "*" "N")
)
(if purDimP
(command "-purge" "D" "*" "N")
)
(if purlayP
(command "-purge" "la" "*" "N")
)
(if purltP
(command "-purge" "lt" "*" "N")
)
(if purmatP
(command "-purge" "ma" "*" "N")
)
(if purshaP
(command "-purge" "m" "*" "N")
)
(if purtexsP
(command "-purge" "sh" "*" "N")
)
(if purmlsP
(command "-purge" "st" "*" "N")
)
(if purtabsP
(command "-purge" "t" "*" "N")
)
(if purvisP
(command "-purge" "v" "*" "N")
)
(if purregP
(command "-purge" "r" "*" "N")
)
(if purallP
(command "-purge" "all" "*" "N")
)
)
Title: Re: NIL value not allowed
Post by: roy_043 on August 28, 2012, 06:41:18 AM
I have built a quick test using my suggestion. The attached files work for BC12.2.17+ODCL7.0.0.6.
Title: Re: NIL value not allowed
Post by: Atwist on August 28, 2012, 09:18:45 AM
Sorry even now I get the error message

(https://dl.dropbox.com/u/57820558/fout%20dcl.png)
Title: Re: NIL value not allowed
Post by: XDCAD on August 28, 2012, 09:41:40 PM
Did you put the control variables in your function inside statement into local variables?
Title: Re: NIL value not allowed
Post by: Atwist on August 28, 2012, 09:57:35 PM
I have used the lisp and odcl from post # 5.
Title: Re: NIL value not allowed
Post by: XDCAD on August 28, 2012, 10:29:35 PM
Your error reason is the control variable is NIL, so

You check error control variable name, and then see the variable is in your LISP program other function definitions, give it a local variable declarations. If the local variable declaration, then the external control variable is not transfer function inside.