Copy Model iProperties to Drawing Document via iLogic code

By Chandra shekar Gopal

Question: Is there any Inventor API to enable “Copy Model iProperty Settings” in a Drawing Document as shown in below?

image

Answer: Unfortunately, there is no direct Inventor API to enable “Copy Model iProperties Settings” in Drawing Document. But below iLogic code helps to copy iProperties from Model Document to Drawing Document.

Dim oPropList As ArrayList = New ArrayList()

oPropList.Add("AUTHOR")
oPropList.Add("AUTHORITY")
oPropList.Add("CATEGORY")
oPropList.Add("CHECKED BY")
oPropList.Add("CHECKED DATE")
oPropList.Add("COMMENTS")
oPropList.Add("COMPANY")
oPropList.Add("COST CENTER")
oPropList.Add("CREATION DATE")
oPropList.Add("DESCRIPTION")
oPropList.Add("DESIGN STATE")
oPropList.Add("DESIGNER")
oPropList.Add("ENGR APPROVAL DATE")
oPropList.Add("ENGR APPROVED BY")
oPropList.Add("ENGINEER")
oPropList.Add("ESTIMATED COST")
oPropList.Add("KEYWORDS")
oPropList.Add("MANAGER")
oPropList.Add("MFG APPROVED BY")
oPropList.Add("MFG APPROVED DATE")
oPropList.Add("PART NUMBER")
oPropList.Add("PROJECT")
oPropList.Add("REVISION NUMBER")
oPropList.Add("STATUS")
oPropList.Add("STOCK NUMBER")
oPropList.Add("SUBJECT")
oPropList.Add("TITLE")
oPropList.Add("VENDOR")
oPropList.Add("WEBLINK")

sel_iProperty = InputListBox(
    "CHOOSE iPROPERTY FROM ABOVE LIST",
    oPropList,
    oPropList.Item(0),
    "iPROPERTY SELECTION",
    "LIST OF iPROPERTY"
)

oRefDoc = ThisDrawing.ModelDocument

Dim oPropValue As String

Select Case sel_iProperty

    Case "AUTHOR"
        oPropValue = oRefDoc.PropertySets("Summary Information").Item("Author").Value
        iProperties.Value("Summary", "Author") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "AUTHORITY"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Authority").Value
        iProperties.Value("Project", "Authority") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "CATEGORY"
        oPropValue = oRefDoc.PropertySets("Document Summary Information").Item("Category").Value
        iProperties.Value("Summary", "Category") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "CHECKED BY"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Checked By").Value
        iProperties.Value("Project", "Checked By") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "CHECKED DATE"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Date Checked").Value
        iProperties.Value("Project", "Date Checked") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "COMMENTS"
        oPropValue = oRefDoc.PropertySets("Summary Information").Item("Comments").Value
        iProperties.Value("Summary", "Comments") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "COMPANY"
        oPropValue = oRefDoc.PropertySets("Document Summary Information").Item("Company").Value
        iProperties.Value("Summary", "Company") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "COST CENTER"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Cost Center").Value
        iProperties.Value("Project", "Cost Center") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "CREATION DATE"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Creation Time").Value
        iProperties.Value("Project", "Creation Time") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "DESCRIPTION"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Description").Value
        iProperties.Value("Project", "Description") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "DESIGN STATE"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Design Status").Value
        iProperties.Value("Project", "Design Status") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "DESIGNER"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Designer").Value
        iProperties.Value("Project", "Designer") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "ENGR APPROVAL DATE"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Engr Date Approved").Value
        iProperties.Value("Project", "Engr Date Approved") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "ENGR APPROVED BY"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Engr Approved By").Value
        iProperties.Value("Project", "Engr Approved By") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "ENGINEER"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Engineer").Value
        iProperties.Value("Project", "Engineer") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "ESTIMATED COST"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Cost").Value
        iProperties.Value("Project", "Cost") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "KEYWORDS"
        oPropValue = oRefDoc.PropertySets("Summary Information").Item("Keywords").Value
        iProperties.Value("Summary", "Keywords") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "MANAGER"
        oPropValue = oRefDoc.PropertySets("Document Summary Information").Item("Manager").Value
        iProperties.Value("Summary", "Manager") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "MFG APPROVED BY"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Mfg Approved By").Value
        iProperties.Value("Project", "Mfg Approved By") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "MFG APPROVED DATE"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Mfg Date Approved").Value
        iProperties.Value("Project", "Mfg Date Approved") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "PART NUMBER"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Part Number").Value
        iProperties.Value("Project", "Part Number") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "PROJECT"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Project").Value
        iProperties.Value("Project", "Project") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "REVISION NUMBER"
        oPropValue = oRefDoc.PropertySets("Summary Information").Item("Revision Number").Value
        iProperties.Value("Summary", "Revision Number") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "STATUS"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("User Status").Value
        iProperties.Value("Project", "User Status") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "STOCK NUMBER"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Stock Number").Value
        iProperties.Value("Project", "Stock Number") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "SUBJECT"
        oPropValue = oRefDoc.PropertySets("Summary Information").Item("Subject").Value
        iProperties.Value("Summary", "Subject") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "TITLE"
        oPropValue = oRefDoc.PropertySets("Summary Information").Item("Title").Value
        iProperties.Value("Summary", "Title") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "VENDOR"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Vendor").Value
        iProperties.Value("Project", "Vendor") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

    Case "WEBLINK"
        oPropValue = oRefDoc.PropertySets("Design Tracking Properties").Item("Catalog Web Link").Value
        iProperties.Value("Project", "Catalog Web Link") = oPropValue
        MessageBox.Show(sel_iProperty & " iProperty updated successfully with value : " & oPropValue, "iProperty")

End Select

On running above iLogic code, a Input list box appears for selection of iProperty as shown in below image.

IProperty selection

After selecting iProperty from list and clicking “OK” button, respective value of iProperty from Model document will be copied to Drawing document.

 


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading