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: 

Flatpattern orientation for drawings automation

2 REPLIES 2
Reply
Message 1 of 3
HermJan.Otterman
427 Views, 2 Replies

Flatpattern orientation for drawings automation

I want to create a drawing with a view of the folded model and a view of the flatpattern of the same sheetmetal part.

the problem with this is that the flatpattern is flipt compared to the model view.

To get this rigth you have to manipulate the flat pattern in the 3D model, but my question is can it be done in the drawing with VB.net,

is there a way, with VB, to compair the orientation, maybe X,Y and Z, from the flatpattern to the part? so you know how to flip or rotate the flatpattern, so it matches the model view orientation?

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


2 REPLIES 2
Message 2 of 3

This functionality was added in the Inventor 2015:

http://modthemachine.typepad.com/my_weblog/2014/04/inventor-2015-api-enhancements.html

 

Here is the VBA sample:

Public Sub SheetMetalOrientFlat()
    Dim partDoc As PartDocument
    Set partDoc = ThisApplication.ActiveDocument
    
    Dim smDef As SheetMetalComponentDefinition
    Set smDef = partDoc.ComponentDefinition
    
    If Not smDef.HasFlatPattern Then
        smDef.Unfold
    End If
    
    Dim orientation As FlatPatternOrientation
    Set orientation = smDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Copy("New Orientation")
    
    ' Find an linear edge that lies along the flattened plane.
    Dim flatEdge As Edge
    Dim tempEdge As Edge
    For Each tempEdge In smDef.FlatPattern.Body.Edges
        If tempEdge.GeometryType = kLineSegmentCurve Then
            If Abs(tempEdge.StartVertex.Point.Z - tempEdge.StopVertex.Point.Z) < 0.0001 Then
                Set flatEdge = tempEdge
                Exit For
            End If
        End If
    Next
    
    orientation.Activate
    orientation.AlignmentRotation.Expression = "30 deg"
    orientation.AlignmentAxis = flatEdge
End Sub

 cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

Thanks Vladimir,

 

I'm still working on 2014, but will install 2015 soon, then I will try your solution.

thanks again!

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


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

Post to forums  

Autodesk Design & Make Report