【发布时间】:2016-11-16 12:35:08
【问题描述】:
我在 VBA 中有一个 CATIA 宏,它通过坐标(从数组)绘制点。 它适用于我的电脑(Catia V5-R2014 和我的邻居 - 两个版本 V5-R2014 和 R21)。 但它不适用于不同城市的大学(他们有 R21 版本)。 基本上,我的宏从文件中读取输入数据,计算坐标,将它们写入输出文件,然后绘制这些点。 除了最后一个步骤之外的所有步骤都适用于任一计算机/版本。 但在最后一步,“他们的”Catia 没有绘制任何内容,没有任何错误。
所以最后一步的 Subruotine 是:
Sub PlotGeometry()
' Nmlp - number of points
Dim i As Integer
Dim oPartDocument As Document
Dim ohSPointCoord() As HybridShapePointCoord
Dim ohSPoints As HybridShapePointCoord
Dim bodies1 As Bodies
Dim body1 As Body
ReDim ohSPointCoord(0 To Nmlp)
Set oPartDocument = CATIA.Documents.Add("Part")
Set oPart = oPartDocument.Part
Set oPartBody = oPart.MainBody
Set oPlaneYZ = oPart.CreateReferenceFromGeometry(oPart.OriginElements.PlaneYZ)
' -- Draw Points
Dim ohSFactory As HybridShapeFactory
Set ohSFactory = oPart.HybridShapeFactory
For i = 0 To Nmlp
Set ohSPointCoord(i) = ohSFactory.AddNewPointCoord(XM(i), YM(i), ZM(i))
oPartBody.InsertHybridShape ohSPointCoord(i)
Next i
oPart.Update
End Sub
可能是什么?
【问题讨论】: