Adding a DCL to a LISP

Adding a DCL to a LISP

francine.zimmermannSRSWJ
Advocate Advocate
829 Views
9 Replies
Message 1 of 10

Adding a DCL to a LISP

francine.zimmermannSRSWJ
Advocate
Advocate

I have a lisp to which I would like to add a DCL,
I have 2 actions, D1 for the predefined thickness and D2 for the user-defined thickness.
But only D2 works.
For D1 I get the following responses: error: bad argument type: numberp: ‘60’.

Can you please help me?

 

0 Likes
Accepted solutions (2)
830 Views
9 Replies
Replies (9)
Message 2 of 10

ec-cad
Collaborator
Collaborator
Accepted solution

Check if this works.

 

 

(action_tile "d1" "(setq RW* (atof (nth (atoi (setq _j $value)) d1)))")
   (action_tile "d2" "(setq RW* (atof $value))")

 

 

 

 

 

ECCAD

Message 3 of 10

Sea-Haven
Mentor
Mentor

Have a look at this its a library routine can be used in any code. Just uses 2 lists of values. There is example code in top of the file.

 

 

(if (not ah:buttscol)(load "Multi Radio buttons 2col.lsp"))
(if (= ah:but nil)(setq ah:but 1))
(if (= ah:but2 nil)(setq ah:but2 1))
(setq lst1 (list "Choose size 1" "30" "40" "50" "60" "70" "80" "90"))
(setq lst2 (list "Choose size 2" "30" "40" "50" "60" "70" "80" "90"))
(ah:buttscol ah:but ah:but2 "Select D1 D2" lst1 lst2)
(setq ans1 (atof (nth ah:2col lst1)))
(setq ans2 (atof (nth ah:2col2 lst2)))

 

SeaHaven_1-1729212459832.png

 

 

 

 

 

Message 4 of 10

francine.zimmermannSRSWJ
Advocate
Advocate

Is it possible to add an explanation text to a value? 

For example 30 is the value necessary for the Lisp and , Stone, 70kg is only a text for the available type of insulation

30  , Stone, 70kg

50 , Glass, 54kg

50 , Stone, 70kg

50 , Stone, 80kg

70 , Glass, 54kg

0 Likes
Message 5 of 10

paullimapa
Mentor
Mentor

sure, just change this line of code and enjoy...

;   (setq d1 '("30" "40" "50" "60" "70" "80" "90"))
   (setq d1 '("30, Stone, 70kg" "40, Glass, 54kg" "50, Stone, 70kg" "60, Stone, 80kg" "70, Glass, 54kg" "80" "90"))

Now the dcl looks like this:

paullimapa_0-1729789791864.png

atof function still can convert the string to a floating number because the number comes first in the string.
You can run the following tests at the command prompt:
paullimapa_1-1729789933795.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 10

Sea-Haven
Mentor
Mentor

Just change the lst1 & lst2 in the solution I suggested, lst1 would be "30" "50" "70" only, list2 would have the material and weight.

0 Likes
Message 7 of 10

francine.zimmermannSRSWJ
Advocate
Advocate

Is it possible to add a text , for example: 30, Stone, 70kg

I try but d1 is not working

(command "_text" "S" "TEXT-ARIAL" "J" "L" p1 (cvunit (+ ang (/ pi 2)) "radian" "degree") d1)

0 Likes
Message 8 of 10

paullimapa
Mentor
Mentor
Accepted solution

well, if you want to have the cake and eat it then you'll have to make the following changes:

1. I added this section at the beginning in case the text style does not exist and you can define all the style settings here:

 

; set text style name
(setq txtsty "TEXT-ARIAL"
      txtfnt "Arial.ttf"
      txthit 2
      txtwid 1
)

 

2. Change your action statements to include saving of the selected text string from the list box as d1* before converting it to floating number of RW*:

 

;   (action_tile "d1" "(setq RW* (atof (nth (atoi $value) d1)))")
;   (action_tile "d2" "(setq RW* (atof $value))")
   (action_tile "d1" "(setq RW* (atof (setq d1* (nth (atoi $value) d1))))") ; save selection as d1* and conversion as RW*
   (action_tile "d2" "(setq RW* (atof (setq d1* $value)))")

 

 3. Add the Text sequence at the end using the d* value:

 

; add text
    (if (not (tblsearch "STYLE" txtsty)) ; chk if style exists
     (command "_.Style" txtsty txtfnt txthit txtwid "" "" "") ; then create it 
    )
    (command "_.Text" "_S" "TEXT-ARIAL" "_J" "_L" p1 (cvunit (+ ang (/ pi 2)) "radian" "degree") d1*) ; d1* selection apply as text

 

paullimapa_0-1729856130042.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 9 of 10

francine.zimmermannSRSWJ
Advocate
Advocate
thank you for your help, I send it to my colleagues , perhaps they will have an others request on monday
0 Likes
Message 10 of 10

paullimapa
Mentor
Mentor

You are welcome…cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes