Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LISP TO get surface elevation label coordinates and elevation?

4 REPLIES 4
Reply
Message 1 of 5
DAVIDFAN
275 Views, 4 Replies

LISP TO get surface elevation label coordinates and elevation?

I'm trying to convert all surface elevation labels to customized blocks all at once. I spent several hours to figure out how to get the label coordinates where to insert the block, but failed. Below is beginning of my lisp:

 

(defun c:gaet3 (/ ELEV SS LBL PT)

        (setq All_lbls (ssget "x" (list (cons 0 "AECC_SURFACE_ELEVATION_LABEL")))
        len (sslength All_lbls)
        ctr 0)
        (while (< ctr len)

                  (setq lblobj (ssname All_lbls ctr))

 

Then what to do? I tried (entget lblobj), but no coordinates and elevation information shown in the result.

 

 

4 REPLIES 4
Message 2 of 5
BlackBox_
in reply to: DAVIDFAN

FeatureLabel.LabelLocation has not been exposed to LISP API; for that you're going to have to use .NET API to do what you're after, or use .NET API to at least expose a custom LispFunction Method to make it so you can do what you're after in LISP.

 

Simplest path without using .NET API, is to simply export your Civil drawing and replace the blocks in the resultant drawing (produced from Labels) with your desired blocks, then do with those what you need.

 

HTH



"How we think determines what we do, and what we do determines what we get."

Message 3 of 5
Jeff_M
in reply to: DAVIDFAN

Edit: Too slow....

You will need to use a .NET solution, as the location property is not exposed in the COM API:

; Property values:
; Application (RO) = #<VLA-OBJECT IAeccApplication 0000022b1c108370>
; Description = Civil 3D API: The parameter is incorrect.
; DisplayName (RO) = Civil 3D API: The parameter is incorrect.
; Document (RO) = #<VLA-OBJECT IAeccDocument 0000022b1c108250>
; EntityTransparency = "ByLayer"
; Flipped = 0
; Handle (RO) = "2146A"
; HasExtensionDictionary (RO) = 0
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000022afa870618>
; LabelStyle = #<VLA-OBJECT IAeccLabelStyle 0000022af6e8a740>
; Layer = "C-TOPO-TEXT-FG"
; LeaderAttachmentOption = 0
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; MarkerStyle = #<VLA-OBJECT IAeccMarkerStyle 0000022af6cac350>
; Material = "ByLayer"
; Name = Civil 3D API: The parameter is incorrect.
; ObjectID (RO) = 42
; ObjectName (RO) = "AeccDbSurfaceElevLabel"
; OwnerID (RO) = 43
; Pinned = 0
; PlotStyleName = "ByLayer"
; Reversed = 0
; ShowToolTip = Civil 3D API: The parameter is incorrect.
; Surface (RO) = #<VLA-OBJECT IAeccTinSurface 0000022af7bd9140>
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000022afa870010>
; Type (RO) = 9
; Visible = -1
; Methods supported:
; ArrayPolar (3)
; ArrayRectangular (6)
; Copy ()
; Delete ()
; GetBoundingBox (2)
; GetExtensionDictionary ()
; GetXData (3)
; Highlight (1)
; IntersectWith (2)
; IsReferenceObject ()
; IsReferenceStale ()
; IsReferenceSubObject ()
; IsReferenceValid ()
; Mirror (2)
; Mirror3D (3)
; Move (2)
; Rotate (2)
; Rotate3D (3)
; ScaleEntity (2)
; SetXData (2)
; TransformBy (1)
; Update ()

Jeff_M, also a frequent Swamper
EESignature
Message 4 of 5
DAVIDFAN
in reply to: BlackBox_

Thanks, I need to put elevation information into the block attributes.
What's interesting is the following code works:

(setq SS (ssget ":S:E" '((0 . "AECC_SURFACE_ELEVATION_LABEL"))))
(setq pt (osnap (cadar(cdddar (ssnamex ss 0))) "_ins"))

However, it only can work with one label, not multiple labels at once.
Message 5 of 5
hosneyalaa
in reply to: DAVIDFAN

Hi

 If you don't want to use .NET API

as an idea

 Can you detonate a surface elevation label And treat it like a block

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report