【发布时间】:2018-09-25 00:31:02
【问题描述】:
我正在尝试通过 CADSelection 更改装配体中选定 CATPart 的用户选择参数。最终这将进入 VBA 中的 GUI,用户将选择 CATPart,打开宏并通过 GUI 更改他需要的任何参数。 我已经录制了宏并对此进行了一段时间的调整,但我似乎无法完成。
我的树是:
产品;
-部分;
-Part_Teste_2;
-Part_Teste_3;
-Part_Teste_4;
-Part_Teste_5;
以上所有“Part_Teste”都有3个参数,其中一个称为“Comprimento”
如何更改以确保宏更改所选 CATPArt 的参数而不是 ("Part_Teste_3.CATPart")?
我目前的宏是:
Language="VBSCRIPT"
Sub CATMain()
Set oProductDoc = CATIA.ActiveDocument
Set oProd = oProductDoc.Product
Set oDocs = CATIA.Documents
Set oSelection = CATIA.ActiveDocument.Selection
If oSelection.Count < 1 then
MsgBox "Pick some components using cad selection.","No components were selected"
Else
Set oPartDoc = oDocs.Item("Part_Teste_3.CATPart")
Set oPart = oPartDoc.Part
Set oParam = oPart.Parameters
Set oLength = oParam.Item("Comprimento")
oLength.Value = 50.000000
End If
oSelection.Clear
oProd.Update
End Sub
【问题讨论】: