Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
vdcrocks7
225 Views, 3 Replies

Add Base view of independent parts of assembly in single new drawing.

Hello all, my aim to place base view of all parts of assembly, I've tried below code and it's working okay to add parts base new, now i need to find out which parts are repetitively used in assembly and not need to add base view of same parts. And I also need to adjust scale and postion of view based on Sheet size.

 

 

 

Dim oAsmDoc As AssemblyDocument 
oAsmDoc = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
Dim oOcc As ComponentOccurrence

	Dim oTPath As String = "C:\Users\Public\Documents\Autodesk\Inventor 2023\Templates\en-US"
	Dim oTName As String = "Standard.idw"
	Dim oTFullFileName As String = System.IO.Path.Combine(oTPath, oTName)
	Dim oDDoc As DrawingDocument = Nothing
	If System.IO.File.Exists(oTFullFileName) Then
		oDDoc = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, oTFullFileName, True)
	Else
		MsgBox("Template Drawing could not be found!", vbCritical, "")
		Exit Sub
	End If	
	
	
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Dim oViews As DrawingViews = oDDoc.ActiveSheet.DrawingViews
	Dim oFullScale As Double = 1/5
	Dim oOriginPoint As Point2d = oTG.CreatePoint2d(0, 0)
	
	
	
	For Each oOcc In oDef.Occurrences
		Dim oOccDoc As Document = oOcc.Definition.Document
			Dim oBaseView As DrawingView = oViews.AddBaseView(oOccDoc, oOriginPoint, oFullScale, _
		kBottomViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)
	
	Next
Tags (1)