Hello everyone,
I'm new in LISP programming and I have some issue in a LISP Routine. I try to make a Routine which put elements of a drawing from an old Layer to a new one. The Routine do this:
1. import a formated text file
(Each Line is defined like this: old_Layer Bloc_name new_Color new_Line_Type new_layer)
2. For each Line the Routine affects the variables with the currently read Line
3. The Routine make a selection (ssget) according to the old_Layer
4. And put the selected elements to the new one.
Her is the code:
(defun C:TRI_ELMT_CALQUE( / Calque1 s)
(setq FN1 (getfiled "Fichier format Calque1 Bloc Couleur Ligne Calque2" "" "txt" 12))
(setq FL1 (open FN1 "r"))
(setvar "attreq" 1)
(setvar "attdia" 0)
(initdia 0)
(while (setq DATA-STR (read-line FL1))
(setq DATA-LIST (read (strcat "(" DATA-STR ")")))
(setq Calque1 (car DATA-LIST))
(setq Nom_bloc (nth 1 DATA-LIST))
(setq Couleur (nth 2 DATA-LIST))
(setq Type_ligne (nth 3 DATA-LIST))
(setq Calque2 (nth 4 DATA-LIST))
(if (equal Nom_bloc 'vide)
(progn
(if (setq sset (ssget "_x" (list (cons 8 Calque1))))
(progn
(command "_.chprop" sset "5" "Tangente" "CONTINUOUS" "")
)
)
)
(progn
(if (setq sset (ssget "_x" (list (cons 0 "LINE")(cons 8 Calque1))))
(progn
;empty for now
)
)
)
)
)
(prin1)
(close FL1)
)
The problem that I encounter is that the variable "Calque1" (old_Layer) is a Symbol type and it makes an Error (bad argument) in the ssget Selection and in the Chprop Command because it needs a string type. If I put the following line:
(setq Calque1 "old_Layer") instead of (setq Calque1 (car DATA-LIST))
I have no more error.
Can someone helps me to define the Calque 1 Variable correctly please? Do I need to convert it in String?
Thanks in advance