How to add a baseview to a drawing

How to add a baseview to a drawing

leebrg
Contributor Contributor
389 Views
2 Replies
Message 1 of 3

How to add a baseview to a drawing

leebrg
Contributor
Contributor

Hello,

I wrote a code to open a drawing and add a view using i-logic code.
The code is as follows, and when I run the rule, an error occurs saying that the parameters are wrong, and the view is not created.

Can someone help me solve this problem?

 

        Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
	Dim docName As String = ThisDoc.FileName
	Dim oSheet As Inventor.Sheet = oDoc.ActiveSheet
	
	Dim modelpath As String = "C:\Temp\CYLINDER.iam"
	Dim oModel As Document = ThisApplication.Documents.Open(modelpath, False)
	
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Dim point As Point2d = oTG.CreatePoint2d(50, 50)
	Dim scale As Double = 1
	Dim oBaseView As DrawingView
	oBaseView = oSheet.DrawingViews.AddBaseView(oModel, point, scale, ViewOrientationTypeEnum.kTopViewOrientation, DrawingViewStyleEnum.kFromBaseDrawingViewStyl 

 

0 Likes
Accepted solutions (1)
390 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

@leebrg , the ViewStyleEnum for a base view can not be set to kFromBaseDrawingViewStyle, as that is trying to pull the style from the base view from which the view being added is based on. Since you're adding a base view, it will not be based on any other view. See this version that sets the style to no hidden lines.

 

Hope this helps,

Curtis

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim docName As String = ThisDoc.FileName
Dim oSheet As Inventor.Sheet = oDoc.ActiveSheet

Dim modelpath As String = "C:\Temp\CYLINDER.iam"
Dim oModel As Document = ThisApplication.Documents.Open(modelpath, False)

Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim point As Point2d = oTG.CreatePoint2d(50, 50)
Dim scale As Double = 1
Dim oBaseView As DrawingView
oBaseView = oSheet.DrawingViews.AddBaseView(oModel, point, scale,
	ViewOrientationTypeEnum.kTopViewOrientation,
	DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle)

 

EESignature

0 Likes
Message 3 of 3

leebrg
Contributor
Contributor
Thank you so much for your help.!!