如何获得“IAcad”对象名称。
这段代码检索对象属性。(defun c:HD (/ ent)
(vl-load-com)
(while
(setq ent (entsel))
(vlax-dump-object (vlax-Ename->Vla-Object (car ent)) T)
); while
(princ)
); defun
如何从转储对象中获取红色字符串?
因为这条线是IAcadLine
Select object: ; IAcadLine: 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 你想知道它是什么类型的物体吗? 使用此代码获取对象的DXF代码。
(Entget(car(entsel))) 问题是Civil3D中有两个同名的不同对象。
这些对象是“三角网曲面”和“三角网体积曲面”。
Commandobill感谢您的回复。
使用
(entget(car(entsel)))
在“锡表面”返回:
(-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")
在“锡体积表面”返回:
(-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") 如果我们使用
vlax-dump-object
在“锡表面”返回:
Select object: ; IAeccTinSurface: 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
在“锡体积表面”返回:
Select object: ; IAeccTinVolumeSurface: 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
红色表示不同的对象名称。
区分这些物体的想法? 我看到几个属性仅适用于两种对象类型中的一种。那么,也许使用vlax-property-available-p可以工作? 文章中的所有示例都可以通过ObjectName(RO)=“AcDbLine”来识别
(vla-get-objectname obj)
我的想法也是。。。
(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
)
页:
[1]