Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello.
I'm trying to use ContourFlangeFeature in a SheetMetal Multi-Body Part. But i don't know how to set the action as a New Solid.
Sub Main()
Dim oApp = ThisApplication
Dim part As PartDocument = ThisDoc.Document
Dim partDef = part.ComponentDefinition
Dim bodies = partDef.SurfaceBodies
For Each body As SurfaceBody In bodies
Dim edges = body.Edges
For Each oEdge As Edge In edges
Dim length = oApp.MeasureTools.GetMinimumDistance(oEdge.StartVertex, oEdge.StopVertex)
'MessageBox.Show("Message: " & length, "Title")
Dim wp As WorkPlane
Dim oWkPoint As WorkPoint
oWkPoint = part.ComponentDefinition.WorkPoints.AddFixed(oEdge.Geometry.MidPoint)
wp = part.ComponentDefinition.WorkPlanes.AddByNormalToCurve(oEdge, oWkPoint)
Dim oPlane1 = partDef.WorkPlanes.AddByPlaneAndOffset(oEdge.Faces.Item(1), 0)
Dim oPlane2 = partDef.WorkPlanes.AddByPlaneAndOffset(oEdge.Faces.Item(2), 0)
Dim oSketch As Sketch
oSketch = partDef.Sketches.Add(wp)
Dim sEntity1 = oSketch.AddByProjectingEntity(oPlane1)
sEntity1.Construction = True
Dim sEntity2 = oSketch.AddByProjectingEntity(oPlane2)
sEntity2.Construction = True
oPlane1.Visible = False
oPlane2.Visible = False
Dim point1 = ThisApplication.TransientGeometry.CreatePoint2d(1, 0)
Dim center = oSketch.AddByProjectingEntity(oWkPoint)
Dim profileLine1 = oSketch.SketchLines.AddByTwoPoints(center, point1)
oSketch.GeometricConstraints.AddCollinear(sEntity1, profileLine1)
Dim point2 = ThisApplication.TransientGeometry.CreatePoint2d(-1, 0)
Dim profileLine2 = oSketch.SketchLines.AddByTwoPoints(center, point2)
oSketch.GeometricConstraints.AddCollinear(sEntity2, profileLine2)
oSketch.GeometricConstraints.AddEqualLength (profileLine1, profileLine2)
' Create a path.
Dim oPath As Path
oPath = partDef.Features.CreatePath(profileLine1)
Dim oContourFlangeFeatures As ContourFlangeFeatures
oContourFlangeFeatures = partDef.Features.ContourFlangeFeatures
' Create the flange definition.
Dim cfDef As ContourFlangeDefinition
cfDef = oContourFlangeFeatures.CreateContourFlangeDefinition(oPath)
'set the distance extent
Call cfDef.SetDistanceExtent(length, PartFeatureExtentDirectionEnum.kSymmetricExtentDirection)
Dim oCF As ContourFlangeFeature
oCF = oContourFlangeFeatures.Add(cfDef)
Next
Exit For
Next
End Sub
Thank you for any help!
Solved! Go to Solution.