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
337 Views, 5 Replies

Flat Pattern Enter & Exit

drafter2ZT9Z4
Contributor
Contributor

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?

0 Likes

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

Curtis_Waguespack
Consultant
Consultant

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

 

 

0 Likes

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

Curtis_Waguespack
Consultant
Consultant

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

 

 

0 Likes

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

Frederick_Law
Mentor
Mentor

Custom Property?

0 Likes

Custom Property?

Message 5 of 6

Curtis_Waguespack
Consultant
Consultant
Accepted solution

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()

 

0 Likes

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

WCrihfield
Mentor
Mentor

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)

0 Likes

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