Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Valued Mentor
dcouch
Posts: 370
Registered: ‎10-22-2003
Message 1 of 4 (368 Views)
Accepted Solution

Changing the Text in a Dimension

368 Views, 3 Replies
10-15-2012 02:15 PM

I should know this, but it escapes me.  I want to override the measurement in a dimension with a string of text using a LISP command.

 

E.g.. "select dimension"

type new text for dimension

replace dimension measurement with new text. 

 

I can get the entity and its values, buy not sure which value to change for the "text override".

 

BTW Acad 2012.

 

Any help would be appreciated.

 

Dave


dcouch wrote:

I can get the entity and its values, buy not sure which value to change for the "text override".

....


Perfect. Thank you very much. ....

You're welcome.  The easy way to identify which value to change for anything is to draw something, give the characteristic of it that you want to identify a distinctive value, and look at the entity data to find that value.  So if you draw a dimension, and override its text content in the Properties Box or by way of a text-editing command -- let's say you change it to say "Text override" -- and then apply (entget) to it, you'll find this entry in the entity data:

 

(1 . "Text override")

 

That will tell you that it's the DXF code 1, or (assoc 1) value, or however you want to describe it, that holds that information.

 

I suggest a distinctive value particularly for the case of numerical entries.  For instance, if you want to know what DXF entry holds the Thickness of an entity, draw one and change its Thickness in the Properties Box or by way of CHPROP.  But don't change it to something like 1 or 1.0, because there may be a variety of DXF entries that have that in them, just as there may be several that have 0.0 in them, so you may not be able to tell which one it is if you leave its Thickness at 0.  Change it to something out-of-the-ordinary lke 1.2345, and it will be easy to locate it in the entity data list [Thickness is 39].

*Expert Elite*
Kent1Cooper
Posts: 5,871
Registered: ‎09-13-2004
Message 2 of 4 (363 Views)

Re: Changing the Text in a Dimension

10-15-2012 02:31 PM in reply to: dcouch

dcouch wrote:

....  I want to override the measurement in a dimension with a string of text using a LISP command.

....

I can get the entity and its values, buy not sure which value to change for the "text override".

....


There are at least a couple of ways to do that:

 

(entmod

  (subst

    (cons 1 YourNewTextContentVariable)

    (assoc 1 YourEntityData)

    YourEntityData

  )

)

 

or convert it to a VLA object, and do:

 

(vla-put-TextOverride YourVLAObject YourNewTextContentVariable)

 

And there may be others....

Kent Cooper
Valued Mentor
dcouch
Posts: 370
Registered: ‎10-22-2003
Message 3 of 4 (352 Views)

Re: Changing the Text in a Dimension

10-15-2012 03:53 PM in reply to: Kent1Cooper
Perfect. Thank you very much. David Couch Walden & Associates 2552 White Road, Suite B Irvine, CA 92614 949-660-0110 Fax: 949-660-0418 www.waldenassociates.com
*Expert Elite*
Kent1Cooper
Posts: 5,871
Registered: ‎09-13-2004
Message 4 of 4 (313 Views)

Re: Changing the Text in a Dimension

10-16-2012 06:43 AM in reply to: dcouch

dcouch wrote:

I can get the entity and its values, buy not sure which value to change for the "text override".

....


Perfect. Thank you very much. ....

You're welcome.  The easy way to identify which value to change for anything is to draw something, give the characteristic of it that you want to identify a distinctive value, and look at the entity data to find that value.  So if you draw a dimension, and override its text content in the Properties Box or by way of a text-editing command -- let's say you change it to say "Text override" -- and then apply (entget) to it, you'll find this entry in the entity data:

 

(1 . "Text override")

 

That will tell you that it's the DXF code 1, or (assoc 1) value, or however you want to describe it, that holds that information.

 

I suggest a distinctive value particularly for the case of numerical entries.  For instance, if you want to know what DXF entry holds the Thickness of an entity, draw one and change its Thickness in the Properties Box or by way of CHPROP.  But don't change it to something like 1 or 1.0, because there may be a variety of DXF entries that have that in them, just as there may be several that have 0.0 in them, so you may not be able to tell which one it is if you leave its Thickness at 0.  Change it to something out-of-the-ordinary lke 1.2345, and it will be easy to locate it in the entity data list [Thickness is 39].

Kent Cooper
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.