Hi
I write a small code to add properties in a prodcut:
but when I run it, it shows a time-run error at "Set parameters1 = prdDoc1.UserRefProperties "
any idea to solve it ?
thx
Sub CATMain()
Dim productDocument1 As Document
Dim product1 As Product
Dim products1 As Products
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products
partcount = product1.Products.Count
MsgBox (partcount)
Dim i As Integer
For i = 1 To partcount
products1.Item(i).ApplyWorkMode DESIGN_MODE
Dim prdDoc1 As Product
Set prdDoc1 = products1.Item(i)
Dim parameters1 As Parameters
Set parameters1 = prdDoc1.UserRefProperties 'shows a "run time error:automation error and unspecified error"
Dim strparam1 As strparam
Set strparam1 = parameters1.CreateString("string1", "")
strparam1.ValuateFromString ""
prdDoc1.Update
Next i
End Sub
Sub CATMain()
Dim productDocument1 As Document
Dim product1 As Product
Dim products1 As Products
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products
partcount = product1.Products.Count
MsgBox (partcount)
Dim i As Integer
For i = 1 To partcount
products1.Item(i).ApplyWorkMode DESIGN_MODE
Dim prdDoc1 As Product
Set prdDoc1 = products1.Item(i)
Dim parameters1 As Parameters
Set parameters1 = prdDoc1.UserRefProperties
Dim strparam1 As strparam
Set strparam1 = parameters1.CreateString("string1", "")
strparam1.ValuateFromString ""
prdDoc1.Update
Next i
End Sub
Sub CATMain()
Dim productDocument1 As Document
Dim product1 As Product
Dim products1 As Products
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products
partcount = product1.Products.Count
MsgBox (partcount)
Dim i As Integer
For i = 1 To partcount
products1.Item(i).ApplyWorkMode DESIGN_MODE
Dim prdDoc1 As Product
Set prdDoc1 = products1.Item(i)
Dim parameters1 As Parameters
Set parameters1 = prdDoc1.UserRefProperties
Dim strparam1 As strparam
Set strparam1 = parameters1.CreateString("string1", "")
strparam1.ValuateFromString ""
prdDoc1.Update
Next i
End Sub
I write a small code to add properties in a prodcut:
but when I run it, it shows a time-run error at "Set parameters1 = prdDoc1.UserRefProperties "
any idea to solve it ?
thx
Sub CATMain()
Dim productDocument1 As Document
Dim product1 As Product
Dim products1 As Products
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products
partcount = product1.Products.Count
MsgBox (partcount)
Dim i As Integer
For i = 1 To partcount
products1.Item(i).ApplyWorkMode DESIGN_MODE
Dim prdDoc1 As Product
Set prdDoc1 = products1.Item(i)
Dim parameters1 As Parameters
Set parameters1 = prdDoc1.UserRefProperties 'shows a "run time error:automation error and unspecified error"
Dim strparam1 As strparam
Set strparam1 = parameters1.CreateString("string1", "")
strparam1.ValuateFromString ""
prdDoc1.Update
Next i
End Sub
Sub CATMain()
Dim productDocument1 As Document
Dim product1 As Product
Dim products1 As Products
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products
partcount = product1.Products.Count
MsgBox (partcount)
Dim i As Integer
For i = 1 To partcount
products1.Item(i).ApplyWorkMode DESIGN_MODE
Dim prdDoc1 As Product
Set prdDoc1 = products1.Item(i)
Dim parameters1 As Parameters
Set parameters1 = prdDoc1.UserRefProperties
Dim strparam1 As strparam
Set strparam1 = parameters1.CreateString("string1", "")
strparam1.ValuateFromString ""
prdDoc1.Update
Next i
End Sub
Sub CATMain()
Dim productDocument1 As Document
Dim product1 As Product
Dim products1 As Products
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products
partcount = product1.Products.Count
MsgBox (partcount)
Dim i As Integer
For i = 1 To partcount
products1.Item(i).ApplyWorkMode DESIGN_MODE
Dim prdDoc1 As Product
Set prdDoc1 = products1.Item(i)
Dim parameters1 As Parameters
Set parameters1 = prdDoc1.UserRefProperties
Dim strparam1 As strparam
Set strparam1 = parameters1.CreateString("string1", "")
strparam1.ValuateFromString ""
prdDoc1.Update
Next i
End Sub