Visual LISP, AutoLISP and General Customization

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

Changing the Text in a Dimension

311 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

*Expert Elite*
Kent1Cooper
Posts: 5,246
Registered: ‎09-13-2004
Message 2 of 4 (306 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 (295 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,246
Registered: ‎09-13-2004
Message 4 of 4 (256 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community