Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I cant get any of the previous peices of code to work for this application. I would like to place a part file into a drawing, preferably in the center of the page.
I have the below code but it wont allow me to select a specific file because it wont convert the String to a file document.
' Create new drawing document using specified template.
Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "D:\ENG\Custom2022\Templates\Inventor\Standard (mm).dwg", True)
' a reference to the active sheet.
Dim oSheet As Sheet
oSheet = oDrawingDoc.ActiveSheet
' Create a new NameValueMap object.
Dim oBaseViewOptions As NameValueMap
oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap
' the representations to use when creating the base view.
oBaseViewOptions.Add("DesignViewRepresentation", "Default")
oBaseViewOptions.Add("DesignViewAssociative", False)
Dim oModel As Document
oModel = "C:\temp\test1\759500.ipt"
' Create the placement point object.
Dim oHeight As Double
Dim oWidth As Double
oHeight = oSheet.Height
oWidth = oSheet.Width
Dim oPoint As Point2d
oPoint = ThisApplication.TransientGeometry.CreatePoint2d(oWidth / 2, oHeight / 2)
' Create a base view.
Dim oBaseView As DrawingView
oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 1 / 36, kFrontViewOrientation, kHiddenLineRemovedDrawingViewStyle, , , oBaseViewOptions)
Any help would be great.
Solved! Go to Solution.