Adding custom information in the material library

Adding custom information in the material library

Anonymous
Not applicable
1,223 Views
8 Replies
Message 1 of 9

Adding custom information in the material library

Anonymous
Not applicable

Hello all,

 

my company wants me to add our own material number in the material library,so when the designers choose a material, its company-given number will appear in the title block, extracted via iLogic or VB.

 

For example: Aluminium 6101: 84-3362. 

 

Does anyone know how to do this?

 

Thank you

0 Likes
1,224 Views
8 Replies
Replies (8)
Message 2 of 9

CCarreiras
Mentor
Mentor

Create New Materials:

 

Make one copy from one existent material, change properties (or not if you just want to change names), and aply those edited materials to your parts.

CCarreiras

EESignature

0 Likes
Message 3 of 9

Anonymous
Not applicable

I'm not sure I understand how to go about this. I attached an image of my material editor, with a custom material created in a custom library. I want to be able to extract the number "82-0081" from the material through iLogic or VB. Please tell me how I can achieve this. 

 

Thank you

 

0 Likes
Message 4 of 9

MechMachineMan
Advisor
Advisor
Likely, you will need iLogic to go into the Assets that belong to the MaterialAssets Object.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 5 of 9

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

In the Inventor API Help File (C:\Program Files\Autodesk\Inventor 2016\Local Help\admapi_20_0.chm) there is a section on "Consistent Materials (Materials and Appearances)" and that has links to many samples as well, including one that lists all the properties.

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes
Message 6 of 9

Anonymous
Not applicable

Thank you Adam, I'll look into that right away! I'll post the entirety of my code when it's done.Smiley Happy

0 Likes
Message 7 of 9

Anonymous
Not applicable

OK, I got a little further in my quest. I cannot, in fact, add anything to the material library and retrieve it via iLogic. What I have done is create an Excel file with the material names and our custom material purchase numbers, and extract the info via iLogic from there.

 

I'm hitting a snag where some names work fine and some others give me the error: "Conversion of string -Material name here- as type 'Double' is not valid". I have less than 100 entries in Excel today, but I should have upwards of 350 when complete.

 

The code is very straightforward, the Excel cells are all formatted to "Text", and it does not matter where the material is in the list, it errors out anyway. 

 

I need some help, please 🙂

 

Code:

FichierExcel = "T:\Inventor Normand\Design Data\iLogic\ListeMateriel.xlsx"
NomMateriel = ThisDoc.Document.ComponentDefinition.Material.Name
For rowPN = 2 To 10000
'Trouve la cellule contenant le Materiel voulu
 If (GoExcel.CellValue(FichierExcel, "Feuil1", "A" & rowPN) = NomMateriel) Then
 NumMateriel = GoExcel.CellValue(FichierExcel, "Feuil1", "B" & rowPN)
'Save this possibility for later 'Info1 = GoExcel.CellValue("C" & rowPN) Exit For End If Next InventorVb.DocumentUpdate()
'It just shows the info for now, I'll actually use it later MessageBox.Show("Nom du materiel: " & NomMateriel & vbLf & _ "Numero du materiel: " & NumMateriel, "iLogic")

 

0 Likes
Message 8 of 9

Anonymous
Not applicable

Quick edit: I've found out that the Excel cell and the library entry are case-sensitive. That took care of a few cases, but not all. Cover me, I'm going back in!

0 Likes
Message 9 of 9

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

You could add some debugging to the code - in case that helps:

http://adndevblog.typepad.com/manufacturing/2014/08/debug-ilogic.html

 

Also I'm wondering if using GoExcel.Open and Close would speed things up, since then I think the connection will be kept alive.

It might also be the same when not using those functions - not sure.

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes