Text scripting in attribute definitions

Text scripting in attribute definitions

Zombies640
Contributor Contributor
1,321 Views
8 Replies
Message 1 of 9

Text scripting in attribute definitions

Zombies640
Contributor
Contributor
I have some MPOLYGONS with some properties attached to them (they were originally GIS parcels, that were converted to SQLite and imported back into autocad so we can label them) and I'm trying to display only the information we need. In the Planning & Analysis workspace, we are labeling these MPOLYGONS using the annotative template, with MAPANNTEXT. There are 2 fields I'm interested in; Lot Frontage and Address. For the lot frontage, I was able to type this into the "Value" section when defining the text attributes: (STRCAT "Frontage = " (rtos :LotFrontage@Parcels 2 2) "m") Which results in the label "Frontage = 59.21m" For the Address property, there are a bunch of spaces after each address and I'm trying to remove them using a similar method as above but I'm not having any luck. Anyone have any ideas?
0 Likes
Accepted solutions (1)
1,322 Views
8 Replies
Replies (8)
Message 2 of 9

tcorey
Mentor
Mentor

Is there a consistent number of spaces at the ends of the lines of text? You can use substr function to start at a certain character and capture a certain number, so (substr STRING 1 (- (strlen STRING) 4))) would capture the string but omit that last four characters.

 

If there is not a consistent number of spaces, then it will get more complicated. You would have to go to the last character, if it's a space, check next to last, if it's a space, check the previous, etc., continuing to set your character counter to one less each time you find a space.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 3 of 9

Zombies640
Contributor
Contributor
Thanks for the reply! Unfortunately, the spaces vary. Since these were taken from GIS and the "Address" field had a max. character limit of 50, and since I can't edit the schema (database permissions), CAD brought over the spaces during the import. For example: "53 Smith Street" will have 35 right spaces "1415 Autodesk Avenue" will have 30 right spaces I was thinking of doing a LISP routine for this, but if it can be solved without LISP, it would be all the better.
0 Likes
Message 4 of 9

Zombies640
Contributor
Contributor
Also have no idea why I can't add hard returns in my replies....
0 Likes
Message 5 of 9

Civil3DReminders_com
Mentor
Mentor

I haven't tested it on real data, but RTRIM should work or Trim.

 

More info is found here. 

 

http://docs.autodesk.com/CIV3D/2013/ENU/index.html?url=filesMAPC3D/GUID-28930D73-61C0-4E5A-9D04-8E85...

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
0 Likes
Message 6 of 9

Zombies640
Contributor
Contributor
For some reason, those aren't working. RTRIM returns the text "RTRIM(:Address@Parcels)" and TRIM returns "TRIM('trailing', :Address@Parcels)" (no quotations)
0 Likes
Message 7 of 9

Civil3DReminders_com
Mentor
Mentor
Accepted solution

You are using what ever language the Annotation Text uses so the Trim needs to be formatted in a way it understands. In this case the format would be something like this: 

 

(STRCAT "Test=" (TRIM :Feature@Drainage_Inlet_Outline) "End")

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
0 Likes
Message 8 of 9

Zombies640
Contributor
Contributor
That's it. You nailed it. It makes sense...just getting into the whole utilizing programming functions within labels and commands, so getting a hang of what works and what doesn't work is a bit of a learning curve.
0 Likes
Message 9 of 9

Zombies640
Contributor
Contributor
Thank you so much!
0 Likes