Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic question

5 REPLIES 5
Reply
Message 1 of 6
-ianf-
427 Views, 5 Replies

iLogic question

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 & Vault 2023

Dell 7550 Xeon E-2276M, 2.80Ghz 64GB RAM
Nvidia Quadro RTX 4000
5 REPLIES 5
Message 2 of 6
waynehelley
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 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
Message 3 of 6
Curtis_Waguespack
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")

 

Message 4 of 6
-ianf-
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 & Vault 2023

Dell 7550 Xeon E-2276M, 2.80Ghz 64GB RAM
Nvidia Quadro RTX 4000
Message 5 of 6
-ianf-
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 & Vault 2023

Dell 7550 Xeon E-2276M, 2.80Ghz 64GB RAM
Nvidia Quadro RTX 4000
Message 6 of 6
jtylerbc
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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report