I created a huge code about 10 years ago and it is working since then.
Now i want to modify this code.(Also for learning others ways to get info and so on...).So i modified it to code below.
But i get errors...
Msg> bad argument type: numberp: nil
And f.i. the first thing it is supposed to do is setting "schaalecht" and this is not being set.
I think it has something to do with conversions or am i missing something here ,but i can't seem to figure this one out.
(He are small parts of the "old" code of how to get info)
(start_list "list_schaal")
(setq displistschaal
(list
;123456789012345678901234567890
" 1:20 04"
" 1:50 05"
" 1:100 06"
)
)
(mapcar 'add_list displistschaal)
(end_list)
(start_list "list_formaat")
(setq listformaat
(list
;123456789012345678901234567890123456789012345678901234567890123456789012345
" ISO A2 (420.00 x 594.00 MM) A2 594 420"
" ISO A1 (594.00 x 841.00 MM) A1 841 594"
" ISO A0 (841.00 x 1189.00 MM) A0 1189 841"
" User 1 (594.00 x 1051.00 MM) 594x1051 1051 594"
))
(mapcar 'add_list listformaat)
(end_list)
(action_tile "list_schaal" "(setq schaalecht (nth (atoi $value) displistschaal))(schaalid)(list_schaal_action $value)" )
(action_tile "list_formaat" "(setq formaatecht (nth (atoi $value) listformaat))" )
(defun schaalid (/)
(setq sch (atof (substr schaalecht 6 5)))
(setq schnr (atof (substr schaalecht 27 2)))
)
(defun formaatid (/)
(setq kader (substr formaatecht 46 8))
(setq rbx (atof (substr formaatecht 65 4)))
(setq rby (atof (substr formaatecht 71 4)))
)
(defun bereken ()
(setq mode_o (smodes '(("CMDECHO" 1)
("BLIPMODE" 0)
("ATTREQ" 1)
("REGENMODE" 0)
("EXPERT" 4)
("TEXTEVAL" 1)
)))
(setvar "aperture" 5)
(setq schaal (rtos sch 2 0))
(setq annotschaal (strcat "1:" schaal))
(setq limlo (list (* sch -20.0) (* sch -20.0)))
(setq limrb (list (* sch (+ 10.0 rbx)) (* sch (+ 10.0 rby))))
(setq lo (list 0 0))
(setq rb (list (* rbx sch) (* rby sch)))
(princ)
)
(He are small parts of the "new" not working code of how to get and set vars same action tile as "old" code)
(start_list "list_schaal")
(setq displistschaal
(list
"1:20"
"1:50"
"1:100"
)
)
(mapcar 'add_list displistschaal)
(end_list)
(start_list "list_formaat")
(setq listformaat
(list
"ISO A2 (420.00 x 594.00 MM)"
"ISO A1 (594.00 x 841.00 MM)"
"ISO A0 (841.00 x 1189.00 MM)"
))
(mapcar 'add_list listformaat)
(end_list)
(defun schaalid (/)
(cond
((= schaalecht "1:20") (setq sch "20") (setq schnr "04"))
((= schaalecht "1:50") (setq sch "50") (setq schnr "05"))
((= schaalecht "1:100") (setq sch "100") (setq schnr "06"))
)
)
(defun formaatid (/)
(cond
((= formaatecht "ISO A2 (420.00 x 594.00 MM)") (setq kader "A2") (setq rbx "594") (setq rby"420"))
((= formaatecht "ISO A1 (594.00 x 841.00 MM)") (setq kader "A1") (setq rbx "841") (setq rby"594"))
((= formaatecht "ISO A0 (841.00 x 1189.00 MM)")(setq kader "A0") (setq rbx "1189")(setq rby"841"))
)
)