AK_mrts Posted December 10, 2017 Share 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 Link to comment Share on other sites More sharing options...
marko_ribar Posted December 10, 2017 Share Posted December 10, 2017 (setq LAYERNAME (vla-get-layer obj1)) Quote Link to comment Share on other sites More sharing options...
AK_mrts Posted December 10, 2017 Author Share Posted December 10, 2017 Perfect..Thank you very much for the help Marko Ribar. Quote Link to comment Share on other sites More sharing options...
Grrr Posted December 10, 2017 Share 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 Link to comment Share on other sites More sharing options...
BIGAL Posted December 10, 2017 Share 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 Link to comment Share on other sites More sharing options...
ronjonp Posted December 11, 2017 Share 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 Link to comment Share on other sites More sharing options...
BIGAL Posted December 12, 2017 Share Posted December 12, 2017 Thanks fixed Quote Link to comment Share on other sites More sharing options...
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.