Custom IProperties

Custom IProperties

Anonymous
Not applicable
8,659 Views
93 Replies
Message 1 of 94

Custom IProperties

Anonymous
Not applicable

Is there a way to have Iproperties automatically add the material in the custom tab when you select a material? 

0 Likes
Accepted solutions (3)
8,660 Views
93 Replies
Replies (93)
Message 2 of 94

mcgyvr
Consultant
Consultant

Yes there is ... via logic/before save event trigger..

'get current material
oMaterial = iProperties.Material
'set custom iprop to be the material
iProperties.Value("Custom", "MATERIAL") = oMaterial


-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 3 of 94

Cadmanto
Mentor
Mentor

Are you talking in a BOM or a note?

There is a way, yes.

 

Here is how you do it in a text note.

Property.jpgProperty1.jpgProperty2.jpg

 

check.PNGIf this solved your issue please mark this posting "Accept as Solution".

Or if you like something that was said and it was helpful, Kudoskudos.PNG are appreciated. Thanks!!!! Smiley Very Happy

 

New EE Logo.PNG

Inventor.PNG     vault.PNG

 

 

Best Regards,
Scott McFadden
(Colossians 3:23-25)


0 Likes
Message 4 of 94

Anonymous
Not applicable

I'm not sure what you mean by this.

0 Likes
Message 5 of 94

Anonymous
Not applicable

I'm looking for a way to fill in the material under the custom tab in iproperties so i don't have to go in everytime and type in the material by hand.

0 Likes
Message 6 of 94

mcgyvr
Consultant
Consultant
Accepted solution

@Anonymous wrote:

I'm looking for a way to fill in the material under the custom tab in iproperties so i don't have to go in everytime and type in the material by hand.


You need to do it via ilogic

If you want to learn about ilogic start here..

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2015...

 

But this is what you need to do..

Open your template ipt file..

Turn on the ilogic browser

Right click in the blank space under the "rules" tab and select "Add Rule" and give it a name like "update material"

Paste this code into that screen that comes up..

'get current material
oMaterial = iProperties.Material
'set custom iprop to be the material
iProperties.Value("Custom", "MATERIAL") = oMaterial

And press save then cancel

Go the manage tab on the ribbon and in the "Ilogic section press the "event triggers" button

When on the "This document tab" find your "update material" in the "Rules in this document" section and drag it into the right hand column and drop it right under the "before save document" Event..

Press ok and save your template..

 

Now all new files will automatically add the material to the custom material iproperty when you save your part..

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 7 of 94

Cadmanto
Mentor
Mentor

I get what you are saying.  Let me make a suggestion.  There is an out of the box property for material.  If you use that property in conjunction with the material library, when you select a material, it will automatically fill in whether in a note or a BOM.

Does that make sense?  Forget about the iproperty window.  Not way to fill that in automatically.

 

check.PNGIf this solved your issue please mark this posting "Accept as Solution".

Or if you like something that was said and it was helpful, Kudoskudos.PNG are appreciated. Thanks!!!! Smiley Very Happy

 

New EE Logo.PNG

Inventor.PNG     vault.PNG

 

 

Best Regards,
Scott McFadden
(Colossians 3:23-25)


0 Likes
Message 8 of 94

Anonymous
Not applicable

Is there a way to link a part iproperties to a assembly iproperties?

0 Likes
Message 9 of 94

mcgyvr
Consultant
Consultant

@Anonymous wrote:

Is there a way to link a part iproperties to a assembly iproperties?


Can you explain more about why you want to do that?

Knowing what you are trying to do will help get you the best answer..

 

But as stated above by @Cadmanto I'm not really sure why you need to have Material as a custom iproperty as its already a normal property that can be easily accessed in Inventor.. 

The ilogic code I posted above though will automatically set the chosen Inventor material to be filled out as a custom iprop.. But unless you have a specific reason there really shouldn't be a need to even do that..



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 10 of 94

Anonymous
Not applicable

In the iproperties, we have to go in and fill out the information everytime we create a new part. If you look at the picture, API NUmber we have to type in the part new that this part will be used for, JOB NUMBER we have to type in the job number we are working on for this design. And material, we have to go in and type in what material we are going to use in this field. As the picture shows i selected steel and the material property is blank.Capture.PNG I wanted to know if there was a way i can pick a material and it will be filled in automatically instead of having to go in every time and change it.  The api number and job number just wondering if i can link the part iproperties to the assembly iproperties so them numbers will be automatically filled.

0 Likes
Message 11 of 94

mcgyvr
Consultant
Consultant

@Anonymous wrote:

I wanted to know if there was a way i can pick a material and it will be filled in automatically instead of having to go in every time and change it.  The api number and job number just wondering if i can link the part iproperties to the assembly iproperties so them numbers will be automatically filled.


As for the material..

Did you try what I posted above?

Thats how you would go about doing it..

 

Out of the box without help from ilogic custom programming Inventor cannot do it..

 

As to your other question..

I "think" you are asking if when you put a part into an assembly can it automatically pull the API and job number from the parts custom iproperties and create the same API and Job number in the custom iproperties of the assembly.. 

Is that correct?

If so that is also possible but again through some custom ilogic programming..

 

But there are questions I would need to ask about that process..

First being.. What if 2 parts are put into an assembly and each has a different API/Job Number? What to do then?

Second.. Wouldn't it be better to just enter the API/Job number once in the assembly and have it automatically populate the custom iproperties of ALL of the parts in that assembly? 

And many more I'm sure..

 

