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.
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* "
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,
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")
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
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.
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?
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.
Access a broad range of knowledge to help get the most out of your products and services.