Flat Pattern Enter & Exit

Flat Pattern Enter & Exit

drafter2ZT9Z4
Enthusiast Enthusiast
452 Views
5 Replies
Message 1 of 6

Flat Pattern Enter & Exit

drafter2ZT9Z4
Enthusiast
Enthusiast

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
Accepted solutions (1)
453 Views
5 Replies
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

 

 

EESignature

0 Likes
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

 

 

EESignature

0 Likes
Message 4 of 6

Frederick_Law
Mentor
Mentor

Custom Property?

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

 

EESignature

0 Likes
Message 6 of 6

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