Turn off flat pattern sketch

Turn off flat pattern sketch

Curtis_Waguespack
Consultant Consultant
188 Views
0 Replies
Message 1 of 1

Turn off flat pattern sketch

Curtis_Waguespack
Consultant
Consultant

Quick example of turning flat pattern sketches on/off. Attached file is an Inventor 2024 file.

 

ShowSketch1 = InputRadioBox("Choose sketch to show", "Sketch 1", "Sketch2", booleanParam, Title := "iLogic")

'  a reference to the active document.
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument

'verify document type is sheet metal
If oPartDoc.ComponentDefinition.Type <> 150995200 Then
	MessageBox.Show("File is not a sheet metal part.", "iLogic")
	Exit Sub
End If

Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oPartDoc.ComponentDefinition

' Check to make sure a flat pattern is open.
If Not TypeOf ThisApplication.ActiveEditObject Is FlatPattern Then
	Try
		If oCompDef.HasFlatPattern = False Then
			oCompDef.Unfold
		Else
			oCompDef.FlatPattern.Edit
		End If
	Catch
		MessageBox.Show("Error editing the flat pattern.", "iLogic")

	End Try
End If

'  a reference to the active flat pattern.
Dim oFlatPattern As FlatPattern
oFlatPattern = ThisApplication.ActiveEditObject

 oFlatPattern.Sketches.Item("FP Sketch1").Visible = ShowSketch1
 oFlatPattern.Sketches.Item("FP Sketch2").Visible = not ShowSketch1

 

EESignature

189 Views
0 Replies
Replies (0)