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?
Solved! Go to Solution.
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?
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
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.
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.
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.
Dim oSheetDef As SheetMetalComponentDefinition = ThisDoc.Document.ComponentDefinition If Parameter("FlatEditMode") = True Then oSheetDef.FlatPattern.Edit Else oSheetDef.FlatPattern.ExitEdit End If
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.
Dim oSheetDef As SheetMetalComponentDefinition = ThisDoc.Document.ComponentDefinition If Parameter("FlatEditMode") = True Then oSheetDef.FlatPattern.Edit Else oSheetDef.FlatPattern.ExitEdit End If
Custom Property?
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()
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()
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
(Not an Autodesk Employee)
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
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.