How to display queried text sequentially, and change number precision

How to display queried text sequentially, and change number precision

Anonymous
Not applicable
1,971 Views
16 Replies
Message 1 of 17

How to display queried text sequentially, and change number precision

Anonymous
Not applicable

Hi guys!

I have successfully queried in objects and text from a waterline drawing with GIS attributes, such that the drawing will display pipes, and the length, diameter and material on top of the line.  What I'm wondering is; the objects print one after the other; one on top, one in the middle, one on the bottom.  How can I get them to display in a single line of text?  Is there an easy way to do it?

 

One other question please... the length prints out with a precision of 7 digits past the decimal. It doesn't respond to AutoCAD UNITS, so is there a way to change the precision to 2 digits past the decimal?

 

Not complaining, but I'm really surprised by how primitive this dialog box is. Even to change the rotation of the objects, I have to put in a lisp routine (unless you know another way).

 

Thanks for any assistance!!

0 Likes
1,972 Views
16 Replies
Replies (16)
Message 2 of 17

WarrenGeissler
Advisor
Advisor

How are you labeling the objects? Are these FDO objects and labels - or AutoCAD objects with attached Object Data? The response is quite different depending on which system you are using. 


Warren Geissler
Drafting Manager Denver Water
_____________________________________________

Please ACCEPT AS SOLUTON if this works
(...and doesn't melt your computer or cause Armageddon)

0 Likes
Message 3 of 17

Anonymous
Not applicable

Warren,

 

these are AutoCAD objects with attached Object Data.  Thanks for your help!

0 Likes
Message 4 of 17

АлексЮстасу
Advisor
Advisor

Too little about how you create "texts", what is "print"...
But, for example, using ODEDIT, you can collect in the new OD field values from OD fields "length, diameter and material" - the command ODEDIT_ADDVAL (Add from field in field). Replace values, ODEDIT_REPLACE command - you can add separating symbols: replace "*" to "*, " or to others.
And already from this field "display in a single line of text".

The calculation command in ODEDIT has not yet been created, although we are now discussing it ...

What "dialog box" is it about?

To the message you could attach screenshots, report the names of windows and commands - everything would be clearer.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 5 of 17

parkr4st
Advisor
Advisor

Read this:

 

https://map3d.wordpress.com/2013/02/17/plain-text-from-object-data/

 

Murph gets the credit

 

dave

Message 6 of 17

WarrenGeissler
Advisor
Advisor

@parkr4st - That is certainly a good quick way to add a single label to objects with OD - but if you have multiple pieces OD to label as @Anonymous has implied - then I recommend adding a label using the MAPANNTEMPLATE command. It will allow you more flexibility in organizing the label(s) you want.


Warren Geissler
Drafting Manager Denver Water
_____________________________________________

Please ACCEPT AS SOLUTON if this works
(...and doesn't melt your computer or cause Armageddon)

0 Likes
Message 7 of 17

WarrenGeissler
Advisor
Advisor

@Anonymous - For the best control of OD labels use the MAPANNTEMPLATE command. Once in the block editor you need to use the MAPANNTEXT command to add labels. The online HELP says to look for a ribbon panel that does not exist.


Warren Geissler
Drafting Manager Denver Water
_____________________________________________

Please ACCEPT AS SOLUTON if this works
(...and doesn't melt your computer or cause Armageddon)

0 Likes
Message 8 of 17

ChicagoLooper
Mentor
Mentor

I can think of two ways to do this:
1) Using object data (OD is captured using the MAPIMPORT command on a shapefile--where the

Object Data is harvested from the shapefile's attribute data)
2) Keep the shapefile and compose a label, or an expression, from its attribute data using

MAPLABEL2ANN command found in Annotate tab=>Map Annotation panel. (Maplabel2ann is the

official command and IDK why the button's name on the ribbon is 'Label to Text'). 

 

Using #1 you'll be dealing with drawing objects and mtext. Using #2 you'll be in 'map feature'

environment when writing the expression, then once the expression is a feature label, you'll take

the label and convert it to mtext.

 

Using #1.

THE GOOD: Has advantage of working with Cad objects and mtext. Layer management for color, on

& off, line weight, etc through layer properties palette. The shapefile never touches

modelspace, it's only used to import line work and harvest attributes. You can also use OD to

create an 'annotation template' (MAPANNTEMPLATE command) to easily format your single line label.

THE BAD: Insertion of your queried OD text is whacky. If you bring in more than one piece of text, e.g.

length, diameter, material, they are placed on top of one another. Yes, you can control the

text, but from experience I've found the control to be limited when your text is queried

directly from OD. No, I'm not saying there's anything wrong with OD, I'm just saying

it may not be appropriate to use as a source for labels.  Another bad is what you already know:

decimal precision. I can't find a way to control it either. It defaults to the precision in the

shapefile's dbf. Don't forget, a major part of Cad is control using layers, styles,

properties, and in this case, object data. Also, when using MAPANNTEMPLATE, I could edit contents

in the template, but I couldn't control the global precision of the decimals.

 

Using #2.
THE GOOD: You compose the label from the attributes in the shapefile using CONCAT. This

function is where you join two or more pieces of attribute data (the expression builder calls

them properties) and other parameters, i.e. decimal precision, into one line. After the

feature label is formatted, you'll convert the those labels into mtext, where you have

control. Don't forget, this single line mtext line can also be squished narrow and

be two or three lines instead of just one, after all, it's multi-line text.

THE BAD: You'll have to compose the expression and you have to connect to the shapefile using 

FDO in order to do so. Once the features labels have been converted to mtext, you are free to

delete the shapefile from the task pane and disconnect it in FDO, which will just leave you

with the converted mtext. Of course you'll lose your line work but you can still bring it back

in again. The second time though, use MAPIMPORT and bring it in as a Cad object rather than a

map feature. Despite all this, I prefer using #2.

 

You can watch the video >>HERE<< to see how.

 

 

 

Notes:

  1. This demo uses a shapefile and Map 3D.
  2. The demo uses a parcel shapefile but you can apply the principles to other shapefiles as well.
  3. In the Create/Modify Expression builder uses the Text Function CONCAT to create a single line label with multiple properties (attributes). A space was used to separate the 3 attributes, IDPARCEL, Shape_Leng, and Shape_Area. The space was inside single quotes.
  4. To control the number of decimal places,  Math Function ROUND was used to reduce it down to 2-places.
  5. If you want to keep the yellow halo on your labels, you can skip the last part where the labels are converted to mtext. Although you can use a 'mask' on mtext, the halos are only possible as map feature labels e.g. shapefiles and sdf's.
  6. To determine whether your expression has errors, hit 'validate' in bottom left of expression dialog. It won't tell you what the error is, it only tells you where it is.
  7. You may also add 'static' text in the expression, e.g. 'Perimeter=' or 'Sq Ft=' by inserting them next to the spaces which separated the labels making sure the static text is inside the single quotes.
  8. Despite some limitations, map anno template may also be a viable alternative. I was able to control layer, text height, text style, text rotation, and text placement. I was not able to control decimal precision.

Chicagolooper

EESignature

Message 9 of 17

parkr4st
Advisor
Advisor
Presuming the FDO file has the data in columns in the data table perhaps a calculated column putting the data the data together before the mapimport would be another method to get the result. Could you post a couple of records of the data so it can be tried? dave
0 Likes
Message 10 of 17

ChicagoLooper
Mentor
Mentor

Excellent thought, and yeah, I thought about that, applying a formula. And would've worked too. My original thought was not to modify the data itself. (Or append the data.) I merely wanted to changed the way it was displayed, change how the label itself was formatted and keep the original data as-is. 

 

Really sorry, but I can't access the file right now. I know it's from Indiana MAP Layer Gallery, Reference section, Parcels (or something like that). Lake County.gdb.

http://maps.indiana.edu/layerGallery.html?category=Land

 

I exported the shapefile using ArcC Catalog. It's county-wide and huge so I filtered it down to around 50 or so parcels. The area is totally arbitrary.

Chicagolooper

EESignature

0 Likes
Message 11 of 17

O_Eckmann
Mentor
Mentor

Hi ,

 

with OD you can use Lisp expression to concat or controle precision.

Instead of just using  .AREA you can enter :

(strcat "Area = " (rtos .AREA 2 2) "sqm")

for exemple with an area of 125.142458748 you obtain a info like

Area = 125.14 sqm

You are limited to 4 lisp operator  

 

For FDO labelling, you can use '\P' to change line  

 

Olivier

Olivier Eckmann

EESignature

Message 12 of 17

АлексЮстасу
Advisor
Advisor

I understand TomsterK that he needs to change the precision of length in OD values:

OD_length.png
The idea of using Lisp expression seems interesting to me. But I do not understand how to use your Lisp expression. Enter in the command line?

OD_area.png
And Lisp expression can I change the values in OD?

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 13 of 17

O_Eckmann
Mentor
Mentor

Hi @АлексЮстасу

 

Lisp expression can be used when labeling AutoCAD object with OD.

Here is a screencast to explian how to use lisp expression in label.

Such expression can be used when adding a Text Style to queried objects in MAPWORKSPACE.

 

Olivier

Olivier Eckmann

EESignature

Message 14 of 17

Barzdil
Advocate
Advocate

Hello, is it possible to extract for example three different fields values of one OD table, like Olivier shows for one field "INFO" with lisp expression in "message 11" ? I mean, that three values of three different fields would be in one Mapannotation text entity.  Thanks.

0 Likes
Message 15 of 17

АлексЮстасу
Advisor
Advisor

Following the example of Oliver from 11 and 13, I managed to make one annotation for two OD fields.
For example:

(strcat "ID = " :id@OD_TABLE (strcat ", Length = " :length@OD_TABLE "m"))

For the three OD fields failed.
Maybe because of this:

"@O_Eckmann wrote:

You are limited to 4 lisp operator"

 

But I do not know how to program.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 16 of 17

Barzdil
Advocate
Advocate

Hello Alexander, thanks for help and the way You show me. Here I show how my Civil Labels three different fields with this one Mapannotation text entity expression  🙂

(strcat :MATERIAL@GAS_LINES (strcat " d" :DIAM@GAS_LINES (strcat " " :PRESSURE@GAS_LINES)))

 

 

0 Likes
Message 17 of 17

Pointdump
Consultant
Consultant

Olivier,
You rock! Works great!
Dave

Edit: Oops, wrong post. I'll add this to the right one.

 

Precision_2.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
0 Likes