Breaking/returning to new line inside the Value texbox within MapAnnText.

Breaking/returning to new line inside the Value texbox within MapAnnText.

evan.8585
Participant Participant
2,295 Views
20 Replies
Message 1 of 21

Breaking/returning to new line inside the Value texbox within MapAnnText.

evan.8585
Participant
Participant

Hey everyone! Long time lurker and data scrounger here, but first time posting. 
Here's an image of the textbox I'm working with. 

evan8585_1-1653408607844.png

It is located within the Define Annotation Template command with the alias of MAPANNTEXT. 

 

My question is how in the heck do I place a line break within the value box? I can get the info coming fine which consists of pole_number, height, and class using STRCAT, but can not for the life of me figure out how to shift each attribute to a new line. I've tried every combination of forward slash 'P' and 'n' in every location within the text that I can think that return various levels of failure (I've tried: \\P  \P  \p  \\p  \\N  \N  \\n  \n  '\\P'  '\P'  '\p'  '\\p'  '\\N'  '\N'  '\\n'  '\n'  "\\P"  "\P"  "\p"  "\\p"  "\\N"  "\N"  "\\n"  "\n". I've also place these in front of, behind, within, around, and every other place I can imagine within the script to absolutely no avail).  

 

The info is basically this rn concatinated together. I'd like it to look like what's on the left, but it looks like what's on the right. 

evan8585_2-1653409231373.png

Here's the full command I have in place so far:

(STRCAT :POLE_NUMBER@pole (STRCAT :Height@pole (STRCAT :Class@pole)))

 

Please help me!

 

0 Likes
2,296 Views
20 Replies
Replies (20)
Message 2 of 21

ChicagoLooper
Mentor
Mentor

Hello @evan.8585 

Here's an example:

 

I have two properties

  • CODE
  • NAME

I want one expression to display two lines of text, like this

Line 1=> CODE and Line 2=>NAME

The code on the first line and beneath it would be the name.

 

The expression would be this:

Concat (CODE , ( '\N' ) , NAME )

 

201.png

 

 

 

 

Chicagolooper

EESignature

Message 3 of 21

O_Eckmann
Mentor
Mentor

Hi @evan.8585 ,

 

You should use \P but you have to modify property of your attribute to "multiline"

 

Olivier

Olivier Eckmann

EESignature

Message 4 of 21

Pointdump
Consultant
Consultant

Hi Olivier,
"...you have to modify property of your attribute to 'multiline'"
How and where do you do that?
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
Message 5 of 21

evan.8585
Participant
Participant

Thanks @ChicagoLooper, but unfortunately it's not working as intended. It just prints the code:

evan8585_1-1653513810059.png

(the example shown is with the address tag this time, but I'd like this to be multiline also instead of 3 separate lines of text like it is now). 

 

@O_Eckmann Thanks, but this field doesn't let me choose multiline like in the annotation definition dialogue box. It's literally only the one textbox that I have access to: 

evan8585_2-1653513967829.png

And the little box to the right just lets me choose where I'm collecting data from. It doesn't offer any type of text editing help. 

0 Likes
Message 6 of 21

ChicagoLooper
Mentor
Mentor

@evan.8585 

 

You're trying to make multiline text in your MAPANNTEXT. Why?!?

 

When you perform the procedure for MapAnnText you can (and should) make 3 tags. There's no rule against creating more than one tag!

 

You're probably inserting your tag at 0,0. But.........If you make 3 tags your insertion points for each individual tag can be like this:

  1. PoleNumber 0,0
  2. Height 0,-0.2  
  3. Class 0, -0.4

Depending on your text size, you may have to adjust the insertion point. In the end you'll have 1 MapAnnTemplate that contains 3 tags.

Chicagolooper

EESignature

Message 7 of 21

ChicagoLooper
Mentor
Mentor

@evan.8585 

It soulds like you originally started with data such as a shapefile. You have provided only limited information and I'm not convinced the MapAnnTemplate is a Best Practice for the job at hand.

 

A better, a more easier way, is to label the poles in the STYLE EDITOR of the shapefile. Open a clean, brand new drawing and add the shapefile. Next create labels for PoleNo., Height and Class. You can easily format the labels using the Style Editor and end up with three pieces of text on three separate lines.

 

<<When creating the labels from the shapefile, the labels may overlap so AutoCAD will automatically reduce the number of labels. You'll need to zoom-in using your mouse wheel to give the labels more breathing space in-between the poles. The more space, the less overlap. Less overlap means the better the likelihood of all poles gaining a label. Even if some, or most, poles are 'off-screen' and not vsible, they'll still have a label due to the ' breathing space' you've gained during zoom-in.>>

 

Next use MAPLBEL2ANN command to convert the POLE labels from ESRI entities to AutoCAD Mtext entities. Select all the newly created Mtext labels, then copy and paste from this drawing to your original drawing. Once the labels have been pasted, you can dump the drawing with the shapefile, you don't need it anymore. Finally, you can customize the newly pasted labels: font style, text height, text layer, text color, etc.

 

Here's a video that demonstrates how to create labels for a STREET MAP. Although the video is labeling a street names labels, you can, with a little tweaking, apply the same principles to your specific utility poles. Highlights include the video include: 

 

  1. Making a Data Connection to a street map shapefile 
  2. Creating Street Name Labels for the street map 

  3.  

    Using MAPLABEL2ANN command to convert the ESRI street labels to AutoCAD Mtext
  4. Cutting-and-pasting the newly created Mtext to the working drawing.
  5. Optional (not shown): Adding AutoCAD objects such as lines, imagery and etc. to the working drawing. 

 

Chicagolooper

EESignature

Message 8 of 21

evan.8585
Participant
Participant

I want one multi line text object when it comes in so I can easily reposition it if it happens to be overlapping other visual information in the drawing. Here's an example of what I'm referring to: 

evan8585_0-1653522392043.png

In order to move 4 different fields without moving the base point (which I'd like to attach the pole block to), I have to move them one at a time, which is fine (I guess), but it's tedious. 

evan8585_1-1653522495963.png

 

I had originally experimented with the styles in the shapefile display manager, but I found the text controls to be very clunky and ultimately undesirable, especially since I couldn't figure out how to save them into a template I could use in future projects. I'm looking at cutting down the work, not increasing it. 

0 Likes
Message 9 of 21

ChicagoLooper
Mentor
Mentor

Huh? If you want to move the individual lines within your label, then the MAPANNTEXT is not the tool you should be using. If you can't create Mtext labels from a shapefile or if you think the shapefile labels is creating more work, then you need to reevalute your procedure. 

 

It's more efficient, way more, when you create shapefile labels. Then convert the shapefile labels to plain vanilla Mtext using MAPLABEL2ANN. Once you get the Mtext, you're in the AutoCAD 101 world. And isn't that the place all of us really want to be? I'll go. It's easy there!

 

As you already know, Mtext can be easily moved, rotated, and changed in terms of text style, text height and text color. The Mtext also gives you the opportunity to apply a frame and a mask. Since your data already exists, you should not only use it but use it efficiently.

 

I'm guessing you have issues creating shapefile labels or accessing certain parts of the database (dbf) to create those labels.  Your goal should be how to create labels you can effectively use, not how to make MAPANNTEXT behave in a way it can't and shouldn't.

 

If you're up to it, upload your shapefile data (or your drawing), so a detailed and effective workflow can be provided.

Chicagolooper

EESignature

Message 10 of 21

evan.8585
Participant
Participant

Sure! Why not? I should say that my end goal for this exercise is to get to a point where most of this is automatic. I want to open a new file, import the data (refresh), have it already formatted and adjusted without having to do any further adjusting (set it up once and done), and build it in a way that should I need to adjust the information, it's as easy as possible to do so. 

 

This clipping shows what I'd like the span tag to look like:

evan8585_0-1653573013328.png

 

Below are some gripes I have with the systems I'm trying to force into submission (hopefully, they are misguided claims and there is, in fact, a better methodology!):

Shapefiles and shapefile styling:

  • Text controls are clunky to setup especially when trying to control the position of inserted text or how often it's displayed on the shapefile information (notice the repeating '96' currently on the span)
  • Can't find the 'Save As' option for style setups. Again, I'd like to set something up once and be able to use it down the line for future projects. I don't want to setup a style guide every time I connect a new shapefile.
  • I'd also like to have the style read in multiple object data fields and display them in a neat, consistent way
    (i.e. "[SPAN LENGTH]' [FIBERCOUNT]F FOC")

Defined Map Templates

  • Some object data fields refuse to share their value when connected. (Tried connecting to the 'fibercount' field inside of the FIBER_CABLE data and all it would display was the tag 'fibercount' instead of the value which was 96)
  • Can't have multiple lines in value for MAPANNTEXT (This single thing would get me exactly where I think I want to go with this. All the data would be neatly inside one data object that I can easily move after creation. Additionally, all data comes in with the click of a button (UPDATE ANNOTATION)
  • Block parameters don't seem to extend to the MAPANNTEXT annotations like they do in regular blocks. Can't assign move or rotate controls for easy future manipulation. 

Hopefully, it's just a matter of not using the correct screwdriver to drive in these nails. Let me know where I'm fudging things up and how I can work more efficiently, please! Thanks in advance,

Evan

 

0 Likes
Message 11 of 21

O_Eckmann
Mentor
Mentor

Hi @evan.8585 , @Pointdump 

 

You are inside AutoCAD. Object created by MAPANNTEXT command is an attribute definition. You just click on it and change by properties palet Mutiline from NO to YES before going out of bloc editor.

Here is screencast (french interface, but I think you can retreive US corresponding properties).

 

 
Olivier

Olivier Eckmann

EESignature

Message 12 of 21

ChicagoLooper
Mentor
Mentor

@evan.8585 

Here's the end result which uses 100% AutoCAD objects: circle block, polylines, and mtext. Image-1.

Image-1Image-1

 

 

For this exercise, the POLE shapefile is using four attributes: (a) owner, (b) pole_numbe, (c) height and (d) class. You can use the expression like the one here.

Concat ( owner ,' \N ' , pole_numbe ,' \N ' , height ,' \N ' , class )

 

It'll look like this in the Create/Modify Expression window.

Image-2Image-2

 

 

To see how to build the label and convert it to mtext, you can watch this >>VIDEO<<.

 

Image-3 (from VIDEO)Image-3 (from VIDEO)

 

SPAN.shp (Image-4)

Image-4Image-4

 

FIBER_CABLE.shp (Image-5)

Image-5Image-5

 

 

Chicagolooper

EESignature

Message 13 of 21

evan.8585
Participant
Participant

Hey @ChicagoLooper, thanks for putting all that together. That almost gets me to where I want, but I have a couple questions for the process:

  • Any chance there's a way to call properties from within the SPAN .shp expression tag for FIBER .shp information?
    (ex: (SPAN-LENGTH , '' ' , FIBERCOUNT , 'F FOC') == (233' 96F FOC)
  • Is there any way to save the expressions for future use?
  • What's a good source for AutoCAD script documentation?
    (I find it's extremely hard to find results for expression information on the official AutoCAD help pages. (i.e. searching for 'return to next line in AutoCAD expression' rarely turned up results that weren't how to create a line vs how to return to the next line in a text expression)

P.S. Thanks @O_Eckmann for the tip. I didn't know you could make something multiline from the property window. I'll have to keep that in mind. 

0 Likes
Message 14 of 21

O_Eckmann
Mentor
Mentor

Hi @evan.8585 ,

 

For Map annotation template you have same possibilty as standard CAD attributes.

You can attach position parameter with a move action, and rotation parameter with rotate action as long as position property is LOCKED.

In property with lisp you can't use more than 3 parameter per lisp function. If you want to concate 4 or more information you need to use multiple STRCAT function. If not, you obtain a ADE error.

(strcat :Number@pole "\P" (strcat :Oxwner@Pole "\P" (strcat info3 "\P" info4)))

 

For SPAN it's more difficult. When you label an object, you can use data on this object for template. You can't use data from other object. So you can't label SPAN (polyline with OD)  with FIBER data (other polyline with OD).

Only soluton is to make a link (a join) between the 2 objects to add FIBER info on SPAN object. This link can be created by topology (buffer and overlay) but it's difficult and not automatic updated.

 

For keeping info in a DWG template (DWT), when using MAPIMPORT, you can save an IPF file (profil for import). So next time you launch MAPIMPORT, choose SHP files and load IPF to automatically fill dialog for import with bloc name, layer name, data table...

Because annotation template is a bloc with attribute, you just have its définition in your DWT to use it after import.

 

 
Olivier

Olivier Eckmann

EESignature

Message 15 of 21

ChicagoLooper
Mentor
Mentor

Hello @evan.8585 

 

An expression is created from the shapefile's database file, that's the dbf component of the SHAPEFILE.  (The other parts are shp, shx and prj.) So if you want an expression from the SPAN linework (that's the span geometry which is technically the SPAN.shp) you'll need to acquire the 'DATA' from the span dbf. You can't create an expression from the FIBER_CABLE's dbf and use it to label the SPAN.shp linework. You could, with know-how, merge the SPAN and FIBER_CABLE shapefiles which would effectively combine the attributes of both dbf's but it's not what I'd call efficient. You'd be doing all that work just to create a label and that's just not worth it. That doesn't mean it can't be done, I'd just find another way of doing it--using DATA that's not from the shapefile's dbf.

 

It's worth reviewing the data attributes of your three shapefiles: Pole, Span and Fiber_Cable. Generally speaking, your expressions are created by the tabular data or the columns (the column headings are your attributes, also called FIELDS). You can create calculations from the attributes, some examples include, but are not limited to, fieldA+fieldB, greater then or less than, etc., etc..... 

 

The image below are the attributes from SPAN.dbf. Notice the <Null> values. Null means there's a field for data, but the data field is not 'filled in.' Maybe the data wasn't collected, maybe it was collected but it wasn't entered into the databse or maybe someone #&@%'d up and deleted the data leaving only the column heading for other users. Whatever.....it looks lousy, not meaningful to those who may want to use it. Lot's and lot's of data placeholders but they're empty, not filled in. (The slider bar at the bottom reveals more columns.) Some even have zeros which probably means someone filled it in but entered '0' instead of a real world, meaningful value. BTW, you can't access the data if it's not stored to begin with. Where's your column for span? Is the SPAN column <Null>? Refer to image-1.

 

Image-1: The database file (dbf) of the SCAN shapefile.Image-1: The database file (dbf) of the SCAN shapefile.

One final word on DATA. For your Annotation Template to be useful, you'll need to have the attribute name identical from datafile-to-datafile. For example, owner vs. owned_by vs. OwnedBy would mess up your 'reusable' template and if you can't reuse it, what's the point in creating one in the first place?

 

<<Remember your previous post, you want to create it, use it, file it away then use it over and over again because you seek automation, yes?>>

 

How is it messed up?  Those 3 attributes are not the same. They might mean the same thing to you, me and everyone else, but when used in an expression, owner is not the same as owned_by and not the same as OwnedBy. Do you feel confident your data will be collected AND stored in a way that's reusable? Because if it's messed up, you'd need three separate Anno Templates to read each attribute!  You might as well call the attributes Moe, Larry and Curly. Automated? It doesn't look like it.

 

Yes, you can SAVE an expression. A good place to save it is in your project folder. Saving it in a centralized location so it can be used in other projects will have the limitations described in the previous paragraph. Once it's saved you can reuse it. Refer to image-2.

Image-2: Save and Load an expression can be done through Options.Image-2: Save and Load an expression can be done through Options. 

 

They 1st KEY is having organized data attributes to begin with and that involves (1) a well thought out plan to establish the attributes you know you'll need, (2) an organized way to store the data, and (3) a plan to retrieve the data after you've managed to store it. Yes, yes, I know, I know, you didn't create or collect the data, you're just a data user, the guy pushing a mouse. The 2nd KEY is to have 'reliable' data. As you already know, some online downloadable data is reliable, while others not so much. Bookmark the reliable ones. In the absence of good data, it probably best to create or formulate your own.    

 

For good documentation, I don't have any recommendations aside from searching the web and hiring a consultant. Yeah, expensive, but with the right one, it's worth it. You can download know hows here-and-there saving them to your hard drive. Print hardcopies and build a library. If your office has 'binding' capabilities (such as binding for outgoing reports) make your own text books. Search for videos too. It's hit-and-miss with videos. The videos might not cover what you really and truly want to learn while some are only made by those who just wanna be video stars.

 

And don't forget this forum, it's an indispensable resource especially if you're open minded and willing to look at  other ways (some are advanced methods you'd never ever consider) to do the job. It's a free education, don't squander it.

Chicagolooper

EESignature

Message 16 of 21

Pointdump
Consultant
Consultant

Evan,
I've been quietly working along with my own shapefile, and I finally achieved success. Key was Olivier's mention of "multiline". I'd have never figured that one out myself. Anyway, what I was trying to do is 3 lines of OD, thusly:
Name_0
Name_1
Name_2
The code I used is:
(strcat :NAME_0@Default_NLD_adm2 "\P" (strcat :NAME_1@Default_NLD_adm2 "\P" (strcat :NAME_2@Default_NLD_adm2)))

The beauty part is there's only 1 grip. I have no idea what "Default_" is, but I just copy/pasted it into that little bitty window. Worked great.
Dave

 

Admin012_1.png

 

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
Message 17 of 21

Koesti
Autodesk Support
Autodesk Support

Hi @evan.8585,

the descriptions  and solutions are detailed and very good.

As always in AutoCAD we have several processes to get the same result and just as an alternative to work with AutoCAD block (symbols) and FDO features.

Annotations from block attributes for FDO features.

The video is not available anymore and if that is helpful I can create it from scratch.

Kind regards

Brigitte

 



Brigitte Koesterke

Technical Support Senior Specialist
Message 18 of 21

Pointdump
Consultant
Consultant

Hi Brigitte,
That link lost me at:


3. Load the DWG with the block definitions into the symbol directory and load the symbol accordingly.
3. Laden Sie die DWG mit den Blockdefinitionen in das Symbolverzeichnis und laden das Symbol entsprechend.


"symbol directory"? Where is that and how do you "load the symbol accordingly"?
I would very much like to see your video re-make.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
Message 19 of 21

Koesti
Autodesk Support
Autodesk Support

Hi Dave,

loading a block as symbol for FDO stylization:

BrigitteKoesterke_0-1653979955423.png

 

BrigitteKoesterke_1-1653980159156.png

 

Please find the new video showing all the steps.

Kind regards

Brigitte



Brigitte Koesterke

Technical Support Senior Specialist
Message 20 of 21

Pointdump
Consultant
Consultant

Hi Brigitte,
Thank you! Good video. And thanks for using English version.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025