Inventor General Discussion

Inventor General Discussion

Reply
Active Contributor
-ianf-
Posts: 28
Registered: ‎01-07-2010
Message 1 of 6 (209 Views)

iLogic question

209 Views, 5 Replies
03-07-2013 01:11 AM

Another iLogic question for you all.

 

I would like a simple rule adding to some standard pressed sheet metal parts that we have. The code would look at the current model tree and if any features are added to the part then a character (lets say a *) is placed into the "Vendor" field within the iProperties. 

 

Is this possible?

 

Many thanks in anticipation.

Ian Farmery
Inventor 2010 Pro SP4, Vault Collaboration 2010
HP Z820 Xeon E5-2643 0 @ 3.3Ghz 16.0GB RAM
Nvidia Quadro 5000
Distinguished Contributor
waynehelley
Posts: 130
Registered: ‎09-10-2012
Message 2 of 6 (190 Views)

Re: iLogic question

03-07-2013 06:34 AM in reply to: -ianf-

I can't think of any way to make ilogic code recognize that a feature has been added unfortunately. 

 

In 'Event Triggers' there is an option for 'Feature Suppression Change'.  I imagine that will trigger if a new feature is added.  Could this be sufficient?

 

Do you want the Vendor field to simply become " * " or does the star need to be added after the current data? e.g. " VENDOR1* "

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2013
Windows 7 Enterprise, 64-bit
*Expert Elite*
Curtis_Waguespack
Posts: 2,878
Registered: ‎03-08-2006
Message 3 of 6 (184 Views)

Re: iLogic question

03-07-2013 07:39 AM in reply to: -ianf-

Hi -ianf-,

 

Would looking at the mass properties work? Mass, volume, etc.

If one or more of these changes, then write to the vendor field.

Just a thought.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Edit:

Here's a quick snippet to count features that you might work into a solution:

 

myCount = 0
For Each oFeature As PartFeature In ThisDoc.Document.ComponentDefinition.Features		
If oFeature.Suppressed = False Then
myCount = myCount + 1
iProperties.Value("Summary", "Title") = myCount
Else 
End If
Next oFeature
MessageBox.Show(myCount, "iLogic")

 



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





Active Contributor
-ianf-
Posts: 28
Registered: ‎01-07-2010
Message 4 of 6 (176 Views)

Re: iLogic question

03-07-2013 07:58 AM in reply to: waynehelley

Thanks for the replies.

Basically we currently use the vendor column to indicate if the sheet metal part requires a dxf.  For example a simple rectangular part can be manufactured straight from the parts list (length x width x thickness).  Add a hole to it then we need a dxf program so the hole can be cut. We add the character manually in the iprops but sometimes this procedure is forgotten.

I was hoping that a rule could be written to determine if anything was done to the part then a character would appear in the vendor column automatically (or anywhere within the iprops).

 

An interesting idea from Curtis using mass properties.  Unfortunatley the sheet will vary in size, thus changing the mass.

Ian Farmery
Inventor 2010 Pro SP4, Vault Collaboration 2010
HP Z820 Xeon E5-2643 0 @ 3.3Ghz 16.0GB RAM
Nvidia Quadro 5000
Active Contributor
-ianf-
Posts: 28
Registered: ‎01-07-2010
Message 5 of 6 (126 Views)

Re: iLogic question

05-01-2013 02:35 AM in reply to: Curtis_Waguespack

Curtis that neat little feature count snippet was working fine for weeks. now it is returning this error; 

 

 

Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))

 

 

It is odd that it seems to work on some machines but not others. Any ideas?

Ian Farmery
Inventor 2010 Pro SP4, Vault Collaboration 2010
HP Z820 Xeon E5-2643 0 @ 3.3Ghz 16.0GB RAM
Nvidia Quadro 5000
*Expert Elite*
jtylerbc
Posts: 871
Registered: ‎09-01-2010
Message 6 of 6 (114 Views)

Re: iLogic question

05-01-2013 06:21 AM in reply to: -ianf-

 

Ian,

 

I recently wrote some code that deals with a very similar situation.  Rather than looking to see if features have been "added", technically what it does is look at the number of features that EXIST, then compare them to a set number of features that represents the features from the original template file.  This is a stripped down version of my code, removing all of my stuff that has nothing to do with your particular situation.

 

oDoc = ThisDoc.Document
Dim FeatureList As New ArrayList


' If a feature is Active (not suppressed), it is added the FeatureList array
For Each oFeature In oDoc.ComponentDefinition.Features
	If Feature.IsActive(oFeature.Name) Then
	
	FeatureList.add(oFeature.Name)
	
	End If
Next


' Count the number of items in the FeatureList array
FeatureCount = FeatureList.count


' If more than the specified feature count is detected, do something.
If FeatureCount > 1 Then
'Insert whatever you want to happen here
End If

 

In the final If/Then statement, you'll need to adjust the " >1 " to whatever number of features is appropriate for the initial version of your parts.

 

In my case, this is part of a set of rules that determines whether or not a steel plate requires a dimensioned drawing view.  This rule's intent was to check to see if any holes, notches, etc. had been added to the plate after beginning the model from one of our steel plate template files.

John Tyler
Inventor 2015
Windows 7 64 Bit
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 or visit the Installation and Licensing Forum to get help installing your software.