Create Drawing View for Each Model's View Design Representation

Create Drawing View for Each Model's View Design Representation

ngdnam88
Advocate Advocate
434 Views
1 Reply
Message 1 of 2

Create Drawing View for Each Model's View Design Representation

ngdnam88
Advocate
Advocate

Dears,

I'm trying create/add more views in drawing for all Model's View Design Representation create in this post: https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/create-view-design-representation-fo...

Could you please help me how to control Representation View when add base view to drawing?

ngnam1988_0-1690676875467.png

 

Thanks!

0 Likes
Accepted solutions (1)
435 Views
1 Reply
Reply (1)
Message 2 of 2

JelteDeJong
Mentor
Mentor
Accepted solution

maybe this is some help to you:

' Lots of variable that can be set:
Dim startPositionX = 0
Dim positionY = 0
Dim viewOrientationType As ViewOrientationTypeEnum = ViewOrientationTypeEnum.kFrontViewOrientation
Dim drawingViewStyle As DrawingViewStyleEnum = DrawingViewStyleEnum.kShadedDrawingViewStyle
Dim scale = 1.0

If (ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject) Then
    MsgBox("This only works if you opend a drawing document")
    Return
End If
Dim oTr = ThisApplication.TransientGeometry

Dim dialog As Inventor.FileDialog
ThisApplication.CreateFileDialog(dialog)
dialog.Filter = "Inventor Files (*.iam;*.ipt)|*.iam;*.ipt|All Files (*.*)|*.*"
dialog.FilterIndex = 1
dialog.ShowOpen()

Dim modelDoc = ThisApplication.Documents.Open(dialog.FileName)
Dim modelDef = modelDoc.ComponentDefinition

Dim doc As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = doc.ActiveSheet

Dim x = startPositionX
For Each item As DesignViewRepresentation In modelDef.RepresentationsManager.DesignViewRepresentations
    Dim nameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
    nameValueMap.Add("DesignViewRepresentation", item.Name)

    Dim p As Point2d = oTr.CreatePoint2d(x, positionY)
    Dim view As DrawingView = sheet.DrawingViews.AddBaseView(modelDoc, p, scale,
                    viewOrientationType, drawingViewStyle,,, nameValueMap)

    x = x + view.Width
Next

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes