Jump to content

How get "IAcad" objet name.


Kowal

Recommended Posts

This code retrieves object properties.

(defun c:HD (/ ent)
(vl-load-com)
(while
 (setq ent (entsel))
 (vlax-dump-object (vlax-Ename->Vla-Object (car ent)) T)
 ); while
 (princ)
 ); defun

How to get a red string from an dump object?

For the line will be it IAcadLine

Select object: ; [b][color="red"]IAcadLine[/color][/b]: AutoCAD Line Interface
; Property values:
;   Angle (RO) = 0.719545
;   Application (RO) = #<VLA-OBJECT IAcadApplication 000000013ffbc910>
;   Delta (RO) = (209.938 183.961 0.0)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0000000027cc0bc8>
;   EndPoint = (7714.05 4745.47 0.0)
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "6533"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000040a107c8>
;   Layer = "0"
;   Length (RO) = 279.133
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 54
;   ObjectID32 (RO) = 54
;   ObjectName (RO) = "AcDbLine"
;   OwnerID (RO) = 50
;   OwnerID32 (RO) = 50
;   PlotStyleName = "ByLayer"
;   StartPoint = (7504.11 4561.51 0.0)
;   Thickness = 0.0
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000000034cd2eb0>
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Offset (1)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Up

Link to comment
Share on other sites

The problem is that there are two different objects at Civil3D in the same name.

These objects are "TIN surface" and "TIN volume surface".

Commandobill Thanks for the reply.

Using

(entget(car(entsel)))

at "TIN surface" returns:

(-1 . <Entity name: 7ffffb2d720>)
(0 . "AECC_TIN_SURFACE")
(330 . <Entity name: 7ffffb039f0>)
(5 . "63B2")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "C-TOPO")
(100 . "AeccDbEntity")
(100 . "AeccDbGeo_aec")
(100 . "AeccDbGeo")
(100 . "AeccDbSurface")
(100 . "AeccDbSurfaceTin")

 

at "TIN volume surface" returns:

 

(-1 . <Entity name: 7ffffb2e9a0>)
(0 . "AECC_TIN_SURFACE")
(330 . <Entity name: 7ffffb039f0>)
(5 . "64CA")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "C-TOPO")
(100 . "AeccDbEntity")
(100 . "AeccDbGeo_aec")
(100 . "AeccDbGeo")
(100 . "AeccDbSurface")
(100 . "AeccDbSurfaceTin")

Link to comment
Share on other sites

If we use

vlax-dump-object

 

at "TIN surface" returns:

Select object: ; [b][color="red"]IAeccTinSurface[/color][/b]: IAeccTinSurface interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 00000000276536a0>
;   Boundaries (RO) = #<VLA-OBJECT IAeccSurfaceBoundaries 0000000034ffa1d8>
;   Breaklines (RO) = #<VLA-OBJECT IAeccSurfaceBreaklines 0000000034ff7d98>
;   ContourLabelGroups (RO) = #<VLA-OBJECT IAeccSurfaceContourLabelGroups 0000000034ff7cf0>
;   Contours (RO) = #<VLA-OBJECT IAeccSurfaceContours 0000000034ff7f28>
;   DefinitionProperties (RO) = #<VLA-OBJECT IAeccTinSurfaceDefinitionProperties 000000002f4fe2d0>
;   DEMFiles (RO) = #<VLA-OBJECT IAeccSurfaceDEMFiles 0000000034ffa138>
;   Description = "Description"
;   DisplayName (RO) = "Pow 3"
;   Document (RO) = #<VLA-OBJECT IAeccDocument 000000002f4fe5d0>
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "63B2"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 00000000354be838>
;   Labels (RO) = #<VLA-OBJECT IAeccSurfaceLabels 0000000034ff8240>
;   Layer = "C-TOPO"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Name = "Pow 3"
;   ObjectID (RO) = 42
;   ObjectID32 (RO) = 42
;   ObjectName (RO) = "AeccDbSurfaceTin"
;   OutputTriangles (RO) = (7065.31 4326.0 53.0 7388.54 4507.73 53.0 ... )
;   OwnerID (RO) = 43
;   OwnerID32 (RO) = 43
;   PlotStyleName = "ByLayer"
;   PointFiles (RO) = #<VLA-OBJECT IAeccSurfacePointFiles 0000000034ff7e88>
;   PointGroups (RO) = #<VLA-OBJECT IAeccSurfacePointGroups 0000000034ff8518>
;   Points (RO) = (7100.66 4689.45 53.0 7388.54 4507.73 53.0 ... )
;   ShowToolTip = -1
;   Statistics (RO) = #<VLA-OBJECT IAeccTinSurfaceStatistics 000000002f4ff0e0>
;   Style = #<VLA-OBJECT IAeccSurfaceStyle 00000000349bc490>
;   StyleName (RO) = "Contours 2m and 10m (Background)"
;   SurfaceAnalysis (RO) = #<VLA-OBJECT IAeccSurfaceAnalysis 000000002f4fe3f0>
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 00000000354be110>
;   Type (RO) = 2
;   Visible = -1
; Methods supported:
;   AddPointMultiple (1)
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   CreateSnapshot ()
;   Delete ()
;   ExtractBorder (1)
;   ExtractContour (4)
;   FindElevationAtXY (2)
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectPointWithSurface (2)
;   IntersectWith (2)
;   IsReferenceObject ()
;   IsReferenceStale ()
;   IsReferenceSubObject ()
;   IsReferenceValid ()
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   PasteSurface (1)
;   Rebuild ()
;   RebuildSnapshot ()
;   RemoveSnapshot ()
;   Rotate (2)
;   R

 

