Jump to content

Recommended Posts

Posted (edited)

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;


}





}

Edited by Rod PP
Posted
(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
[color=blue]      (action_tile "LL" "(setq LW [color=purple][b]([/b]distof [/color]$value[b][color=purple])[/color][/b])")
(action_tile "HH" "(setq HW [color=#800080][b]([/b]distof [/color]$value[b][color=purple])[/color][/b])")
(action_tile "OO" "(setq OW [color=#800080][b]([/b]distof [/color]$value[b][color=purple])[/color][/b])")[/color]
     (action_tile "accept" "[b][color=blue](done_dialog 1)[/color][/b]")
     (start_dialog)
     (unload_dialog dcl_id)
     [color=blue][b](w1_act)[/b][/color]
     (princ)
     )

Posted

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

Posted

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

Posted

That's what I have done, I Copied and Posted the code. Reloaded, and it comes with that message.

=(

Posted

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" "[b][color=blue](done_dialog 1)[/color][/b]")
     (start_dialog)
     (unload_dialog dcl_id)
     [color=blue][b](w1_act);<---- outside of "accept" action tile[/b][/color]

 

You need tio unload the dialog before your can call getpoint.

Posted

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) [b][color="red"]OW[/color][/b]))
     (setq i1 (polar bi1 (dtr 90.0) [b][color="red"]OW[/color][/b]))

Posted

I think the OW has no value and that's why the error message appears .:)

 

Tharwat,

 

LOOK CLOSELY:

 (action_tile "OO" "(setq [b][color=blue]OW[/color][/b] (distof $value))")

Posted
Tharwat,

 

LOOK CLOSELY:

 (action_tile "OO" "(setq [b][color=blue]OW[/color][/b] (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     b2  b3     b4 "c"    "PLine" i1     i2  i3     i4 "c"    "PLine"  B1     i1  ""     "PLine"  b2     i2   ""     "PLine"   b3     i3  ""     "PLine"  b4     i4  ""  )
 (princ)
)
 (w1_act)
 (princ)
)

Posted

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!!

Posted
Thanks a lot everyone, it worked for me the way Tharwat wrote above. I will check what he has done now.

 

It worked for me because I moved the sub-routine to the top of the routine to let variables get values before evaluating each variables' value to become

with the result that we looking forward . :D

Posted

Geee, I swear I did try that with my very first try before coming to the forum, but I as it wasnt working at all with me, I didnt think about it anymore.

Thanks Tharwat. =]

 

Anyone who could answer me..

I still dont get the reason for that "distof" before "$value". What exactly does it do to the routine? =/

Posted

Anyone who could answer me..

I still dont get the reason for that "distof" before "$value". What exactly does it do to the routine? =/

 

From Help document ..

 

Converts a string that represents a real (floating-point) value into a real value
Posted
Geee, I swear I did try that with my very first try before coming to the forum....

 

The point here RodPP is you need to close the dialog before you can invoke getpoint hence the call to (w1_act):

 

 [i][b](unload_dialog dcl_id)[/b][/i]
     (w1_act);<----  here

 

And the call to (action_tile ..) be between (load_dialog "w1_dcl.dcl")) & (unload_dialog dcl_id)

 

I still dont get the reason for that "distof" before "$value".

 

This line and similar to it requires a floating point/Integer

(setq b2 (polar B1 (dtr 90.0) HW)) ;

 

Result from edit_box will give you a string value

(setq HW $value)):

 

You n eed to convert it to a value that polar function can recognize. its either this way

(setq LW (distof $value))

or

(setq HW $value)

(setq b2 (polar B1 (dtr 90.0) (distoff HW)))

 

BTW: The way i posted the code works the way it is.

 

HTH

Posted

Thanks Tharwat and pBe.

 

pBe, thanks for the explanation. =)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...