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: 

Create 3 standard views (front, top, right) using a vba macro

1 REPLY 1
Reply
Message 1 of 2
isocam
1168 Views, 1 Reply

Create 3 standard views (front, top, right) using a vba macro

Does anybody know if I can automatically insert the standards (3rd angle) views using a VBA macro.

 

For example, Top, front & right views

 

Many thanks in advance!!!

 

IsoCAM

1 REPLY 1
Message 2 of 2
Vladimir.Ananyev
in reply to: isocam

You may create drawing views using Sheet.DrawingViews.AddBaseView and Sheet.DrawingViews.AddProjectedView methods.

Оrientation of the model within the base view.is defined by  the input ViewOrientationTypeEnum constant (e.g., kBottomViewOrientation, kTopViewOrientation, etc.).  Orientation of projected view depends on its insertion point position relative to the parent base view.

 

Here is the VB .NET sample:

Public Sub CreateViews()

    Dim oDrawingDoc As DrawingDocument
    oDrawingDoc = _InvApplication.ActiveDocument
    'Open a Part model to create a view for, invisibly
    Dim oPartDoc As PartDocument
    oPartDoc = _InvApplication.Documents.Open("C:\Temp\Part1.ipt", False)

    Dim oTG As TransientGeometry = _InvApplication.TransientGeometry
    Dim oSheet As Sheet = oDrawingDoc.ActiveSheet

    ' Create the base view.
    Dim oFrontView As DrawingView
    oFrontView = oSheet.DrawingViews.AddBaseView(oPartDoc, _
        oTG.CreatePoint2d(35, 20), 1, _
        ViewOrientationTypeEnum.kFrontViewOrientation, _
        DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)

    ' Create projected views.
    Dim oRightView As DrawingView
    oRightView = oSheet.DrawingViews.AddProjectedView(oFrontView,  _
        oTG.CreatePoint2d(15, 20), _
        DrawingViewStyleEnum.kFromBaseDrawingViewStyle)

    Dim oIsoView As DrawingView
    oIsoView = oSheet.DrawingViews.AddProjectedView(oFrontView, _
        oTG.CreatePoint2d(15, 35), _
        DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle)

End Sub

 Inventor API samples on drawing views are located here:

DrawingViews.PNG

Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report