
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I wrote this program to automate translating Solidworks standard to Autocad standard.
Solidworks drawing saved to Autocad will be something like Layer - name, Linetype - hidden, color - red.
Autocad typically, name, linetype bylayer, color bylayer.
What I trying to do is to create a loop to extract the layer names from the table, create new layers with "-HID" suffix after the layer name.
Find all entities with dxf code 6 and dxf code 8, change them to the new layers.
Program work 90%. It has a error warning.
error: bad argument type:
Not sure how to fix it.
(defun c:Fixlay (/ d r x setname layername ltype_name layer_name)
(setvar "CMDECHO" 0)
(while (setq d (tblnext "layer" (null d)))
(setq r (cons (cdr (assoc 2 d)) r))
)
(setq x 0) (while (< x 100) (setq x (+ x 1)) ;Loop
(setq setname (nth x r)) ;Extract name
(setq layername (strcat (nth x r) "-HID")) ;Extract name from layer table & add "-HID" to name
(command "._layer" "m" layername "lt" "HIDDEN" "" "c" 1 "" "") ;Made layer
(setq ltype_name (cons 6 "Hidden"))
(setq layer_name (cons 8 setname))
(setq SETD (ssget "X" (list ltype_name layer_name)))
(if (null SETD)
(princ "\nENTITIEs NOT MOVED")
(progn
(command "._CHPROP" SETD "" "LA" layername "")))
(princ "\nENTITIES MOVED")
) ;END loop
(setvar "CMDECHO" 1)
(PRINC)
)
Solved! Go to Solution.