提问人:Yunus Mert AŞKIN 提问时间:10/28/2023 最后编辑:Yunus Mert AŞKIN 更新时间:10/28/2023 访问量:223
对于 CATIA,从带点的草图创建轴
For CATIA, Creating axis from sketch with points
问:
我创建并编写了一个代码,用于从点放置一些轴。我的代码在 CATIA R19 和 R20 中完美运行。但在 R30 不起作用。任何人都可以检查我的 R30 版本代码,或者我应该在代码中做什么或更改?
Language="VBSCRIPT"
Sub CATMain()
Dim arrVariant(2)
Dim dialogResult
dialogResult = InputBox("How many axis you needed?")
If (IsNumeric(dialogResult)) Then
nSys = CInt(dialogResult)
Else
MsgBox "Insert only numbers!"
Exit Sub
End If
Set prtDoc = CATIA.ActiveDocument
Set prt = CATIA.ActiveDocument.Part
Set params = prt.Parameters
For cnt = 1 To nSys
Set aSys = prt.AxisSystems.Add()
aSys.OriginType = catAxisSystemOriginByPoint
Set hsPoint = params.Item("Sketch." & cnt)
Set ref = prt.CreateReferenceFromObject(hsPoint)
aSys.OriginPoint = ref
aSys.XAxisType = catAxisSystemAxisByCoordinates
arrVariant(0) = 1.0
arrVariant(1) = 0.0
arrVariant(2) = 0.0
Set aSysVariant = aSys
aSysVariant.PutXAxis arrVariant
aSys.YAxisType = catAxisSystemAxisByCoordinates
arrVariant(0) = 0.0
arrVariant(1) = 1.0
arrVariant(2) = 0.0
Set aSysVariant = aSys
aSysVariant.PutYAxis arrVariant
aSys.ZAxisType = catAxisSystemAxisByCoordinates
arrVariant(0) = 0.0
arrVariant(1) = 0.0
arrVariant(2) = 1.0
Set aSysVariant = aSys
aSysVariant.PutZAxis arrVariant
prt.UpdateObject aSys
aSys.IsCurrent = False
prt.Update
Next
End Sub
我在 r30 上尝试了此代码,但不起作用。它只是从本节中给出错误
Set hsPoint = params.Item("Sketch." & cnt)
答: 暂无答案
评论