Hello All,
At the request of our production department, I am trying to find a way to modify a flat pattern before it is exported. We are currently exporting the DXF's to a network location with a custom written, external C# program (not an Inventor Add-In yet). Is there a way draw a circle and execute a cut at the highest "Y" value of each bend line end points? I can't seem to locate the correct item to use in the API that matches up with what I see in the Flat Pattern environment using the "Measure" command.
It seems like it should be possible, I just must not see the correct path to proceed down. Thanks in advance.
Solved! Go to Solution.
Solved by frederic.vandenplas. Go to Solution.
Hi,
This vba code does what you want. Run the code select a face where a new sketch should be placed (code will create sketch for you)
after that, it will draw a circle on the Y-max point of a BendEdge, so if a line is horizontal, it will be placed on the endpoint of the projected edge, from thoses circles, the cutfeature will be created in the flatpattern definition
Sub AddCircles() Dim oDoc As PartDocument Set oDoc = ThisApplication.ActiveDocument Dim oDef As SheetMetalComponentDefinition Set oDef = oDoc.ComponentDefinition Dim oFlatPattern As FlatPattern Set oFlatPattern = oDef.FlatPattern oFlatPattern.Edit Dim oFace As Face Set oFace = ThisApplication.CommandManager.Pick(kPartFacePlanarFilter, "Select a planar face") Dim oSketch As Sketch Set oSketch = oFlatPattern.Sketches.Add(oFace) oSketch.Edit Dim oTopFaceBendUpEdges As Edges Set oTopFaceBendUpEdges = oFlatPattern.GetEdgesOfType(kBendUpFlatPatternEdge, True) Dim oTg As TransientGeometry Set oTg = ThisApplication.TransientGeometry Dim oEdge As Edge Dim oProjectedEdge As SketchLine For Each oEdge In oTopFaceBendUpEdges Set oProjectedEdge = oSketch.AddByProjectingEntity(oEdge) If oEdge.Geometry.StartPoint.Y > oEdge.Geometry.EndPoint.Y Then Call oSketch.SketchCircles.AddByCenterRadius(oTg.CreatePoint2d(oProjectedEdge.Geometry.StartPoint.X, oProjectedEdge.Geometry.StartPoint.Y), 0.05) Else Call oSketch.SketchCircles.AddByCenterRadius(oTg.CreatePoint2d(oProjectedEdge.Geometry.EndPoint.X, oProjectedEdge.Geometry.EndPoint.Y), 0.05) End If Next oEdge oSketch.ExitEdit Set oProfile = oSketch.Profiles.AddForSolid Dim oCutDefinition As CutDefinition Set oCutDefinition = oFlatPattern.Features.CutFeatures.CreateCutDefinition(oProfile) Call oCutDefinition.SetThroughAllExtent(kNegativeExtentDirection) Dim oCutFeature As CutFeature Set oCutFeature = oFlatPattern.Features.CutFeatures.Add(oCutDefinition) End Sub