Basic LISP + DCL problem
I am a beguiner.I have just started yesterday!!!!!
I am placing LISP and DCL codes below. If anyone could point what I am doing wrong and how to fix it. Thanks a lot.
P.S.: The main goal here is to create a simple Fixed Panel. Later on I will try to add mullion, transoms and sashes (hinged, sliding, etc). All to do with my job. Trying to make things faster and easier, i guess.
LISP
(defun dtr (x)(* pi (/ x 180.0)))(defun w1_act()(action_tile "LL" "(setq LW $value)")(action_tile "HH" "(setq HW $value)")(action_tile "OO" "(setq OW $value)")(setq B1 (getpoint))(setq b2 (polar B1 (dtr 90.0) HW))(setq b3 (polar b2 (dtr 0.0) LW))(setq b4 (polar B1 (dtr 0.0) LW))(setq bi1 (polar B1 (dtr 0.0) OW))(setq i1 (polar bi1 (dtr 90.0) OW))(setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))(setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))(setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))(command "PLine" B1 b2 b3 b4 "c" "PLine" i1 i2 i3 i4 "c" "PLine" B1 i1 "" "PLine" b2 i2 "" "PLine" b3 i3 "" "PLine" b4 i4 "")(princ))(defun c:w1 ()(setq dcl_id (load_dialog "w1_dcl.dcl")) (if (not (new_dialog "w1_dcl" dcl_id)) (exit ) );if(action_tile "accept" "(w1_act)")(start_dialog)(unload_dialog dcl_id)(princ))
DCL
w1_dcl: dialog{label = "FIXED PANELS";: edit_box{label = "Lenght :";mnemonic = "L";key = "LL";alignment = centered;edit_limit = 5;edit_width = 5;}: edit_box{label = "Height :";mnemonic = "H";key = "HH";alignment = centered;edit_limit = 5;edit_width = 5;value = "";}: edit_box{label = "Offset :";mnemonic = "O";key = "OO";alignment = centered;edit_limit = 5;edit_width = 5;value = "50";}: errtile {width = 15;}: button {key = "accept";label = "PICK POINT";is_default = true;fixed_width = true;alignment = centered;}} (defun dtr (x)(* pi (/ x 180.0)))(defun w1_act() (setq b1 (getpoint "\nPick Point: ")) (setq b2 (polar B1 (dtr 90.0) HW)) (setq b3 (polar b2 (dtr 0.0) LW)) (setq b4 (polar B1 (dtr 0.0) LW)) (setq bi1 (polar B1 (dtr 0.0) OW)) (setq i1 (polar bi1 (dtr 90.0) OW)) (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW)))) (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW)))) (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))(command"PLine" B1 b2 b3 b4 "c""PLine" i1 i2 i3 i4 "c""PLine" B1 i1 """PLine" b2 i2 """PLine" b3 i3 """PLine" b4 i4 "") (princ) )(defun c:w1() (setq dcl_id (load_dialog "w1_dcl.dcl")) (if (not (new_dialog "w1_dcl" dcl_id)) (exit) ) ;if (action_tile "LL" "(setq LW (distof $value))")(action_tile "HH" "(setq HW (distof $value))")(action_tile "OO" "(setq OW (distof $value))") (action_tile "accept" "(done_dialog 1)") (start_dialog) (unload_dialog dcl_id) (w1_act) (princ) ) Thanks for your attention.
I have tried to use and understand what you have passed, but it is coming with the following error:
Command: w1
Pick Point: ; error: bad argument type: numberp: nil Copy and paste what i posted there Rod PP and try again
You will notice i move the action_tile line out of w1_act function and into w1
BTW: use Code Tags
CODE POSTING GUIDELINES That's what I have done, I Copied and Posted the code. Reloaded, and it comes with that message.
=( Glad you read and followed the CPG RodPP
Again. make sure you copied and pasted the code i posted and SAVE
LOOK CLOSELY:
(action_tile "accept" "(done_dialog 1)") (start_dialog) (unload_dialog dcl_id) (w1_act); Localizing variables is a very good habit
I think the OW has no value and that's why the error message appears .
(setq bi1 (polar B1 (dtr 0.0) OW)) (setq i1 (polar bi1 (dtr 90.0) OW))
Tharwat,
LOOK CLOSELY:
(action_tile "OO" "(setq OW (distof $value))")
Correct , i have just noticed it , this is the way that the code worked for me , ..
(defun c:w1 () (setq dcl_id (load_dialog "w1_dcl.dcl")) (if (not (new_dialog "w1_dcl" dcl_id)) (exit) ) ;if (action_tile "LL" "(setq LW (distof $value))") (action_tile "HH" "(setq HW (distof $value))") (action_tile "OO" "(setq OW (distof $value))") (action_tile "accept" "(done_dialog 1)") (start_dialog) (unload_dialog dcl_id) (defun dtr (x) (* pi (/ x 180.0)))(defun w1_act () (setq b1 (getpoint "\nPick Point: ")) (setq b2 (polar B1 (dtr 90.0) HW)) (setq b3 (polar b2 (dtr 0.0) LW)) (setq b4 (polar B1 (dtr 0.0) LW)) (setq bi1 (polar B1 (dtr 0.0) OW)) (setq i1 (polar bi1 (dtr 90.0) OW)) (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW)))) (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW)))) (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW)))) (command"PLine"B1 b2b3 b4 "c" "PLine" i1 i2i3 i4 "c" "PLine"B1 i1"" "PLine"b2 i2 "" "PLine" b3 i3"" "PLine"b4 i4"") (princ)) (w1_act) (princ)) Thanks a lot everyone, it worked for me the way Tharwat wrote above. I will check what he has done now. Then I will try to add extra pieces, like mullions, transoms, sashes, option for sliding, hinged door, etc etc.
Gosh, its a long way ahead, but I want to try. I am sorry to distrub the Forum (and I will... a lot)... so whatever I can do to help, please let me know. Thanks you all!!
页:
[1]
2