Error in creating view representation drawing.

shizahkhalid
Contributor

Error in creating view representation drawing.

shizahkhalid
Contributor
Contributor

Hello, 

Can someone please tell me what the error is in the following iLogic rule?

 

Sub Main()

Dim oActiveDoc As Document
oActiveDoc = ThisApplication.ActiveDocument

Dim oDrgDoc As DrawingDocument = ThisApplication.Documents.Add(kDrawingDocumentObject)
Dim oSheet As Sheet
oSheet = oDrgDoc.Sheets.Item(1)
oSheet.Name = oActiveDoc.DisplayName

Dim oPoint1 As Point2d
    oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d((oSheet.Width / 1.5)+5, oSheet.Height/2)

Dim oView1 As DrawingView
    oView1 = oSheet.DrawingViews.AddBaseView(oActiveDoc, oPoint1, 1/5, kCurrentViewOrientation, kShadedDrawingViewStyle, "", "", "BRACING DETAIL")

End Sub

 

I am getting these errors:

shizahkhalid_0-1722344853835.png

Thank you.

shizahkhalid_1-1722344881072.png

 

0 Likes
Reply
Accepted solutions (1)
185 Views
1 Reply
Reply (1)

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @shizahkhalid, try this version

 

Dim oActiveDoc As Document
oActiveDoc = ThisApplication.ActiveDocument

Dim oDrgDoc As DrawingDocument = ThisApplication.Documents.Add(kDrawingDocumentObject)
Dim oSheet As Sheet
oSheet = oDrgDoc.Sheets.Item(1)
oSheet.Name = oActiveDoc.DisplayName

Dim oViewOptions As NameValueMap
oViewOptions = ThisApplication.TransientObjects.CreateNameValueMap
oViewOptions.Add("DesignViewRepresentation", "BRACING DETAIL")
oViewOptions.Add("DesignViewAssociative", True)

Dim oPoint1 As Point2d
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d((oSheet.Width / 1.5) + 5, oSheet.Height / 2)

Dim oView1 As DrawingView
oView1 = oSheet.DrawingViews.AddBaseView(oActiveDoc, oPoint1, 1 / 5,
	ViewOrientationTypeEnum.kCurrentViewOrientation,
	DrawingViewStyleEnum.kShadedDrawingViewStyle,,,oViewOptions)

 

Related link:

https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=DrawingViews_AddBaseView