◆ 二次开发(MicroStation编程, ProjectWise编程等) - VBA 使用CopyElement为什么会进行绘制?
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

VBA 使用CopyElement为什么会进行绘制?

by
明海 柴
Explorer

Sub CopyTest()
    Dim Spoint(2) As Point3d
    Spoint(0) = Point3dZero
    Spoint(1) = Point3dFromXYZ(0, 10, 0)
    Spoint(2) = Point3dFromXYZ(-5, 0, 0)
    Dim S1 As ShapeElement
    Dim S2 As ShapeElement
    Set S1 = Application.CreateShapeElement1(Nothing, Spoint)
    Set S2 = ActiveModelReference.CopyElement(S1)
End Sub

想实现复制功能,没有添加绘制命令,使用.CopyElement会将原图形绘制出来,是什么原因,如何避免?


Accepted Solution

CopyElement就是复制元素后添加到模型中的,从MSV8XM(即8.9)开始,只要添加到模型中的元素就会被立刻绘制出来。

所以,如果仅想复制而不添加,可调用Clone方法。