svorgodne Posted April 4, 2013 Posted April 4, 2013 What is a VLA-Object and what is it working for? Thanks in advance Quote
marko_ribar Posted April 4, 2013 Posted April 4, 2013 (edited) Think of VLA-Object as block of info used as Entity of Acad (V)isual(L)isp(A)ctivX-Object - used in VLISP Programming Language... Every Entity of Acad - no matter if its visible or invisible like ModelSpace entity can be converted into VLA-Object in order to gain more manipulation info over it... Remember that firstly you must initialize VLISP functions (vla-* , vlax-* and vlr-*) with typing or placing line (vl-load-com) before you want to use these functions... As for converting Acad ENAME object - that is Entity in Vanilla Lisp, you can use this function (vlax-ename->vla-object ent), where ent is variable that represent ENAME object retrieved with (ssname ss index) function where ss is selection set of Acad entites and index is number witch is referenced to each entity in sel. set ss... There are also other functions with witch you may obtain Entity - like (tblobjname "LAYER" "0") - this will return ENAME of Layer "0" witch is invisible Entity... Reversely, if you want to convert VLA-Object back to ENAME, you have function and for that (vlax-vla-object->ename obj), where obj is VLA-Object... But with obj variable that represent VLA-Object, you can access more info as I explained with (vlax-dump-object obj T) function, where T is optional parameter with witch you will be prompted to view even VLA methods that can be applicable to that particular VLA-Object... This info that contains every VLA-Object without methods you can easily view through VLIDE VLISP interface of Acad... Just select obj variable that represent VLA-Object right click with mouse on it in VLIDE interface and choose "inspect" option; dialog box with all info will show up, and with it you can further more jump into other VLA-Objects that are parent or child - to your original VLA-Object and inspect their data too... Almost for every property that is listed in this dialog box and that is referenced to your original VLA-Object you can access with functions such as (vla-get-*) and modify it with (vla-put-*) where * is that particular property that you're inspecting... Just remember that firstly not forget to initialize VLA-functions with (vl-load-com) statement executed in any Acad interface or console (VLIDE)... M.R. Edited April 4, 2013 by marko_ribar all vl-* functions are VLISP independent Quote
svorgodne Posted April 4, 2013 Author Posted April 4, 2013 Thanks a lot Marko, I think this is the clearest information anybody can get. Every information I found over the internet was about what you can do with VLA objects but not a definition at all. By the way. Do you know what the status of AutoCAD is? I mean. How much lifetime does it have? Will it be replaced by REVIT soon? Or is it going to last long? Thanks again. Sergio Quote
BIGAL Posted April 5, 2013 Posted April 5, 2013 If you download a copy of Dumpit.lsp and pick a object it will display lots of info about the "entity" then using the simple code below you can see how you can retrieve information. I find it easier than the older ASSOC method which uses the DXF codes. Here is a simple text dump Here is a simple text dump Select object: ; IAcadText: AutoCAD Text Interface ; Property values: ; Alignment = 0 ; Application (RO) = #<VLA-OBJECT IAcadApplication 000000013fc43318> ; Backward = 0 ; Document (RO) = #<VLA-OBJECT IAcadDocument 000000003025d5c8> ; EntityTransparency = "ByLayer" ; Handle (RO) = "11AEE" ; HasExtensionDictionary (RO) = -1 ; Height = 2.5 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000002caacab8> ; InsertionPoint = (312.301 280.565 0.0) ; Layer = "DEFAULT" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 51 ; ObjectID32 (RO) = 51 ; ObjectName (RO) = "AcDbText" ; ObliqueAngle = 0.0 ; OwnerID (RO) = 50 ; OwnerID32 (RO) = 50 ; PlotStyleName = "ByLayer" ; Rotation = 0.0 ; ScaleFactor = 1.0 ; StyleName = "Standard 2.5" ; TextAlignmentPoint = (0.0 0.0 0.0) ; TextGenerationFlag = 0 ; TextString = "aaaa" Now look at getting values methods, note inverse is the Put, Vlax-put-property (setq obj (entsel "\nPick an object")) (setq Textvals (vlax-get-property (vlax-ename->vla-object (car obj)) 'Textstring)) ; this is the actual text type see is it text next (setq layeris (vlax-get-property (vlax-ename->vla-object (car obj)) 'Layer)) ; this is the layer (setq whatisit (vlax-get-property (vlax-ename->vla-object (car obj)) 'ObjectName)) ; what is it text line pline etc Quote
Scoutr4 Posted July 23, 2023 Posted July 23, 2023 The object selected in the vlax for loop is throwing an error like this. How do i get entityname from this line? (vlax-for o b (if (= "AcDbHatch" (vla-get-objectname o))(progn ;;; I want to reach entity name ;;; I get an error when I use the object named o in the function #<VLA-OBJECT IAcadHatch 0000026d90dc5f68> Quote
BIGAL Posted July 23, 2023 Posted July 23, 2023 What are you trying to do ? Looks like selected hatches. Just work on o directly. Pick a couple of hatches. (vlax-for o b (if (= "AcDbHatch" (vla-get-objectname o)) (vlax-dump-object o) ) ) Quote
Scoutr4 Posted July 24, 2023 Posted July 24, 2023 I'm trying to combine tharwat and lee's code . I need to draw lines to hatches inside the block. https://www.cadtutor.net/forum/topic/46782-deleting-hatch-from-blocks/ http://www.lee-mac.com/boundingbox.html 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.