Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Contributor
sweapon2
Posts: 34
Registered: ‎08-18-2009
Message 1 of 8 (341 Views)

lisp properties

341 Views, 7 Replies
04-09-2012 10:36 AM

hello

 

anyone knows the lisp command to show (read/assign variables) to normal or custom properties in an object?

 

thanks in advance

*Expert Elite*
Kent1Cooper
Posts: 5,796
Registered: ‎09-13-2004
Message 2 of 8 (339 Views)

Re: lisp properties

04-09-2012 10:54 AM in reply to: sweapon2

sweapon2 wrote:

.... 

anyone knows the lisp command to show (read/assign variables) to normal or custom properties in an object?

....


Try converting the object's entity name into a VLA object with (vlax-ename->vla-object).  Then you can use (vlax-dump-object) to show its Properties, (vlax-get-property) to get a particular one, and (vlax-put-property) to assign a value to a particular one.  But there may be some characteristics that you can't work with that way [for instance, in an Ordinate Dimension, it seems you can't get at or alter the suppression state of the extension line by way of VLA Properties or regular entity data, but must dig into Extended Data to find it, and use the Dimoverride command to change it].

Kent Cooper
Active Contributor
sweapon2
Posts: 34
Registered: ‎08-18-2009
Message 3 of 8 (310 Views)

Re: lisp properties

04-09-2012 05:49 PM in reply to: Kent1Cooper

hello

thanks for the reply but i have little knowledge in visual lisp but not in VLA(VLX) is there any site for begginner to star learning  VLA??

 

thanks

Active Contributor
sweapon2
Posts: 34
Registered: ‎08-18-2009
Message 4 of 8 (309 Views)

Re: lisp properties

04-09-2012 06:17 PM in reply to: sweapon2

hi

i have used the V function you told me but i still can´t get the "feature properties" to show up or retrieve them, those are "joined data" from map 3d table, maybe it has something to do

 

thanks

*Expert Elite*
pbejse
Posts: 2,502
Registered: ‎11-24-2009
Message 5 of 8 (278 Views)

Re: lisp properties

04-10-2012 03:31 AM in reply to: sweapon2

sweapon2 wrote:

hi

i have used the V function you told me but i still can´t get the "feature properties" to show up or retrieve them, those are "joined data" from map 3d table, maybe it has something to do

 

thanks


I cant really test this on my end as I diont use MEP

 

To SEE what other Data an entity have, use Vlax-dump-object function

Besides the Property Values that doenst really hold ALL the data. you could also see Methods available.

 

(vlax-dump-object obj T)

like for example for Dynamic Blocks. (vlax-dump obj) doesnt show you the "visibility" properties, but it can be retrieve via Methods

 

; IAcadBlockReference: AutoCAD Block Reference Interface
; Property values:
; .....
;   EffectiveName (RO) = "A_DynamicBlock"
;   Handle (RO) = "7039"
;   HasAttributes (RO) = -1
;   HasExtensionDictionary (RO) = -1
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 24c40cd4>
;   InsertionPoint = (2368.54 -840.901 0.0)
;   InsUnits (RO) = "Unitless"
;   InsUnitsFactor (RO) = 1.0
;   IsDynamicBlock (RO) = -1
;   Layer = "A_DynamicBlock"
;   ZScaleFactor = 12.0
; .....     
; Methods supported:
; ......
;   GetAttributes ()
;   GetBoundingBox (2)
;   GetConstantAttributes ()
;   GetDynamicBlockProperties ()
;   GetExtensionDictionary ()
;   GetXData (3) <--- extended data perhaps
; .....     

 

HTH

 

Active Contributor
sweapon2
Posts: 34
Registered: ‎08-18-2009
Message 6 of 8 (261 Views)

Re: lisp properties

04-10-2012 06:43 AM in reply to: sweapon2

thanks

but how do i use those methods like getxdata, i have tried several things but i still cant make it work

 

 

Active Contributor
sweapon2
Posts: 34
Registered: ‎08-18-2009
Message 7 of 8 (251 Views)

Re: lisp properties

04-10-2012 09:15 AM in reply to: sweapon2

how do i activate those methods?

*Expert Elite*
Kent1Cooper
Posts: 5,796
Registered: ‎09-13-2004
Message 8 of 8 (235 Views)

Re: lisp properties

04-10-2012 11:53 AM in reply to: sweapon2

sweapon2 wrote:

.... how do i use those methods like getxdata, i have tried several things but i still cant make it work


Here's how I get AutoCAD to show me the Extended Data [if there is any] for a selected object:

 

  (print (cadr (assoc -3 (entget (car (entsel)) '("ACAD")))))

 

Here's how I get it to show me the VLA Properties:

 

  (setq ent (entsel "\nSelect object to List its Properties: "))
  (setq obj (vlax-ename->vla-object (car ent)))
  (vlax-dump-object obj T)

 

But I don't have MAP, so I couldn't say whether what you want will appear in either of these lists, or whether "ACAD" is the right application name for getting Extended Data.  And even if it does appear, it may take some interpreting.  For instance, in the example I mentioned before of an Ordinate Dimension with its extension line suppressed, here's what the Extended Data looks like:

 

("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 75) (1070 . 1) (1070 . 76) (1070 . 1) (1002 . "}"))

Kent Cooper
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!