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: 

Flat Pattern Enter & Exit

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
drafter2ZT9Z4
261 Views, 5 Replies

Flat Pattern Enter & Exit

Hello, I am trying to write a rule that uses a true false parameter to enter and exit a flat pattern. Does anyone have any insight on how to do this?

5 REPLIES 5
Message 2 of 6

Hi @drafter2ZT9Z4,

 

This example ( where FlatEditMode  is the true/false parameter) will work sorta... 

 

Dim oSheetDef As SheetMetalComponentDefinition = ThisDoc.Document.ComponentDefinition

If FlatEditMode = True Then
	oSheetDef.FlatPattern.Edit
Else
	oSheetDef.FlatPattern.ExitEdit
End If


The issue is the parameter in the folded model does not exist when the flat pattern is being edited, so there is not a way to change the parameter and trigger the rule while in the flat.

I feel like I've solved this issue in the past, but I can't think of the solution at the moment. Maybe someone else will think of it.

Curtis_Waguespack_1-1722011159165.png

 

Curtis_Waguespack_0-1722011132629.png

 

 

Message 3 of 6

ok I think maybe this was how I did it in the past... add the parameter and the rule to a form. Then the user must change the parameter and push the button to run the rule.

 

Curtis_Waguespack_0-1722012167584.png

 

 

Dim oSheetDef As SheetMetalComponentDefinition = ThisDoc.Document.ComponentDefinition

If Parameter("FlatEditMode") = True  Then
	oSheetDef.FlatPattern.Edit
Else
	oSheetDef.FlatPattern.ExitEdit
End If

 

 

Message 4 of 6

Custom Property?

Message 5 of 6

Or toggle the parameter in the rule via code , and then the user only needs to push the button to toggle to/from the flat pattern

Example model:

Toggle Flat Pattern Edit 2024.ipt 

 

Dim oSheetDef As SheetMetalComponentDefinition = ThisDoc.Document.ComponentDefinition

Parameter("FlatEditMode") = Not Parameter("FlatEditMode")
If Parameter("FlatEditMode") = True  Then
	oSheetDef.FlatPattern.Edit
Else
	oSheetDef.FlatPattern.ExitEdit
End If

InventorVb.DocumentUpdate()

 

Message 6 of 6
WCrihfield
in reply to: Frederick_Law

Just to confirm...Yes, the custom iProperty with Yes/No (Boolean) type value works OK too, as long as the rule is under the 'iProperty Change' event in the Event Triggers dialog on the This Document tab of that part.  I just tried it on one of my sheet metal parts.  The rule gets the FlatPattern object, then checks the value of that custom iProperty.  If it is True then enter into edit mode of the FlatPattern ; if False, exit edit mode.  We can drop that custom iProperty into a simple iLogic Form, and it will look like a drop-down list, with only those two values (Yes / No).  Each time I change its value, the edit mode changes.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

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

Post to forums  

Autodesk Design & Make Report