Material Library and changing appearances

Material Library and changing appearances

NachoShaw
Advisor Advisor
448 Views
4 Replies
Message 1 of 5

Material Library and changing appearances

NachoShaw
Advisor
Advisor
Hi

I use a material library and a separate appearance library. First, can I just use 1 file that has both material and appearance or is it best to have separate files?

Is there a handy code solution that can list all of the materials from my library (NachoMatLib) so that I can put it in a listbox?


Thanks

Nacho

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
449 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor
        ListView1.Items.Clear()

        Dim oapp As Inventor.Application
        oapp = _InvApp
        Dim oCurrentDoc As Document

        Dim oItem As ListViewItem ' ListItem

        Dim IM As Integer
        Dim IMMAX As Integer
        IMMAX = oapp.ActiveDocument.Materials.Count
        For IM = 1 To IMMAX


            oCurrentDoc = oapp.ActiveDocument

            Dim oDrawDoc As Document
            oDrawDoc = oapp.ActiveDocument

            'get the "Design Tracking Properties"
            Dim odrawInvDsgnTrcPrpPropSet As PropertySet
            odrawInvDsgnTrcPrpPropSet = oDrawDoc.PropertySets.Item("Design Tracking Properties")


            Dim odrawInvDsgnTrcPrpVolumePropset As [Property]
            odrawInvDsgnTrcPrpVolumePropset = odrawInvDsgnTrcPrpPropSet.Item(39)


            oItem = ListView1.Items.Add(oapp.ActiveDocument.Materials.Item(IM).Name)

        Next

or better you use a combobox:

 

 ListView1.Items.Clear()
        ComboBox1.Items.Clear()
        Dim oapp As Inventor.Application
        oapp = _InvApp
        Dim oCurrentDoc As Document

        Dim IM As Integer
        Dim IMMAX As Integer
        IMMAX = oapp.ActiveDocument.Materials.Count
        For IM = 1 To IMMAX

            'Set oApp = ThisApplication
            oCurrentDoc = oapp.ActiveDocument

            Dim oDrawDoc As Document
            oDrawDoc = oapp.ActiveDocument

            'get the "Design Tracking Properties"
            Dim odrawInvDsgnTrcPrpPropSet As PropertySet
            odrawInvDsgnTrcPrpPropSet = oDrawDoc.PropertySets.Item("Design Tracking Properties")


            Dim odrawInvDsgnTrcPrpVolumePropset As [Property]
            odrawInvDsgnTrcPrpVolumePropset = odrawInvDsgnTrcPrpPropSet.Item(39)


            ComboBox1.Items.Add(oapp.ActiveDocument.Materials.Item(IM).Name.ToString)
        Next

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 5

NachoShaw
Advisor
Advisor
Hi

Thanks for the reply. This makes a list of materials in the active document whereas I need to get a full list of the materials in the current library.

I'm going to try it in a while 🙂


Thanks

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 4 of 5

bradeneuropeArthur
Mentor
Mentor
This is a list of the library. that are used by the document.
So they are not in the document yet....
Think this is still what you need.

regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 5

NachoShaw
Advisor
Advisor

ok cool, appreciate it. Is there a method of getting the image path to the appearance also and the color (when no image is used)?

 

 

 

 

cheers

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes