|
|
|
We’ve continued to
fill in the gaps in the Sheet Metal API. On the RibbonBar screenshot, I’ve
outlined the features we supported up to now in green, and the features we’re
introducing support for in 2010 in red.
|
|
|
|
We’ve got full API
support for the new Unfold and Refold feature – that’s creation, editing and
querying.
|
|
|
|
We’ve added creation
support for Bend, Contour Flange, Corner Chamfer, Corner, Corner Round, and
Hem. Previously these were query only.
|
|
|
|
We have basic
support for the new Contour Roll, Lofted Flange, Rip, and Cosmetic bend
features.
|
|
|
|
In the flat panel,
there’s a new command where you can edit the order of the bend operations.
You can do the same in the API.
|
|
|
|
We have an API
support for equations in unfold rules..
|
|
|
|
And you’ve been able
to model in the flat panel environment for about two releases now. Now you
can do it in the API as well.
|
|
|
|
'/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
'// Use: The Unfold and Refold feature
related calls are new in Inventor 2010
|
|
'//
|
|
'/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
Public Sub FoldPart()
|
|
|
|
' Set a reference to the sheet metal
document.
|
|
' This assumes a part document is
active.
|
|
Dim oPartDoc As PartDocument
|
|
oPartDoc =
_InvApplication.ActiveDocument
|
|
|
|
' Make sure the document is a sheet
metal document.
|
|
If oPartDoc.SubType <>
"{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
|
|
MsgBox("A sheet metal
document must be open.")
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim sheetMetalDef As
SheetMetalComponentDefinition
|
|
sheetMetalDef =
oPartDoc.ComponentDefinition
|
|
|
|
' Look at the face for a planar face
that lies on the X-Y plane.
|
|
Dim face As Face
|
|
Dim baseFace As Face
|
|
baseFace = Nothing
|
|
For Each face In
sheetMetalDef.SurfaceBodies.Item(1).Faces
|
|
If face.SurfaceType =
SurfaceTypeEnum.kPlaneSurface Then
|
|
If
System.Math.Round(face.PointOnFace.Z, 7) = 0 Then
|
|
baseFace = face
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
Dim sheetMetalFeatures As
SheetMetalFeatures
|
|
sheetMetalFeatures =
sheetMetalDef.Features
|
|
|
|
' Check to see if a base found was
found.
|
|
If Not baseFace Is Nothing Then
|
|
|
|
' Unfold all of the bends so the
part is flat.
|
|
Dim unfoldFeature As
UnfoldFeature
|
|
unfoldFeature =
sheetMetalFeatures.UnfoldFeatures.Add(baseFace)
|
|
'MsgBox "Part
unfolded."
|
|
|
|
' Refold each bend, one at a
time.
|
|
Dim i As Integer
|
|
For i = 1 To
sheetMetalDef.Bends.Count
|
|
'MsgBox "Refolding bend
" & i & " of " & sheetMetalDef.bends.count
|
|
|
|
' Add the bend to an
ObjectCollection.
|
|
Dim bends As ObjectCollection
|
|
bends =
_InvApplication.TransientObjects.CreateObjectCollection
|
|
Call
bends.Add(sheetMetalDef.Bends.Item(i))
|
|
|
|
' Create the refold feature.
|
|
Call
sheetMetalFeatures.RefoldFeatures.Add(unfoldFeature.StationaryFace, bends)
|
|
Next
|
|
End If
|
|
|
|
End Sub
|