Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
vdcrocks7
in reply to: vdcrocks7

@A.Acheson Thank you for Solution, yes, I've updated my code to References document, and now it's only placed base view of unique parts only, could you please help me more on that as I described earlier, I'm interested to place view, so it'll not overlap as well control scale based on Sheet size.

 Please find my updated code below : 

 

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)
		
		
			Dim oRefDocs As DocumentsEnumerator
		    oRefDocs = oAsmDoc.AllReferencedDocuments
		
		    ' Iterate through the list of documents.
		    Dim oRefDoc As Document
		    For Each oRefDoc In oRefDocs
					
			Dim oBaseView As DrawingView = oViews.AddBaseView(oRefDoc, oOriginPoint, oFullScale, _
			kBottomViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)
		Next