我在VBA中有一個CATIA宏,它通過座標(從數組中)繪製點。 它適用於我的電腦(Catia V5-R2014和我的neigbours - 兩個版本V5-R2014和R21)。 但它不適用於不同城市的大學(他們的版本爲R21)。 基本上,我的宏從文件讀取輸入數據,計算座標,將它們寫入out-file,然後繪製這些點。 除最後一個步驟之外的所有步驟均可在任一計算機/版本上運行。 但在最後一步「他們的」卡蒂亞只是不繪製任何東西,沒有任何錯誤。用於CATIA的VBA宏在一臺計算機上工作,並且在另一臺計算機上不工作
所以對於最後一步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
什麼可以嗎?
這是正確的。其他辦公室的一位同事表示。我已經重寫了宏,它的工作原理 – user3656916