Well, first of all, try not to use vl-cmdf or command. This will really slow you down for sure.
For example, in making new layers, you can create a list of dotted pairs, and then run mapcar to iterate through each one:
(setq acadobj (vlax-get-acad-object)
adoc (vla-get-ActiveDocument acadobj)
msp (vla-get-ModelSpace adoc)
layer_color
(list
'("°Point NUM" . 3)
'("°Point H" . 2)
'("°Point CODE" . 1)
'("°Point NOTE" . 8)
'("°Point 2D" . 7)
'("°Point 3D" . 5)
)
)
(mapcar
'(lambda (i)
(if (not (tblsearch "Layer" (car i)))
(vla-put-Color (vla-Add (vla-get-layers adoc) (car i)) (cdr i)))
)
layer_color
)
And here is an example that you can iterate through commas to save you coding space and time:
(setq text "12,23,34,45,56,67,89,"
between_commas nil)
(while (vl-string-search "," text)
(setq between_commas (cons (substr text 1 (vl-string-search "," text)) between_commas)
text (substr text (+ 2 (vl-string-search "," text))))
)
(setq between_commas (reverse between_commas))
Result is between_commas each in a list. You can even do the same with the variables. After which, you can do (mapcar 'cons variable text) or other lambda functions other than cons.
Last but not least:
(setq text_height 10 ; assumed, can change to suit
combinations
(list
(list "°Point H" (list tekst_y height_x 0) coord_z)
(list "°Point CODE" (list code_x coord_x 0) code)
(list "°Point NOTE" (list note_y height_x 0) note)
)
)
(mapcar
'(lambda (x)
(vla-put-layer (vla-AddText msp (caddr x) (apply 'vlax-3D-Point (cadr x)) text_height) (car x)))
combinations
)
Hopefully that helps with speeding you up some.
Thanks
Jonathan Handojo