iLogic Event Trigger on "Convert to Sheet Metal"

iLogic Event Trigger on "Convert to Sheet Metal"

nate0520
Contributor Contributor
1,201 Views
5 Replies
Message 1 of 6

iLogic Event Trigger on "Convert to Sheet Metal"

nate0520
Contributor
Contributor

Hello,

Long story short: I am looking for a simple way to trigger an iLogic rule when the "Convert to Sheet Metal" button is pressed. I have not been able to achieve this using the "Event Triggers" default Rules on Events (I am new to iLogic; I've used VBA extensively in excel and have recently begun using VBA/iLogic in Inventor). 

 

Short story long: I have an iLogic rule that writes the "Sheet Metal Extents" value to a parameter in the table, which can then be used in an iProperty field (I do it this way so I can get a value that is easier to format in line with our company's standard formatting). Currently, I have the rule set to trigger on "Part Geometry Change" which works fine so long as the user does not convert from sheet metal to standard parts. I am trying to patch up an edge case where the part may get converted to standard part, modified, and then get converted back to Sheet Metal: when the part is modified as a Standard Part, the rule triggers, but sheet metal extents are non-existent so the Extents parameters read as 0. The parameters will not update unless a subsequent geometry change is made in the Sheet Metal environment. This is a pretty minor issue, but it is the first iLogic rule I'm trying to "launch" to our design team so I would like it to be as complete as possible before releasing, especially considering it is fairly simple. 

 

Thank you. 

0 Likes
Accepted solutions (2)
1,202 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor
Accepted solution

   Unfortunately, it's not going to be that simple.  I have worked with the iLogic Event Triggers, using iLogic code before, and I don't think there is a way to define your own new custom type of event you want it to watch for.  If this capability exists, it is likely a guarded secret, known only to Autodesk's own software developers.  Since there isn't already an Event Trigger set-up within the iLogic Add-in for that specific event, there isn't really a simple way to create a new Event Trigger for that event using iLogic.

   Since the functionality you are wanting requires there to be something 'listening' in the background, while working with any number of different files, and doing any number of different things in the mean time, for whenever this very specific event may happen, it sounds to me like you would need to create your own custom Add-in for this.  That way the Add-in will either be started automatically when Inventor starts, or you will have to manually start/stop it, then when started it will start listening in the background for that event to happen.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6

nate0520
Contributor
Contributor

Understood -- sounds like the triggers are what they are, and adding additional/alternate triggers are beyond the scope of iLogic... a project for a later day. Thank you! 

 

For anyone coming to this thread for answers to the same problem: in my particular application, I have been able to generally get the behavior I want by triggering my Rule on several different "This Document" triggers, in conjunction with an if-statement that checks if the part is a Sheet Metal part. That way, when the rule is triggered, the if-statement is effectively checking if the part is (or has just become) a sheet metal part. Unfortunately, it will continue to run the Rule on each trigger for as long as the part is still a Sheet Metal part, beyond just when the conversion to sheet metal occurs. But, it is a fairly simple computation and so at this time it is an acceptable alternative for me.

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor
Accepted solution

It's good to hear that you have organized a workable solution to your challenge.

 

FYI:  Even though we can't easily add new custom events to the iLogic Event Triggers dialog (manually or by code), you can, however, work with 'events' in other ways using iLogic, because it is based on VB.NET.

Here is a short list of event categories within Inventor's iLogic.  Each of these names represents an 'Interface' of the Inventor Application, and I've added links to each name so you can view their online help pages.

 

ApplicationEvents

AssemblyEvents

BrowserPanesEvents

CameraEvents
DockableWindowsEvents
DocumentEvents
DrawingEvents
DrawingViewEvents
FileAccessEvents
FileDialogEvents
FileManagerEvents
FileUIEvents
HelpEvents
InteractionEvents
KeyboardEvents
ManipulatorEvents
MeasureEvents
ModelingEvents
MouseEvents
PartEvents
PluginLicenseManagerEvents
PresentationEvents
ReferenceKeyEvents
RepresentationEvents
SearchBoxEvents
SelectEvents
SketchEvents
StyleEvents
TransactionEvents
TriadEvents
UserInputEvents   (you may be interested in this ones "OnActivateCommand" event)

UserInterfaceEvents   (you may be interested in this ones "OnEnvironmentChange" event)
WebBrowserDialogEvents

 

Also, here is a link to a post within my 'contributions' where I create a Windows Form, launch it, and interact with it using events, all from one external iLogic rule, that you may be interested in, because it contains examples of how to use events in iLogic.  There are also other posts within my 'contributions' that show you how to work with the Event Triggers using iLogic.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

If you have time, please... Vote For My IDEAS 💡and Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 6

nate0520
Contributor
Contributor

I had no idea these existed -- I think these will help further refine my solution so it is not frequently running when not needed. (I am still quite new to using VBA/iLogic with Inventor so all new info is very helpful!)

 

Thank you for the additional insight!

0 Likes
Message 6 of 6

A.Acheson
Mentor
Mentor

@nate0520 

 

I had a look at an ilogic template I created and it had the same issues when switching between standard and sheet metal with the extents not updating on part geometry change. 

If you run a  rebuild all it seems to run the part geometry change events trigger and thus updates the extents. You could put rebuild all  in a rule and run before save or put the update extents on a user form see below link .

https://forums.autodesk.com/t5/inventor-forum/how-can-i-make-an-i-logic-rule-that-can-help-me-to-lin...

I also noticed when converting to sheet metal you are prompted to select the base face which then opens the sheet metal defaults. You can either select the use thickness from rule or input thickness value. Be careful as during part conversion the use thickness from rule can get switched off if it was previously selected. 

 

Alternatively if you press esc and bypass the select base face no updates will occur either. Rebuild or run extents rule is required.

 

If you have any other questions let me know.  

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes