I'm not sure if this is possible through the API or not, but there are a lot of smart folks on here so let's give it a shot. I would like to make a rule that will take information from the material "Descriptive Information" "Comments" line and put it in the Stock Number iProperty. We have a large library of custom materials and I want to put the raw material stock number in the comments field then use iLogic to extract it and apply it to the Stock Number whenever the material is changed.
Solved! Go to Solution.
Solved by HermJan.Otterman. Go to Solution.
Solved by HermJan.Otterman. Go to Solution.
Hello Dale,
Yes you can.
Here is an iLogic rule that does that.
Dim oPartDoc As Inventor.PartDocument = ThisDoc.Document Dim oRawMatNo As String = oPartDoc.ActiveMaterial.Item("physmat_Comments").Value MsgBox(oRawMatNo) iProperties.Value("Project", "Stock Number") = oRawMatNo
(delete the MSGbox line)
Currently I am using the above rule for my active materials which works very well, but I was wondering if there is a way to access an inactive material comment based on a multi-value text parameter that matches an inactive material name.
Hi
Is there a list of all the names from the material information properties?
Dim oRawMatNo As String = oPartDoc.ActiveMaterial.Item("physmat_Comments").ValueFor example: physmat_Comments is for the Identity Tab -> Comments box
physmat_Manufacturer is for the Identity Tab -> Manufacturer
How to access in the Physical Tab the boxes like Name, Description, Keywords, Source etc.
Thanks
try:
Physmat_Comments
Physmat_Cost
Physmat_Keynote
Physmat_Keywords
Physmat_Label
Physmat_Manufacturer
Physmat_Mark
Physmat_Model
Physmat_Type
Physmat_URL
Appearance and Physical tabs
oPartDoc.Activematerial.PhysicalPropertiesAsset.item(“.....”)
structural_density
structural_behavior
etc..
Generic_self_illum_color_temperature
Generic_self_illum_filter_map
generic_self_illum_Luminance
Generic_Transparency
Etc,
(do a for each item and list the names….)
pHysical ...
Dim oPartDoc As PartDocument = ThisDoc.Document Dim ActiveMat As Asset = oPartDoc.ActiveMaterial 'list all Identity AssetValues: For Each oAssetValue As AssetValue In ActiveMat MessageBox.Show(oAssetValue.Name) Next Dim ActiveApperancePhysical As Asset = oPartDoc.ActiveMaterial.PhysicalPropertiesAsset 'list all Appearance and Physical msgbox("") For Each oApperancePhysical As AssetValue In ActiveApperancePhysical MessageBox.Show(oApperancePhysical.Name) Next
Thank you very much @HermJan.Otterman !
That's exactly what i was looking for. Unfortunately I can't find where to accept as solution!
Best regards
j
great that you found your solution.
the accept is only if you created the initial question.
thanks
with this code you go through ALL material in you project file:
Dim AssetLibs As AssetLibraries = ThisApplication.AssetLibraries Dim AssetLib As AssetLibrary For Each AssetLib In AssetLibs Dim oMaterialAssets As AssetsEnumerator = AssetLib.MaterialAssets Dim oMaterial As MaterialAsset For Each oMaterial In oMaterialAssets msgbox(oMaterial.displayname) Next Next
where the messagebox is, you can put the code from the previous answer to get to the properties
This is great information...
Perhaps I'm missing it here, but what I really need is to pull the Appearance Name associated with a material. Material/Appearance/Information/Name
Public Sub asse()
Dim a As Application
Set a = ThisApplication
Dim oAsset As Asset
Dim oAssets As Assets
Set al = a.AssetLibraries.Item("YOUR MATERIAL LIBRARY NAME")
Dim m As MaterialAsset
For Each oAsset In al.MaterialAssets
If oAsset.DisplayName = "YOUR MATERIAL" Then
Debug.Print oAsset.Name
Set m = a.AssetLibraries.Item("YOUR MATERIAL LIBRARY NAME").MaterialAssets.Item(oAsset.Name)
MsgBox m.AppearanceAsset.DisplayName
MsgBox m.DisplayName
End If
Next
Regards,
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
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: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 !
I explored your posting. Great help. However, my need is to retrieve mostly the material of the current part document. Like to retrieve other data Other data (appearance) as well.
Hi!
I need some help for the following problem. I would like to get information about Material Editor / Physical / Name.
I will create a code when i will filter the surface treatment. When i choose the "steel", i can select between black oxided, nickel plated, ... When i choose the "aluminium", i can select anodized.
I need this Physical name, but i can't know how i get this parameter.
Tthanks
Hi Herm Jan,
Do you know how to access the Material Description on the Identity tab? I don't see it on your list, and this thread suggests it might not be available?
https://forums.autodesk.com/t5/inventor-forum/material-description-as-custom-iproperty/td-p/6913143
Thanks for your help
Hello,
Unfortunately I can replay at now.
I use the following code to list the physical information. And I can't find the Name of Physical. I can't find this in API table.
Dim oPartDoc As Inventor.PartDocument = ThisDoc.Document Dim oActivePhysical As Asset = oPartDoc.ActiveMaterial.PhysicalPropertiesAsset MessageBox.Show(oActivePhysical.Name) For Each oPhysical As AssetValue In oActivePhysical MessageBox.Show(oPhysical.Name, "Azonosító") Dim oPhysMat As String = oPhysical.Value MessageBox.Show(oPhysMat, "Érték") Next
Thanks @Anonymous
@johnsonshiue, do you know why the material description is not available, and seems to be the only property that isn't available? I want access to it because it is easy to update, whereas changing the Name property creates a new material
Thanks
ic198
Is there a way that I can copy the comment from the message box to my clipboard when it pops up? Right now it is unselectable.
@ppolcynBNVFN, you can use an Inputbox rather than a message box, or better yet use the logger so you don't need to click OK , 9000 times.
Hope that helps.
Dim oPartDoc As Inventor.PartDocument = ThisDoc.Document Dim oActivePhysical As Asset = oPartDoc.ActiveMaterial.PhysicalPropertiesAsset InputBox("", "Active Physical Name", oActivePhysical.Name) For Each oPhysical As AssetValue In oActivePhysical InputBox("", "Azonosító", oPhysical.Name) Dim oPhysMat As String = oPhysical.Value InputBox("", "Érték", oPhysMat) Next
'show ilogic logger ThisApplication.UserInterfaceManager.DockableWindows.Item("ilogic.logwindow").Visible = True Dim oPartDoc As Inventor.PartDocument = ThisDoc.Document Dim oActivePhysical As Asset = oPartDoc.ActiveMaterial.PhysicalPropertiesAsset Logger.Info("Active Physical Name") Logger.Info(oActivePhysical.Name) For Each oPhysical As AssetValue In oActivePhysical Logger.Info("Physical Name") Logger.Info(oPhysical.Name) Dim oPhysMat As String = oPhysical.Value Logger.Info("PhysMat") Logger.Info(oPhysMat) Logger.Info("") Next
That works perfect. I just used an input box as I just need one property. Thanks!
Can't find what you're looking for? Ask the community or share your knowledge.