Drawing View Selection

Drawing View Selection

odilon_b87
Explorer Explorer
586 Views
2 Replies
Message 1 of 3

Drawing View Selection

odilon_b87
Explorer
Explorer

Hello,

 

I have written a little code that places 3 drawing views of a part onto a sheet and positions them relative to one another. Is there a way to automatically select these 3 views (oViewB, oViewR, oViewT) so I can quickly move them into place manually. Also is there a way to move the projected views accordingly when the scale is changed?

 

Public Class Form1

Dim invApp As Inventor.Application
Dim oDoc As DrawingDocument
Dim oSheet As Sheet
Dim oModel As PartDocument
Dim oTG As TransientGeometry
Dim oViewOrientationB As ViewOrientationTypeEnum

Dim oViewB As DrawingView
Dim oViewR As DrawingView
Dim oViewT As DrawingView

Public Sub New()
' This call is required by the designer.
InitializeComponent()
Try
invApp = Marshal.GetActiveObject("Inventor.Application")
Catch ex As Exception
MsgBox("There is no active session, please open a DWG file.")
End Try
End Sub

 

Private Sub BTN_PFC_Click(sender As Object, e As EventArgs) Handles BTN_PFC.Click

' Open the part document invisibly
oModel = invApp.Documents.Open("C:\PART1.ipt", False)
' Create the view orientation of object.
oViewOrientationB = ViewOrientationTypeEnum.kLeftViewOrientation
PlaceView()

End Sub

 

Public Sub PlaceView()

' Set a reference to the drawing document.
' This assumes a drawing document is active.
oDoc = invApp.ActiveDocument
'Set a reference to the active sheet.
oSheet = oDoc.ActiveSheet
oTG = invApp.TransientGeometry
Dim XPos As Integer = 21
Dim YPos As Integer = 15

Dim oPointB As Point2d
Dim oPointLBL As Point2d
Dim oViewStyleB As DrawingViewStyleEnum


' Base View
' Create the placement point of object and label.
oPointB = oTG.CreatePoint2d(XPos, YPos)
' Create the view style of object.
oViewStyleB = DrawingViewStyleEnum.kHiddenLineDrawingViewStyle
' Create a base view.
' Rotate BaseView
oViewB = oSheet.DrawingViews.AddBaseView(oModel, oPointB, 0.1, oViewOrientationB, oViewStyleB, "Default")
oViewB.RotateByAngle(270 * (Math.PI / 180), True)
oPointLBL = oTG.CreatePoint2d(XPos, YPos - (oViewB.Height / 2) - 0.75)
oViewB.Label.Position = oPointLBL

Dim oPointR As Point2d
' Right View
' Create the placement point of object with orientation.
oPointR = oTG.CreatePoint2d(XPos + oViewB.Width / 2 + 2, YPos)
oViewR = oSheet.DrawingViews.AddProjectedView(oViewB, oPointR, ViewStyle:=DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)

Dim oPointT As Point2d
' Top View
' Create the placement point of object with orientation.
oPointT = oTG.CreatePoint2d(XPos, YPos + oViewB.Height / 2 + 2)
oViewT = oSheet.DrawingViews.AddProjectedView(oViewB, oPointT, ViewStyle:=DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)

 

End Sub

0 Likes
587 Views
2 Replies
Replies (2)
Message 2 of 3

odilon_b87
Explorer
Explorer
I have tried using:
oDoc.SelectSet.Select(oViewB)
oDoc.SelectSet.Select(oViewR)
oDoc.SelectSet.Select(oViewT)

But as soon as I try to move the drawings together, it only moves the one that the mouse cursor has clicked over and leaves the other 2 views stationary.
0 Likes
Message 3 of 3

bradeneuropeArthur
Mentor
Mentor

I see the same behavior too, that is why I posted not my solution.

I will have a further look how to solve this!

 

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes