- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
MY CODE IS BELOW
Try ' Ensure the active document is a PartDocument If TypeOf ThisDoc.Document Is PartDocument Then Dim oPartDoc As PartDocument oPartDoc = TryCast(ThisDoc.Document, PartDocument) If oPartDoc IsNot Nothing Then ' Specify the path to your custom drawing template Dim templatePath As String templatePath = "O:\PROJECT\INVENTOR LIBRARY\07-TEMPLATES\ATS_A3.idw" ' Create a new drawing document using the custom template Dim oDrawingDoc As DrawingDocument oDrawingDoc = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, templatePath) ' Verify if the drawing document is created successfully If oDrawingDoc Is Nothing Then MessageBox.Show("Failed to create the drawing document.") Exit Try End If ' Reference to the first sheet in the drawing Dim oSheet As Sheet oSheet = oDrawingDoc.Sheets.Item(1) ' Define the position for the base view Dim baseViewPosition As Point2d baseViewPosition = ThisApplication.TransientGeometry.CreatePoint2d(10, 10) ' Create base view with correct parameters Dim oBaseView As DrawingView oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc.ComponentDefinition, _ baseViewPosition, 1, _ ViewOrientationTypeEnum.kFrontViewOrientation, _ DrawingViewStyleEnum.kHiddenLineDrawingViewStyle) ' Verify if the base view is created successfully If oBaseView Is Nothing Then MessageBox.Show("Failed to create the base view.") Exit Try End If ' Define the position for the projected views ' (Code for adding projected views...) ' Save the drawing to a specified path Dim savePath As String savePath = "O:\R&D\PRODUCT\CHANGES\030. A-KART WITH ROLLER CONVEYOR\3D DESIGN\OPTION 2\expansion joint related things\part1.idw" oDrawingDoc.SaveAs(savePath, False) MessageBox.Show("Drawing saved successfully at " & savePath) Else MessageBox.Show("Failed to cast active document as PartDocument.") End If Else MessageBox.Show("No active PartDocument found.") End If Catch ex As Exception ' Display the error message MessageBox.Show("An error occurred: " & ex.Message) End Try
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
change this:
oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc, baseViewPosition, 1, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)
Regards,
Arthur Knoors
Autodesk Affiliations:
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: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
oTopView = oSheet.DrawingViews.AddProjectedView(oBaseView, topViewPosition, 1, ViewOrientationTypeEnum.kTopViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)
error in above line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
' Define the position for the base view Dim baseViewPosition As Point2d baseViewPosition = ThisApplication.TransientGeometry.CreatePoint2d(10, 10) Dim topViewPosition As Point2d topViewPosition = ThisApplication.TransientGeometry.CreatePoint2d(20, 10) ' Create base view with correct parameters Dim oBaseView As DrawingView oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc, baseViewPosition, 1, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle) Dim oTopView As DrawingView oTopView = oSheet.DrawingViews.AddProjectedView(oBaseView, topViewPosition , DrawingViewStyleEnum.kHiddenLineDrawingViewStyle,1)
Regards,
Arthur Knoors
Autodesk Affiliations:
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: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report