Inventor Customization

Reply
Distinguished Contributor
guyh
Posts: 366
Registered: ‎12-11-2007
Message 1 of 18 (1,706 Views)
Accepted Solution

Run ilogic rule in each part from the assembly via external rule?

1706 Views, 17 Replies
12-06-2011 03:21 AM

Hi,

 

I want to simply set a custom iproperty as the Description in each part file within my assembly.  I can do this easily at part level with ilogic but I want to be able to run the rule from the assembly level and all the parts run the rule.  I am struggling to find a way to do this.

 

I think this may be the best method I have found but I think it must be far easier?

 

http://inventortrenches.blogspot.com/search/label/Autodesk%20Inventor%20iLogic

 

Thanks,

Guy

AutoCADM 2011 SP2
Inventor Pro 2011 SP2
Mentor
MegaJerk
Posts: 266
Registered: ‎01-26-2011
Message 2 of 18 (1,687 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-07-2011 05:03 AM in reply to: guyh

Will the description be something that is derived from a parameter within each part, a manual entry, or perhaps a parameter in the assembly, OR something just hardcoded? 

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, -
as it increases my power levels and will eventually help to elevate me towards outer space.

Check out my iLogic injection tool here : http://goo.gl/ce1Qg
--------------------------------------------------------------------------------------
Distinguished Contributor
guyh
Posts: 366
Registered: ‎12-11-2007
Message 3 of 18 (1,685 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-07-2011 06:59 AM in reply to: MegaJerk

We have a PLM system which populates a custom iproperty with the description entered in the PLM.  We also have some old parts which have the description in the Description field but not the custom iproperty.  I want to write a rule which will ensure I can call the Description field in a parts list.  If I do this currently some descriptions are blank.

 

Can you help?

 

Thanks,

Guy

AutoCADM 2011 SP2
Inventor Pro 2011 SP2
Mentor
MegaJerk
Posts: 266
Registered: ‎01-26-2011
Message 4 of 18 (1,683 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-07-2011 07:03 AM in reply to: guyh

So your PLM system does a lot of the grunt work of populating the custom iprop. You just want to make sure that the custom iprop exists, correct?  

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, -
as it increases my power levels and will eventually help to elevate me towards outer space.

Check out my iLogic injection tool here : http://goo.gl/ce1Qg
--------------------------------------------------------------------------------------
Distinguished Contributor
guyh
Posts: 366
Registered: ‎12-11-2007
Message 5 of 18 (1,681 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-07-2011 07:07 AM in reply to: MegaJerk

I want to make sure that if the custom iprop exists it is copied to the Description field under the project tab.  I think it's dangerous to copy the other way as this is data placed in the part from the PLM system.   That way I can run the rule in the assembly and ensure I have the description for each part in my Parts List.  Some of the legacy parts in the PLM had the description stored in the Description field.

 

I do not know why it was changed......

 

cheers,

Guy

AutoCADM 2011 SP2
Inventor Pro 2011 SP2
Mentor
MegaJerk
Posts: 266
Registered: ‎01-26-2011
Message 6 of 18 (1,673 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-07-2011 08:57 AM in reply to: guyh

Alright. I made this during lunch just now, and have not tested it, but you should be able to throw this into a rule in the main assembly file and let it do its thing. 

Basically it just goes through all of the parts in the assembly, and will set the Project's - Description iproperty, to match a custom iproperty of your desire. Just be sure to replace the custom iproperty name in the code with the one you'll be using. 

Dim openDoc As Document
openDoc = ThisDoc.Document

Dim docFile As Document

If openDoc.DocumentType = 12291 Then

	For Each docFile In openDoc.AllReferencedDocuments
		
		If docFile.DocumentType = 12290 Then
			
			iProperties.Value(docFile.DisplayName, "Project", "Description") = iProperties.Value(docFile.DisplayName, "Custom", "YOURiPropNAMEHERE")
		
		End If 
	
	Next
	
End If 
			
			

 

 

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, -
as it increases my power levels and will eventually help to elevate me towards outer space.

Check out my iLogic injection tool here : http://goo.gl/ce1Qg
--------------------------------------------------------------------------------------
Distinguished Contributor
guyh
Posts: 366
Registered: ‎12-11-2007
Message 7 of 18 (1,662 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-08-2011 12:58 AM in reply to: MegaJerk

Hi Sorry for the delay replying.  Start of the day in the UK now.

 

Thanks a lot for the help and the rule.  I tried it and receive an error when it's run.

 

I've used a test assembly.  Here is the detail of the message

 

 

Cheers,

Guy

AutoCADM 2011 SP2
Inventor Pro 2011 SP2
Mentor
MegaJerk
Posts: 266
Registered: ‎01-26-2011
Message 8 of 18 (1,656 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-08-2011 05:25 AM in reply to: guyh

I just tested this. It should work, but it assumes that you have your occurrence names set to the filename, and that there is always one of them named with the suffix of “:1” (So if you have a filename called FrankyLovesCake.ipt it assumes the Occurrence name is FrankyLovesCake:1).

Later on, I’ll try to make this more solid and less awful.

 

New Code : 

 


Dim openDoc As Document
openDoc = ThisDoc.Document

Dim docFile As Document

If openDoc.DocumentType = 12291 Then

For Each docFile In openDoc.AllReferencedDocuments

If docFile.DocumentType = 12290 Then

Dim OccName As String
OccName = Left(docFile.DisplayName, Len(docFile.DisplayName) - 4) & ":1"
iProperties.Value(OccName, "Project", "Description") = iProperties.Value(OccName, "Custom", "CUSTOM_NAME_HERE")

End If

Next

End If


--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, -
as it increases my power levels and will eventually help to elevate me towards outer space.

Check out my iLogic injection tool here : http://goo.gl/ce1Qg
--------------------------------------------------------------------------------------
Distinguished Contributor
guyh
Posts: 366
Registered: ‎12-11-2007
Message 9 of 18 (1,653 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-08-2011 06:28 AM in reply to: MegaJerk

Hi,

 

Thanks I really appreciate the help.  The file name and occurrence names differ unfortunately.  As an example.  The file name = doc-0000837756_0.ipt yet the occurrence name = DOC-0000837756-PART_GLFT_0003-PART-ID-2301831:1

 

This is generated by the software we have which links to the PLM.

 

Cheers,

Guy

AutoCADM 2011 SP2
Inventor Pro 2011 SP2
Mentor
MegaJerk
Posts: 266
Registered: ‎01-26-2011
Message 10 of 18 (1,651 Views)

Re: Run ilogic rule in each part from the assembly via external rule?

12-08-2011 06:30 AM in reply to: guyh

Yeah. I figured that might be the case. Once I get some time, I'll change how it goes about messing with things, and maybe all will be well in the end!. 
 

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, -
as it increases my power levels and will eventually help to elevate me towards outer space.

Check out my iLogic injection tool here : http://goo.gl/ce1Qg
--------------------------------------------------------------------------------------

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube