Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disable error resulting from a component not yet placed when rule runs

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Welbilt_Designer_3
270 Views, 3 Replies

Disable error resulting from a component not yet placed when rule runs

I have a rule to link parameters from components within an assembly to a set of master parameters.

The idea is to be able to manipulate multiple components from one place, what i am calling the master parameters. this all works great once the assembly is complete.

The problem i have is that the company i work for has an automated design program that puts the assembly together and places it into a larger assembly for us and we just tweak it to match the customers requirements. This is a great setup but the rule runs during configuration before all of the referenced parts have been placed and produces an error message that requires user input. Since the automation program doesn't know what to do with the error message it just stops.

What i want to do is find a way to prevent the error message from appearing so the automation program can continue to completion since the rule works fine once all of the parts are placed. 

 

The rule simply updates the parameters from the parts to the master parameters:

FrameWidth = Parameter("Frame.ipt:1", "FrameWidth")
FrameHeight = Parameter("Frame.ipt:1", "FrameHeight")
PlugWidth = Parameter("Frame.ipt:1", "PlugWidth")
PlugHeight = Parameter("Frame.ipt:1", "PlugHeight")
OffsetDistance = Parameter("Frame.ipt:1", "OffsetDistance")
Offset_Check_L = (FrameWidth - PlugWidth) /2 + (OffsetDistance - 0.125 in )  
Offset_Check_R = (FrameWidth - PlugWidth) /2 - (OffsetDistance + 0.125 in )
FloorApplication = Parameter("Frame.ipt:1", "FloorApplication")

As you can see the rule references a plug and frame, the program places the frame, saves its progress then adds the plug and saves again and so on. The rule runs before the plug is added resulting in a "component not found" error. 

Is there any way to catch the error before it produces the message box and stop the rule from running or just move past it? 

I want to tell it to ignore the error and move on.

3 REPLIES 3
Message 2 of 4

Hi @Welbilt_Designer_3.  The first think that comes to mind in that situation is to include the use of Try...Catch blocks around each line, with either nothing in the Catch side, or only a Logger.Error() type line on the Catch side.  In the example below, I am using the colon symbol to condense ":" what would naturally be multiped lines of code into one line, to keep it all short, and I am not putting anything in the Catch side of any of them.  If any line fails, it will continue to try doing the next line, without showing any error messages (normally).


Try : FrameWidth = Parameter("Frame.ipt:1", "FrameWidth") : Catch : End Try
Try : FrameHeight = Parameter("Frame.ipt:1", "FrameHeight") : Catch : End Try
Try : PlugWidth = Parameter("Frame.ipt:1", "PlugWidth") : Catch : End Try
Try : PlugHeight = Parameter("Frame.ipt:1", "PlugHeight") : Catch : End Try
Try : OffsetDistance = Parameter("Frame.ipt:1", "OffsetDistance") : Catch : End Try
Try : Offset_Check_L = (FrameWidth - PlugWidth) /2 + (OffsetDistance - 0.125 in ) : Catch : End Try
Try : Offset_Check_R = (FrameWidth - PlugWidth) /2 - (OffsetDistance + 0.125 in ) : Catch : End Try
Try : FloorApplication = Parameter("Frame.ipt:1", "FloorApplication") : Catch : End Try

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

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4

Thanks for the reply, testing now.
Message 4 of 4

Sorry for the late reply, the configuration server used for testing was hijacked for another project so testing was delayed.
This solution was exactly what was needed for our application. Thank You.

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

Post to forums  

Autodesk Design & Make Report