TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MSTG007 on July 18, 2016, 10:04:28 AM

Title: Extracting Object Data from Line to Text
Post by: MSTG007 on July 18, 2016, 10:04:28 AM
I have this object I have imported from a shape file. Is there a way I can get the "FULLNAME" field data to a Mtext? It would be nice if I could run the command, pick the entity and pops up a text above where I picked... Thanks for any input.
Title: Re: Extracting Object Data from Line to Text
Post by: ChrisCarlson on July 18, 2016, 10:44:28 AM
Since I don't have the drawing, are there any options under Insert Field?
Title: Re: Extracting Object Data from Line to Text
Post by: Rod on July 19, 2016, 02:51:07 AM
Cant remember the function name of the top of my head but it is in the acmaplisp.chm.

For more info see https://knowledge.autodesk.com/support/autocad-map-3d/troubleshooting/caas/sfdcarticles/sfdcarticles/Where-to-get-the-AutoCAD-Map-AutoLISP-Reference.html (https://knowledge.autodesk.com/support/autocad-map-3d/troubleshooting/caas/sfdcarticles/sfdcarticles/Where-to-get-the-AutoCAD-Map-AutoLISP-Reference.html)
Then download it http://download.autodesk.com/us/support/files/autocad_map_3d_2012_api_references.zip?_ga=1.150050422.1351386203.1409529097 (http://download.autodesk.com/us/support/files/autocad_map_3d_2012_api_references.zip?_ga=1.150050422.1351386203.1409529097)

Cheers, Rod.
Title: Re: Extracting Object Data from Line to Text
Post by: Rod on July 19, 2016, 02:55:02 AM
The function is ade_odgetfield

from the help
(ade_odgetfield ename table field recnum)

Returns a field value (data type varies) or nil.

ename AutoCAD object name.
table Table name (string) can be up to 25 characters long. Must be unique, contain no spaces, and start with an alphanumeric character
field Field name (string) can be up to 31 characters long. Must be unique, contain no spaces, and start with an alphanumeric character
recnum Record number (integer). The number of the first record is 0

To identify a unique record, you need to specify the table to which it belongs, the object to which it is attached, and its record number. The record number is necessary because more than one record from the same table can be attached to an object. For more information about records and record numbers, see ade_odaddrecord.

The field value returned can be one of four data types: integer, character, point, or real.
Title: Re: Extracting Object Data from Line to Text
Post by: MSTG007 on July 19, 2016, 07:11:33 AM
I will look into that alittle more. Hopefully I can figure this thing out.

BTW, Please see the attached DWG for an example.

Thanks again!
Title: Re: Extracting Object Data from Line to Text
Post by: alanjt on July 19, 2016, 10:55:27 AM
https://www.theswamp.org/index.php?topic=51666.msg567519#msg567519