CATIA 中的子级零件出版物
Sublevel part publications in CATIA
我正在做一个项目,我一直在取得进展,运行遇到了一个我需要帮助的问题。我正在尝试为各个级别的零件发布用户定义的属性。我能够定位该区域,但每次我尝试创建参考时都会失败。此外,CATIA 表示这些元素不可发布。当一个部分处于顶层时我可以发布,有什么变化?
下面是我的目标代码,应该发布。
Sub Sublevel_Part_Publication()
'This is a work in progress sub
For i = 1 To CATIA.Documents.Count
'MsgBox i
If CATIA.Documents.Item(i).Name = CATIA.ActiveDocument.Selection.Item(1).LeafProduct.ReferenceProduct.Name & ".CATPart" Then
Set Active_Name_Input = CATIA.Documents.Item(i).GetItem(1)
End If
Next
Dim product1
Set product1 = Active_Name_Input
Dim PARAMS As Parameters
Set PARAMS = product1.Parameters
Dim RELATIONS As RELATIONS
Set RELATIONS = product1.RELATIONS
Dim PUBS As Publications
Set PUBS = product1.Publications
Set PARAM_MANUF = PARAMS.CreateString("MANUFACTURER/SOURCE", "")
'----- CREATE RELATIONS (FORMULAS) -----
Set FORMULA_MANUF = RELATIONS.CreateFormula("MANUF", "", PARAM_MANUF, "`Properties\MANUFACTURER/SOURCE` ") '"`" & Active_Name_Input.Name & "\Properties\MANUFACTURER/SOURCE` "
'----- CREATE PUBLICATIONS -----
Set REF_MANUF = product1.CreateReferenceFromName("MANUFACTURER/SOURCE")
Set PUB_MANUF = PUBS.Add("MANUFACTURER/SOURCE")
PUBS.SetDirect "MANUFACTURER/SOURCE", REF_MANUF
End Sub
我试图为出版物做直接路线,但一直失败。执行参数和公式是一种可行的解决方法。
我通过将代码分解到不同的级别来解决这个问题。似乎设置关系和发布与参数处于不同级别。
For i = 1 To CATIA_Input.Count
'MsgBox i
If CATIA.Documents.Item(i).Name = CATIA.ActiveDocument.Selection.Item(1).LeafProduct.ReferenceProduct.Name & ".CATPart" Then
Set Active_Name_Input = CATIA.Documents.Item(i)
End If
Next
Dim product1
Set product1 = Active_Name_Input.GetItem(1)
Dim part1
Set part1 = Active_Name_Input.part
我正在做一个项目,我一直在取得进展,运行遇到了一个我需要帮助的问题。我正在尝试为各个级别的零件发布用户定义的属性。我能够定位该区域,但每次我尝试创建参考时都会失败。此外,CATIA 表示这些元素不可发布。当一个部分处于顶层时我可以发布,有什么变化?
下面是我的目标代码,应该发布。
Sub Sublevel_Part_Publication()
'This is a work in progress sub
For i = 1 To CATIA.Documents.Count
'MsgBox i
If CATIA.Documents.Item(i).Name = CATIA.ActiveDocument.Selection.Item(1).LeafProduct.ReferenceProduct.Name & ".CATPart" Then
Set Active_Name_Input = CATIA.Documents.Item(i).GetItem(1)
End If
Next
Dim product1
Set product1 = Active_Name_Input
Dim PARAMS As Parameters
Set PARAMS = product1.Parameters
Dim RELATIONS As RELATIONS
Set RELATIONS = product1.RELATIONS
Dim PUBS As Publications
Set PUBS = product1.Publications
Set PARAM_MANUF = PARAMS.CreateString("MANUFACTURER/SOURCE", "")
'----- CREATE RELATIONS (FORMULAS) -----
Set FORMULA_MANUF = RELATIONS.CreateFormula("MANUF", "", PARAM_MANUF, "`Properties\MANUFACTURER/SOURCE` ") '"`" & Active_Name_Input.Name & "\Properties\MANUFACTURER/SOURCE` "
'----- CREATE PUBLICATIONS -----
Set REF_MANUF = product1.CreateReferenceFromName("MANUFACTURER/SOURCE")
Set PUB_MANUF = PUBS.Add("MANUFACTURER/SOURCE")
PUBS.SetDirect "MANUFACTURER/SOURCE", REF_MANUF
End Sub
我试图为出版物做直接路线,但一直失败。执行参数和公式是一种可行的解决方法。
我通过将代码分解到不同的级别来解决这个问题。似乎设置关系和发布与参数处于不同级别。
For i = 1 To CATIA_Input.Count
'MsgBox i
If CATIA.Documents.Item(i).Name = CATIA.ActiveDocument.Selection.Item(1).LeafProduct.ReferenceProduct.Name & ".CATPart" Then
Set Active_Name_Input = CATIA.Documents.Item(i)
End If
Next
Dim product1
Set product1 = Active_Name_Input.GetItem(1)
Dim part1
Set part1 = Active_Name_Input.part