Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: vpeuvion

Hi @vpeuvion.  I think I have worked out a way that you can use.  Check out the example below, and see if that works for you.

Sub Main
	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
	Dim oSMCD As SheetMetalComponentDefinition = oPartDoc.ComponentDefinition
	Dim oBendsEnum As BendsEnumerator = oSMCD.Bends
	Dim oSMF As SheetMetalFeatures = oSMCD.Features
	Dim oCM As CommandManager = ThisApplication.CommandManager
	
	'get stationary face
	Dim oFace As Face = oCM.Pick(SelectionFilterEnum.kPartFaceFilter,"Sélectionner la face de référence")
	If IsNothing(oFace) Then Return
		
	'get the bend to unfold
	Dim oBendFace As Face = oCM.Pick(SelectionFilterEnum.kPartFaceFilter, "Select Face Of Bend")
	If IsNothing(oBendFace) Then Return
	Dim oBend As Bend
	Try
		'you can get a specific Bend by specifying either Index # or Face object belonging to a Bend
		oBend = oBendsEnum.Item(oBendFace)
	Catch
		MsgBox("Selected Face did not belong to a Bend.", vbExcamation, "")
		Return
	End Try

	'add the Bend to our oBends collection
	Dim oBends As Inventor.ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
	oBends.Add(oBend)
	
	'create the UnfoldFeatrue for just that one Bend
	Dim oUnFoldFeat As UnfoldFeature
	If oBend.IsFlat = False Then
		'MsgBox("Bend is not flat, so we are able to unfold it.",,"")
		oUnFoldFeat = oSMF.UnfoldFeatures.Add(oFace, oBends)
	Else
		'MsgBox("Bend is already flat, so we are NOT able to unfold it.",,"")
	End If
	oPartDoc.Update
	
	MsgBox("Now to refold the bend.",,"")
	're-set contents of oBends using UnfoldFeature we created above
	oBends.Clear
	For Each oB In oUnFoldFeat.Bends
		oBends.Add(oB)
	Next
	oSMF.RefoldFeatures.Add(oFace, oBends)
End Sub

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) :thumbs_up:.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)