Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link between product parameter and drawing parameter macro

Status
Not open for further replies.

VojtaR

Automotive
Apr 2, 2020
20
CZ
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:
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?
 
Replies continue below

Recommended for you

Not possible with VB, nor with Knowledgeware.
Creation of external parameters is not exposed to Automation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top