Just realize that there are ways to accomplish a lot of what Inventor cannot do out of the box with ilogic custom programming but there might also be smarter ways to accomplish the task without it..  Just like cadmento was saying.. Why do you need to duplicate material? Just so its all in one place.. If so thats fine.. But are you pulling that data into a parts list in a drawing? if so there really is no need to duplicate except to just have it all in one place (again.. which is fine)..

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 12 of 94

Anonymous
Not applicable

The material work good. Thank you. As far as the other goes, all the parts we put into the assembly will have the same API Number and Job number. I was just wondering if i filled out the information in the assembly that when I put the parts into it, that all the information will transfer over to the arts from the assembly. Sometimes I will have over 200 parts in one assembly and it takes a while to go thru everyone and type in the information in them. So I'm just looking to see if there is a way I can do something to make it easier and faster for us.

0 Likes
Message 13 of 94

Anonymous
Not applicable

The Title on the summary tab will be the same on the parts and assembly. The Api number and Job number on the custom job will all be the same also. 

Capture 1.PNGCapture 2.PNG

0 Likes
Message 14 of 94

mcgyvr
Consultant
Consultant

@Anonymous wrote:

The material work good. Thank you. As far as the other goes, all the parts we put into the assembly will have the same API Number and Job number. I was just wondering if i filled out the information in the assembly that when I put the parts into it, that all the information will transfer over to the arts from the assembly. Sometimes I will have over 200 parts in one assembly and it takes a while to go thru everyone and type in the information in them. So I'm just looking to see if there is a way I can do something to make it easier and faster for us.


So please correct me if I'm wrong so I or someone else can provided the needed code..

But it sounds like you would like to have an ilogic rule that will prompt for the API/Job number in the assembly and then push that down to all parts in that assembly?

 

Is that correct?



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 15 of 94

Anonymous
Not applicable

If that would work for what i need than yes. As long as it's not the same for everything I do.

0 Likes
Message 16 of 94

mcgyvr
Consultant
Consultant
Accepted solution

@Anonymous wrote:

If that would work for what i need than yes. As long as it's not the same for everything I do.


I don't know that that last statement means..

 

But here is ilogic code that will do the following..

1-You run it from the assembly

2-It will prompt you to enter the API and Job numbers

3-then it creates both custom iprops (JOB and API NUMBER 1) in the assembly and puts the value of those as what you entered in the prompt dialogs..

4-Then it does the same for all components of that assembly...

5-Then lets you know its complete

 

'capture the API and Job Numbers
APINumber = InputBox("Please Enter the API Number", "API Number Request")
JobNumber = InputBox("Please Enter the Job Number", "JOB Number Request")

'Write them to the assembly iprops
iProperties.Value("Custom", "API NUMBER 1") = APINumber
iProperties.Value("Custom", "JOB") = JobNumber

'Do the same for all components in this assembly..
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

Dim oOccurrence As ComponentOccurrence

'Iterate through all Of the occurrences
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
'write to component iprops
iProperties.Value(oOccurrence.Name, "Custom", "JOB") = JobNumber
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 1") = APINumber

Next
'show confirmation that the code has finished MessageBox.Show("API/Job Process Completed", "API/JOB Status")


-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 17 of 94

Anonymous
Not applicable

There is sometimes we have more than one API Number, do i just copy that line and change the number?

iProperties.Value("Custom", "API NUMBER 1") = APINumber

 

0 Likes
Message 18 of 94

Anonymous
Not applicable

Also will this work for the Title on the summary tab also?

0 Likes
Message 19 of 94

mcgyvr
Consultant
Consultant

@Anonymous wrote:

There is sometimes we have more than one API Number, do i just copy that line and change the number?

iProperties.Value("Custom", "API NUMBER 1") = APINumber

 


Code updated to have up to 5 API numbers (just leave the valve blank to not fill in anything)

Also added title request/insert functionality for assembly and all components..

 

 

'capture the API and Job Numbers
Title1 = InputBox("Please Enter the Title", "Title Request")
APINumber1 = InputBox("Please Enter the API Number 1", "API Number 1 Request")
APINumber2 = InputBox("Please Enter the API Number 2", "API Number 2 Request")
APINumber3 = InputBox("Please Enter the API Number 3", "API Number 3 Request")
APINumber4 = InputBox("Please Enter the API Number 4", "API Number 4 Request")
APINumber5 = InputBox("Please Enter the API Number 5", "API Number 5 Request")
JobNumber = InputBox("Please Enter the Job Number", "JOB Number Request")

'Write them to the assembly iprops
iProperties.Value("Summary", "Title") = Title1
iProperties.Value("Custom", "API NUMBER 1") = APINumber1
iProperties.Value("Custom", "API NUMBER 2") = APINumber2
iProperties.Value("Custom", "API NUMBER 3") = APINumber3
iProperties.Value("Custom", "API NUMBER 4") = APINumber4
iProperties.Value("Custom", "API NUMBER 5") = APINumber5
iProperties.Value("Custom", "JOB") = JobNumber

'Access the components
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

Dim oOccurrence As ComponentOccurrence
'Do the same for all components in this assembly..
'Iterate through all Of the occurrences
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
'write to component iprops
iProperties.Value(oOccurrence.Name, "Summary", "Title") = Title1
iProperties.Value(oOccurrence.Name, "Custom", "JOB") = JobNumber
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 1") = APINumber1
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 2") = APINumber2
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 3") = APINumber3
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 4") = APINumber4
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 5") = APINumber5

Next

MessageBox.Show("API/Job Process Completed", "API/JOB Status")


-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 20 of 94

Anonymous
Not applicable

Do i run this in the assembly under before save document in the event triggers?

0 Likes