Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to extract the view index from a for each of drawing views.

1 REPLY 1
Reply
Message 1 of 2
PeopleInstance
228 Views, 1 Reply

Trying to extract the view index from a for each of drawing views.

I'm trying to cycle through all of the drawing views in an IDW, grab both the elevation and bottom view (there are many of each), and push those into a Call to another Sub. The two views will always be aligned vertically, and the index numbers of each pair of views are always one number off (The first pair have item indices of 1 and 2 respectively). Is this possible? I'm still trying different approches to this problem, but can't seem to find where the index value for each Item in ThisApplication.ActiveDocument.ActiveSheet.DrawingViews can be found. Either that or reference one from the other, and then assign the referenced one to a DrawingView instance. Here's a little of what I'm playing with:

 

Dim oDraw As DrawingDocument
Set oDraw = ThisApplication.ActiveDocument
Dim oSheet As sheet
Set oSheet = oDraw.ActiveSheet


Dim oView As DrawingView

Dim oBottomView As DrawingView

Dim oChartSize As Double

 

Dim oPoint As Point2d
Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(0, 0)

Dim oView As DrawingView
For Each oView In oSheet.DrawingViews
If oView.Name = "ELEVATION VIEW" Then
(INSERT AMAZING, WONDERFUL CODE HERE)
Call ScaleViews(oView, oBottomView, oChartSize, oPoint, oSheet)
End If
Next

 

 

 

Thanks,
Mike

1 REPLY 1
Message 2 of 2

I think I figured out a way to do this. It's not rock solid, but I think it will work until I can find a better way:

 

Dim oDraw As DrawingDocument
Set oDraw = ThisApplication.ActiveDocument
Dim oSheet As sheet
Set oSheet = oDraw.ActiveSheet

Dim oView As DrawingView
Dim oBottomView As DrawingView
Dim oChartSize As Double

Dim oPoint As Point2d
Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(0, 0)

 

Dim oElevationView As DrawingView
Dim oBottomView As DrawingView


For i = 1 To oSheet.DrawingViews.Count
Set oElevationView = oSheet.DrawingViews.Item(i)
If oElevationView.Name = "ELEVATION VIEW" Then
Set oBottomView = oSheet.DrawingViews.Item(i + 1)
If oBottomView.Name = "BOTTOM VIEW" Then
Call ScaleViews(oElevationView, oBottomView, oChartSize, oPoint, oSheet)
Else
uselessVariable = MsgBox("Cannot find related BOTTOM VIEW", vbOKOnly, "Error!")
End If
End If
Next

 

I guess taking the time to formulate my thoughts into a post was enough to get my brain back to "normal". Yea!

 

If anyone has any other thoughts, I am always interested in other approaches!

Mike

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report