at "TIN volume surface" returns:

 

Select object: ; [b][color="red"]IAeccTinVolumeSurface[/color][/b]: IAeccTinVolumeSurface interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 000000002f4fc6e0>
;   Boundaries (RO) = #<VLA-OBJECT IAeccSurfaceBoundaries 0000000034ff7348>
;   ContourLabelGroups (RO) = #<VLA-OBJECT IAeccSurfaceContourLabelGroups 0000000034ff77a0>
;   DefinitionProperties (RO) = #<VLA-OBJECT IAeccTinVolumeSurfaceDefinitionProperties 000000002f4fbcc0>
;   Description = "Description"
;   DisplayName (RO) = "obj"
;   Document (RO) = #<VLA-OBJECT IAeccDocument 000000002f4fe7e0>
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "64CA"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 00000000354bd938>
;   Labels (RO) = #<VLA-OBJECT IAeccSurfaceLabels 0000000034ff7110>
;   Layer = "C-TOPO"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Name = "obj"
;   ObjectID (RO) = 44
;   ObjectID32 (RO) = 44
;   ObjectName (RO) = "AeccDbSurfaceTin"
;   OutputTriangles (RO) = (7226.48 4416.62 53.0 7258.15 4434.42 53.0 ... )
;   OwnerID (RO) = 43
;   OwnerID32 (RO) = 43
;   PlotStyleName = "ByLayer"
;   Points (RO) = (7189.89 4614.61 53.0 7096.21 4643.67 53.0 ... )
;   ShowToolTip = -1
;   Statistics (RO) = #<VLA-OBJECT IAeccTinVolumeSurfaceStatistics 000000002f4fef00>
;   Style = #<VLA-OBJECT IAeccSurfaceStyle 00000000349ba900>
;   StyleName (RO) = "Contours and Triangles"
;   SurfaceAnalysis (RO) = #<VLA-OBJECT IAeccSurfaceAnalysis 000000002f4fe420>
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 00000000354bd990>
;   Type (RO) = 4
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   CreateSnapshot ()
;   Delete ()
;   ExtractBorder (1)
;   ExtractContour (4)
;   FindElevationAtXY (2)
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectPointWithSurface (2)
;   IntersectWith (2)
;   IsReferenceObject ()
;   IsReferenceStale ()
;   IsReferenceSubObject ()
;   IsReferenceValid ()
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rebuild ()
;   RebuildSnapshot ()
;   RemoveSnapshot ()
;   Rotate (2)
;   Rotate3D (3)
;   Sa

 

Red color means different object names.

An idea to distinguish these objects?

Link to comment
Share on other sites

I see several properties that are available for only one of the two object types. So perhaps using vlax-property-available-p can work?

Link to comment
Share on other sites

I see several properties that are available for only one of the two object types. So perhaps using vlax-property-available-p can work?

 

My thoughts aswell...

 

(defun foo ( o / r )
 (cond 
   ( (not (eq 'VLA-OBJECT o)) )
   ( (not (and (vlax-property-available-p o 'ObjectName) (eq (vla-get-ObjectName o) "AeccDbSurfaceTin"))) )
   ( 
     (setq r
       (if (vl-every '(lambda (x) (vlax-property-available-p o x)) '(Breaklines Contours DEMFiles PointFiles))
         "IAeccTinSurface"
         "IAeccTinVolumeSurface"
       )    
     )
   )
 )
 r
)

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...