Inventor Customization

*Expert Elite*
Posts: 864
Registered: ‎09-01-2010
Message 1 of 3 (283 Views)
Accepted Solution

iLogic - Test for iPart

283 Views, 2 Replies
01-25-2013 11:28 AM

I have a fairly simple external iLogic rule I've been working on (and using) for the last couple of days, which I would like to add some additional functionality to.  The rule is run on a part file, - it then looks at that part's Part Number iProperty, goes to an Excel price list, retrieves the corresponding Cost and Comments fields from the spreadsheet, and writes these to the appropriate iProperty values in the part.



Target = iProperties.Value("Project", "Part Number")

i = GoExcel.FindRow("X:\R&D\R&D Structure\Fitting Cost Estimator.xls", "Price List", "PART #", "=", Target)

Cost = GoExcel.CurrentRowValue("ESTIMATED COST")
Comment = GoExcel.CurrentRowValue("COMMENTS")

iProperties.Value("Project", "Estimated Cost") = Cost
iProperties.Value("Summary", "Comments") = Comment


If Cost = 0 Then
		MessageBox.Show("This fitting is missing from the price list.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
		MessageBox.Show("This fitting has no price entered in the price list.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
	End If

End If


This rule is really only intended to update data for non-iPart components in our central library of purchased parts.  However, this library contains a mix of normal parts and iParts, and it would be very easy to accidentally run the rule on an iPart.  Is there something simple that could be added to the rule to check if the active document is an iPart, and skip it if so?

John Tyler
Inventor 2013
Windows 7 64 Bit
*Expert Elite*
Posts: 2,775
Registered: ‎03-08-2006
Message 2 of 3 (279 Views)

Re: iLogic - Test for iPart

01-25-2013 11:41 AM in reply to: jtylerbc

Hi jtylerbc,


You can use something like this:


Dim partDoc As PartDocument
partDoc = ThisApplication.ActiveDocument    

If partDoc.ComponentDefinition.IsiPartFactory _
Or partDoc.ComponentDefinition.IsiPartMember Then
Return 'do nothing
MessageBox.Show("This is NOT an iPart", "Title")
End If



I hope this helps.
Best of luck to you in all of your Inventor pursuits,




  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.

*Expert Elite*
Posts: 864
Registered: ‎09-01-2010
Message 3 of 3 (266 Views)

Re: iLogic - Test for iPart

01-25-2013 12:34 PM in reply to: Curtis_Waguespack



Thanks, that works great.  I modified it a bit to give a message box if run on an iPart, instead of just a Return.  Later on I may add an additional check to exclude assemblies as well, but since there is currently only one assembly in this entire library folder, that can wait for now.



John Tyler
Inventor 2013
Windows 7 64 Bit

You are not logged in.

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

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