Message 1 of 10
new layers from objects
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i have this lisp that convert all object colour and linetype in layers but don't work give me
; error: no function definition: VLA-GET-LTSCALE
(vl-load-com)
(defun c:classify ( / ss ssl index obj color linetype ltscale str layertable newlayername)
(princ "\n select object to classify")
(if (setq ss (ssget))
(progn
(setq ssl 0)
(setq ssl (sslength ss))
(setq index 0)
(setq str "")
(repeat ssl
(setq obj (vlax-ename->vla-object (cdr (assoc -1 (entget (ssname ss index))))))
(setq color (vla-get-color obj))
(if (= color 256) ; if by layer
(setq color (cdr (assoc 62 (tblsearch "LAYER" (vla-get-layer obj)))))
)
(setq color (vl-princ-to-string color))
(setq linetype (vl-princ-to-string (vla-get-linetype obj)))
(if (= linetype "ByLayer") ; if by layer
(setq linetype (cdr (assoc 6 (tblsearch "LAYER" (vla-get-layer obj)))))
)
(setq linetype (vl-princ-to-string linetype))
(setq ltscale (vl-princ-to-string (vla-get-ltscale obj)))
(setq str (strcat "color-"color "_lt-" linetype "_lts-" ltscale))
(setq layertable (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))
(if (= (tblsearch "LAYER" str) nil)
(progn
(setq newlayername (vla-add layertable str))
(vla-put-color newlayername color)
(vla-put-linetype newlayername linetype)
(vla-put-ltscale newlayername ltscale)
); end of progn
); end of if
(vlax-put-property obj 'layer str)
(setq index (+ index 1))
);end of repeat
);end of progn
);end of if
(princ)
);end of defun