Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Edit Flat Pattern Before Export

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
khoskins
458 Views, 2 Replies

Edit Flat Pattern Before Export

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.

Tags (2)
2 REPLIES 2
Message 2 of 3

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

 

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
Message 3 of 3

That is perfect, thanks.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report