- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I would like to access to the detail view B (in green circle). To access "VISTA1", I know that I have to write the come something like..
Dim oDoc As Inventor.DrawingDocument
Dim oViewA As DrawingView
oViewA = oDoc.ActiveSheet.DrawingViews.Item(1)
But I cannot find how to access to a child view of drawing view. Can anyone help me out?
And, in the code below, what's the meaning of "1" in the part "Item(1)"? It sounds stupid but I tried Item(B), Item(2.B) etc etc and obviously didn't work at all....
oViewA = oDoc.ActiveSheet.DrawingViews.Item(1)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If you know the name of the view, you could do this
If ThisApplication.ActiveDocumentType <> kdrawingdocumentobject Then MessageBox.Show("Only works for drawings") Exit Sub End If Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Inventor.Sheet oSheet = oDrawDoc.Sheets.Item(1) Dim oDetailView As DrawingView For Each oView As DrawingView In oSheet.DrawingViews If oView.Name = "B" Then oDetailView = oView End If Next
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here is one way of getting that view.
And by the way, any time your iterating through members of a collection, there are "Item"s. And they are indexed by Integers. Even though, it doesn't say so in the clues, you can also enter a "quoted" string, instead of an Integer, that represents the name of the object (or view in your case).
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOK, "WRONG DOCUMENT TYPE")
Return
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDView As DetailDrawingView
For Each oSheet As Sheet In oDDoc.Sheets
For Each oView As DrawingView In oSheet.DrawingViews
If oView.ViewType = DrawingViewTypeEnum.kDetailDrawingViewType Then
oDView = oView
End If
Next
Next
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report