Accessing DetailDrawingView Object

Accessing DetailDrawingView Object

dustinbagley
Advocate Advocate
307 Views
2 Replies
Message 1 of 3

Accessing DetailDrawingView Object

dustinbagley
Advocate
Advocate
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Dim oView As DrawingView
Dim oDetailView As DetailDrawingView

For Each oSheet In oDrawDoc.Sheets
	For each oView in oSheet.DrawingViews
		For Each oDetailView In oView.DetailDrawingViews
			oDetailView.FenceRadius = 3
		Next
	Next
Next

I'm trying to write to 'Fence Radius' however, its telling me
that DetailDrawingView is not found in DrawingView despite the fact
that it is listed as such in API help.

dustinbagley_0-1678316880624.png

 

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

lmc.engineering
Advocate
Advocate
Accepted solution

Hi @dustinbagley 

 

The DrawingView object is not the parent of DetailDrawingView, DetailDrawingView merely inherits members of the DrawingView class. You can see it says 'Derived' as oppose to 'Parent' in the help pages. In your rule, if you type "oView." then let intellisense show you the members, then repeat for "oDetailView.", you'll see the same members across both.. These are the derived/inherited members.

 

When you are looping through the drawing views, the DetailDrawingView is a DrawingView, so you need to test if that drawing view is of the type DetailDrawingView, as below:

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Dim oView As DrawingView
Dim oDetailView As DetailDrawingView

For Each oSheet In oDrawDoc.Sheets
	For Each oView In oSheet.DrawingViews
		If TypeOf oView Is DetailDrawingView Then
			oDetailView = CType(oView, DetailDrawingView)
			oDetailView.FenceRadius = 3
		End If
	Next
Next

Hope that helps.

Message 3 of 3

dustinbagley
Advocate
Advocate
Accepted solution

Great, thank you for you help.

0 Likes