Hello all,
I am trying to make a macro for link between parameter created in Product to parameter in Drawing...
So far I have this:
Can someone help?
I am trying to make a macro for link between parameter created in Product to parameter in Drawing...
So far I have this:
Code:
'Publish Name
Dim oPubName As String
oPubName = "NAME"
Dim oProduct As ProductStructureTypeLib.Product
Set oProduct = CATIA.ActiveDocument.Product
Dim oReference4 As INFITF.Reference
Set oReference4 = oProduct.CreateReferenceFromName(oProduct.Name + "\" + oPubName)
Dim oPublications As ProductStructureTypeLib.Publications
Set oPublications = oProduct.Publications
Dim oPublication As ProductStructureTypeLib.Publication
Set oPublication = oPublications.Add(oPubName)
oPublications.SetDirect oPubName, oReference4
'Add Properties (N-File)
Dim oUserPropsN As KnowledgewareTypeLib.Parameters
Set oUserPropsN = oNProduct.ReferenceProduct.UserRefProperties
oUserPropsN.CreateString "Part_No", sPartNumber
oUserPropsN.CreateString "Mod_Level", sModLevel
oUserPropsN.CreateString "Dataset", sDesc
oUserPropsN.CreateString "ItemRevName", sNRevName
'Create D-File
Set oDFile = oDocuments.NewFrom("mydrawing.CATDrawing")
Set oDWindow = CATIA.ActiveWindow
'Add DNDE Properties (D-File)
Dim oUserPropsD As KnowledgewareTypeLib.Parameters
Set oUserPropsD = oDFile.Parameters
Dim oUserNameD As KnowledgewareTypeLib.Parameters
Set oUserNameD = oDFile.Parameters
Dim oReference5 As INFITF.Reference
Set oReference5 = oDFile.CreateReferenceFromName(oProduct.Name + "\" + oPubName)
oUserNameD.CreateString "Name_linked", oReference5
Can someone help?