Jump to content

Extract line attributes including both handle and global width field


newtocad

Recommended Posts

Hi all,

 

I have done data extraction of my CAD file to excel using AutoCad 2017 (full version), which includes global width, but did not include the handle or any other type of ID to distinguish the lines from one another. Is there any way to get the attributes of lines, specifically global width, in an attribute table that includes the handle to distinguish the lines?

 

If this can be accomplished in other cad software that is free besides Autocad, I'm open to that as well

 

Thanks!

Link to comment
Share on other sites

You can get at just about any property using lisp, including id of object "handle". This is an example

Select object:
; IAcadLine: AutoCAD Line Interface
; Property values:
;   Angle (RO) = 0.0
;   Application (RO) = #<VLA-OBJECT IAcadApplication 000000013fb63f10>
;   Delta (RO) = (197.294 0.0 0.0)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 000000005cb8bd28>
;   EndPoint = (507.617 210.352 0.0)
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "12A8D"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000054647f18>
;   Layer = "DEFAULT"
;   Length (RO) = 197.294
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 62
;   ObjectName (RO) = "AcDbLine"
;   OwnerID (RO) = 61
;   PlotStyleName = "ByLayer"
;   StartPoint = (310.323 210.352 0.0)
;   Thickness = 0.0
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000005465b530>
;   Visible = -1

a sample for you copy the lines 1 at a time to command line

(setq obj (vlax-ename->vla-object (car (entsel "\nPick Line"))))
(alert (strcat "Object id is " (vla-get-handle obj)))

Link to comment
Share on other sites

Thanks for the help!

 

Maybe I'm not understanding the code that well or how to use it exactly in my case. Maybe I wasn't super clear either. What I'm really trying to accomplish is an easy way to take all the lines easily (or just of type polyline works as well) for any CAD file and get them in a text or excel table (with handle and global width being the only fields we need).

 

This would allow us to get the global width for our lines into the GIS software we use (ArcMap), which doesn't include global width in the attribute table when it brings in a CAD file, in case you were curious on the background.

Link to comment
Share on other sites

Are you exporting a SHP file to ARCMAP you may be able to include the line width. I am no expert with regards SHP file export. Bringing in a cad file is different a SHP file can have a heap of extra info attached to an object. A simple example a Contour pline will have the height as an attribute.

 

Murphmap help maybe ?

Link to comment
Share on other sites

It was a CAD file. We take them into arcmap and convert them into other file format's. I found another solution to the problem that works better for us. I found a tool in Lisp that will make an outline of the width with polylines and that works perfectly for us. Now we don't even have to buffer (which is what I had wanted the global width for).

 

Thanks again for all the help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...