Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello together,
is there a way to store the position, zoom and size of all open windows?
Thank you
Georg
Solved! Go to Solution.
Hello together,
is there a way to store the position, zoom and size of all open windows?
Thank you
Georg
Solved! Go to Solution.
HI!
Automatically no, there's no tool to do all that all at once, but...
To have the same zoom, you can create Representations Views with a defined position and Zoom.
To Have all the windows with the same size, go to View panel and select Tile All, or TIle Horizontal/Vertical
Hi Georg,
You can get the size and location of windows using the Views of the Application:
Public Sub Views_Test()
Dim oViews As Views
Set oViews = ThisApplication.Views
Dim oView As View
For Each oView In oViews
Debug.Print oView.Caption
Dim Top As Long
Dim Left As Long
Dim Height As Long
Dim Width As Long
Call oView.GetWindowExtents(Top, Left, Height, Width)
Debug.Print Top
Debug.Print Left
Debug.Print Height
Debug.Print Width
Next
End Sub
You could store and retrieve the data in each document using attributes. See this topic in the API help:
Inventor API User's Manual > Custom Data > Working with Attributes
Thanks,
Wayne
Hello Wayne,
thanks for your help. I tried it. Why is the new form smaller when I use the values for top, left, height and width?
Georg
Hi Georg,
Yes I see the behavior. However in my tests I see height and width increasing in size by 4 each time I run the code.
Instead of using GetWindowExtents just get the values directly. This kept the sizes the same in my test. (loops 10 times to test)
Public Sub Views_Test2() Dim oActView As View Set oActView = ThisApplication.ActiveView Dim oViews As Views Set oViews = ThisApplication.Views Dim oView As View Dim i As Integer For i = 0 To 10 For Each oView In oViews Debug.Print oView.Caption Dim Top As Long Top = oView.Top Dim Left As Long Left = oView.Left Dim Height As Long Height = oView.Height Dim Width As Long Width = oView.Width Debug.Print Top oView.Top = Top Debug.Print Left oView.Left = Left Debug.Print Height oView.Height = Height Debug.Print Width oView.Width = Width Next Next i End Sub
Thanks,
Wayne