AK_mrts Posted December 10, 2017 Posted December 10, 2017 Hi, I have snippet as below as part of the lisp code (setq obj1 (vlax-ename->vla-object (car (entsel "\nPick object 1")))) Could you please assist to get layername of the obj1. I have tried (setq VLA_OBJ_LAYER (vla-get-layer obj1)) (setq VLA_ACT_DOC (vla-get-ActiveDocument (vlax-get-Acad-Object))) (setq LAYERNAME (vla-Item (vla-get-Layers VLA_ACT_DOC) VLA_OBJ_LAYER)) But it run to error. Thanks Quote
marko_ribar Posted December 10, 2017 Posted December 10, 2017 (setq LAYERNAME (vla-get-layer obj1)) Quote
AK_mrts Posted December 10, 2017 Author Posted December 10, 2017 Perfect..Thank you very much for the help Marko Ribar. Quote
Grrr Posted December 10, 2017 Posted December 10, 2017 FWIW Your attempt should be written as: (setq LAYERNAME (vla-get-layer obj1)) (setq VLA_ACT_DOC (vla-get-ActiveDocument (vlax-get-Acad-Object))) (setq VLA_OBJ_LAYER (vla-Item (vla-get-Layers VLA_ACT_DOC) LAYERNAME)) So you just reverse the symbolnames of "VLA_OBJ_LAYER" and "LAYERNAME" to refer to their (correct) values. Quote
BIGAL Posted December 10, 2017 Posted December 10, 2017 (edited) You will find this very handy it will show the properties and a lot of them you can get at with a VLA-GET-xxxxxxx obj you can also do the opposite and use VLA-PUT-xxxxxx obj to change values. ;;;===================================================================; ;;; DumpIt ; ;;;-------------------------------------------------------------------; ;;; Dump all methods and properties for selected objects ; ;;;===================================================================; (defun C:DumpIt ( / ent) (while (setq ent (entsel)) (vlax-Dump-Object (vlax-Ename->Vla-Object (car ent)) T ) ) (princ) ) ; EndPoint = (513.775 345.565 0.0) ; Layer = "DEFAULT" ; Length (RO) = 250.296 ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 42 ; ObjectName (RO) = "AcDbLine" ; OwnerID (RO) = 43 ; PlotStyleName = "ByLayer" ; StartPoint = (263.479 345.565 0.0) ; Thickness = 0.0 Edited December 12, 2017 by BIGAL Quote
ronjonp Posted December 11, 2017 Posted December 11, 2017 You will find this very handy it will show the properties and a lot of them you can get at with a VLA-GET-xxxxxxx obj you can also do the opposite and use VLA-PUT-xxxxxx obj to change values. ;;;===================================================================; ;;; DumpIt ; ;;;-------------------------------------------------------------------; ;;; Dump all methods and properties for selected objects ; ;;;===================================================================; (defun C:DumpIt ( / ent) (while (setq ent (entsel)) (vlax-Dump-Object (vlax-Ename->Vla-Object (car ent)) ) ) (princ) ) ; EndPoint = (513.775 345.565 0.0) ; Layer = "DEFAULT" ; Length (RO) = 250.296 ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 42 ; ObjectName (RO) = "AcDbLine" ; OwnerID (RO) = 43 ; PlotStyleName = "ByLayer" ; StartPoint = (263.479 345.565 0.0) ; Thickness = 0.0 To get the methods, you need to include the 'T' for vlax-dump-object like so: (vlax-dump-object (vlax-ename->vla-object (car ent)) t) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.