使用vlax-3dpoint
您好,我对使用autolisp写作还比较陌生,现在有点问题。我试图编写一个管道程序,在特定点标记管道的内底。由于我对编码相当陌生,我发现在civil 3d对象中使用函数比使用dxf代码更容易。
在我的管道上使用上述activex方法可以为我提供属性“startpoint”。这显然是另一个activex对象,但我无法在其上使用方法列出其x和y坐标(我希望能够在程序中进一步使用)。我假设这是一个3d点,但仍然不知道如何访问单个坐标。有没有专家能帮我解决这个问题? 欢迎来到论坛!
也许使用这两个选项之一可以满足您的需要。。。。
选项1:
(vlax-safearray->list (vlax-variant-value (vla-get-startpoint obj)))
选项2:
(vlax-get obj 'startpoint)
感谢您的回复。这正是我在为管道(3d点列表)使用(vlax get属性“startpoint”)时所期望的结果。然而,出于某种原因,当在管道对象上使用时,它不是返回一个列表(这太棒了,因为我可以使用car/cdr函数),而是返回一个VLA对象名。尝试使用(vlax dump object)访问此对象名称时返回错误。我想以某种方式访问它作为一个列表,但不知道从这里去哪里。这可能只是因为它是一个Civil 3D对象吗?同样,我的代码在2008年运行良好,但显然这个“startpoint”对象不再具有“x”和“y”属性。在管道上使用vlax安全数组代码[(vlax safearray->list(vlax variant value(vla get startpoint Obj))])]返回此错误
[;错误:错误的参数类型:variantp#]但是,它返回了常规autocad圆弧的点列表。我很困惑。以下是我在管道上倾倒垃圾的结果:
Command: (vlax-dump-object obj t)
; IAeccPipe: Pipe interface
; Property values:
; Alignment = nil
; Application (RO) = #<VLA-OBJECT IAeccApplication 18021a90>
; ClosestPointTo (RO) = ...Indexed contents not shown...
; Connectors (RO) = #<VLA-OBJECT IAeccConnectors 18021e50>
; Description = "300 mm Concrete"
; DisplayName (RO) = "Pipe - (265)"
; Document (RO) = #<VLA-OBJECT IAeccDocument 185ec5e0>
; EGLDown = 0.0
; EGLUp = 0.0
; EndPoint (RO) = #<VLA-OBJECT 185ec540>
; EndStructure (RO) = #<VLA-OBJECT IAeccStructure 28b2c440>
; FlowDirection (RO) = 1
; FlowDirectionMethod = 1
; Handle (RO) = "7ACC8"
; HasExtensionDictionary (RO) = 0
; HGLDown = 0.0
; HGLUp = 0.0
; HoldOnResize = 0
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 296c117c>
; InnerDiameterOrWidth (RO) = 0.3
; InnerHeight (RO) = 0.3
; IsMaxCoverViolated (RO) = ...Indexed contents not shown...
; IsMinCoverViolated (RO) = ...Indexed contents not shown...
; Labels (RO) = #<VLA-OBJECT IAeccPipeLabels 18a97600>
; Layer = "N-STM"
; Length2D (RO) = 57.8195
; Length3D (RO) = 57.8918
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; Material = "ByLayer"
; MaximumCover (RO) = 0.0
; MinimumCover (RO) = 0.0
; Name = "Pipe - (265)"
; ObjectID (RO) = 2129999104
; ObjectName (RO) = "AeccDbPipe"
; OuterDiameterOrWidth (RO) = 0.44
; OuterHeight (RO) = 0.44
; OwnerID (RO) = 2129857784
; ParamsBool (RO) = #<VLA-OBJECT 185ec760>
; ParamsDouble (RO) = #<VLA-OBJECT 185ec4c0>
; ParamsLong (RO) = #<VLA-OBJECT 185ec280>
; ParamsString (RO) = #<VLA-OBJECT 185ec020>
; PartDataRecord = #<VLA-OBJECT IAeccPartDataRecord 18025138>
; PartFamily (RO) = #<VLA-OBJECT IAeccPartFamily 182ba398>
; PartSizeName (RO) = "300 mm Concrete Pipe"
; PartType (RO) = 10
; PlotStyleName = "ByLayer"
; PointAtParam (RO) = ...Indexed contents not shown...
; Position (RO) = #<VLA-OBJECT IAeccPoint3d 185ec7e0>
; ProfileNetworkParts (RO) = #<VLA-OBJECT IAeccGraphProfileNetworkParts
;18a94a50>
; Radius (RO) = 0.0
; ShowToolTip = -1
; Slope (RO) = -0.05
; StartPoint (RO) = #<VLA-OBJECT 185ec520>
; StartStructure (RO) = #<VLA-OBJECT IAeccStructure 28b2c640>
; STMPipeMetadata = unsupported result type: 65
; Style = #<VLA-OBJECT IAeccPipeStyle 182ba3e8>
; SubEntityType (RO) = 0
; Surface = nil
; SweptShape (RO) = 2
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 18a97a20>
; Visible = -1
; WallThickness (RO) = 0.07
; Methods supported:
; ArrayPolar (3)
; ArrayRectangular (6)
; ConnectToPipe (3)
; ConnectToStructure (2)
; Copy ()
; Delete ()
; Disconnect (1)
; GetBoundingBox (2)
; GetExtensionDictionary ()
; GetXData (3)
; Highlight (1)
; IntersectWith (2)
; IsReferenceObject ()
; IsReferenceStale ()
; IsReferenceSubObject ()
; IsReferenceValid ()
; Mirror (2)
; Mirror3D (3)
; Move (2)
; Project2dPointVertically (1)
; ResizeByInnerDiaOrWidth (3)
; Rotate (2)
; Rotate3D (3)
; ScaleEntity (2)
; SetStartAndEndPoints (2)
; SetXData (2)
; SwapPartFamilyAndSize (2)
; TransformBy (1)
; Update ()
它说startpoint属性是另一个VLA对象,但我不知道从那里去哪里,因为它不支持对象转储本身。 请将StartPoint对象获取到变量:
(setq StartPointObj
(vla-get-StartPoint
(vlax-ename->vla-object(car(entsel)))))
并向我们展示该对象(而非管道)的属性和方法:
(vlax-dump-object StartPointObj T) 这就是我面临的问题。Autocad不允许我转储起始点。在2008年的民事诉讼中,它似乎运作良好。直到2010年,我才有了这个问题。
你好像不明白我的意思。现在开始点不是属性而是对象。用我的代码选择管道,然后转储StartPointObj变量而不是管道。
或者我不理解你
也许如果你更具体一点。。。当AutoCAD“不允许[您]转储起始点”时,它在推荐行上显示什么?
你加载(vl load com)了吗?
否则,斯米尔诺夫的代码将无法工作。 使用斯米尔诺夫代码
!startpointobj
#<VLA-OBJECT 18c9e848>
这与我使用。。。获取起始点代码
返回以下错误:
Command: (vlax-dump-object starpointobj t)
; error: bad argument type: VLA-OBJECT nil
是的,(vl load com)是lisp中的第一行。谢谢你们的帮助,我完全糊涂了。 对不起,请注意我的拼写错误
这是实际错误:
Command: (vlax-dump-object startpointobj t)
; Object does not support ITypeInfo interface
懂我们必须装聋作哑。首先,尝试从StartPointObj检索ex.OwnerID的一些公共属性
(vlax-get-property StartPointObj 'OwnerID)
如果成功。尝试查找秘密属性,例如:
(vlax-get-property StartPointObj 'Coordinate)
(vlax-get-property StartPointObj 'Coordinates)
(vlax-get-property StartPointObj 'Point)
等
如果不成功。扔了它肮脏的生意,去喝啤酒。。。
页:
[1]
2