NIL value not allowed

Started by Atwist, August 27, 2012, 09:47:41 PM

Previous topic - Next topic

Atwist

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" "")
)
Atwist

I'm sorry because English is not my native language


Thanks for your help

roy_043

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.
)

Atwist

Atwist

I'm sorry because English is not my native language


Thanks for your help

Atwist

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")
)
)
Atwist

I'm sorry because English is not my native language


Thanks for your help

roy_043

I have built a quick test using my suggestion. The attached files work for BC12.2.17+ODCL7.0.0.6.

Atwist

Sorry even now I get the error message

Atwist

I'm sorry because English is not my native language


Thanks for your help

XDCAD

Did you put the control variables in your function inside statement into local variables?

Atwist

#7
I have used the lisp and odcl from post # 5.
Atwist

I'm sorry because English is not my native language


Thanks for your help

XDCAD

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.