I have 2 screens on my computer. When I deploy SolidWorks on these 2 screens, I always have separate elements on the 2, never a straddle display. But if for example I have an assembly on the left screen, I point to one of its parts and I open it, it appears on the 2 screens, and I have to go and "tell" it on which screen to display. It's very painful to remain polite, since you have to do the manipulation every time you open a file.
So the question is the following: can we tell it to open automatically on one of the 2 screens (left or right), or even that it opens directly in the screen where I was?
I'm on SW13
Thanks in advance
PS: I would prefer a real answer than internet links or tutorials. Unless you can't cut it! Thank you for your understanding. :)
FYI, do you know that there are two small buttons at the top right of each active SolidWorks window (next to the cross to close), to switch this window directly to the right or left?
@XabiB I don't see what difference it makes to press Alt? Can you tell me more?
I'm trying macros in parallel, I haven't learned them, but it doesn't work great :/ It only partially shifts the window. Maybe it's also due to the fact that I have 2 screens of different sizes and resolutions ?
Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _ Application.SldWorks
Set Part = swApp.ActiveDoc Set Part = swApp.ActiveDoc Dim myModelView As Object Set myModelView = Part.ActiveView myModelView.FrameLeft = 3 myModelView.FrameTop = 24 Set myModelView = Part.ActiveView myModelView.FrameState = swWindowState_e.swWindowNormal End Sub
I'm not particularly comfortable on the subject, it's been a few years since I've eaten mackerel, and it was in Excel! :)
To answer your question, I just tested and in the end it only changes the position and the size of the window towards the chosen screen (according to mosaic click)...
So useless for you, especially if you have 20 files to reposition ;-)
So I did go through macros (thank you for your help @Lucas). In this case 2: Left.swp and Right.swp. My left screen being the main and largest, the left the secondary, smaller and 4/3 format.
So I'll give you the code + the macros in attached files
Left.swp
Dim swApp As Object
Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _ Application.SldWorks
Set Part = swApp.ActiveDoc Set Part = swApp.ActiveDoc Dim myModelView As Object Set myModelView = Part.ActiveView myModelView.FrameLeft = 0 'Wedge the window upstairs myModelView.FrameTop = 0 'Wedge the window on the left myModelView.FrameWidth = 1910 The width of the window, to be adjusted according to the resolution of the left screen myModelView.FrameHeight = 855 The height of the window, to be adjusted according to the resolution of the left screen Set myModelView = Part.ActiveView myModelView.FrameState = swWindowState_e.swWindowNormal End Sub
and Right.swp
Dim swApp As Object
Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _ Application.SldWorks
Set Part = swApp.ActiveDoc Set Part = swApp.ActiveDoc Dim myModelView As Object Set myModelView = Part.ActiveView myModelView.FrameLeft = 1912 'Wedge the window upstairs myModelView.FrameTop = 0 'Wedge the window on the left myModelView.FrameWidth = 1273 The width of the window, to be adjusted according to the resolution of the left screen myModelView.FrameHeight = 855 The height of the window, to be adjusted according to the resolution of the left screen Set myModelView = Part.ActiveView myModelView.FrameState = swWindowState_e.swWindowNormal End Sub
After that, it's a question of point of view, but my partial answer gives exactly the answer that someone who makes a macro would want. Your macro won't work on my PC for example because I don't have the same screens.
I'm in favor of people trying to do their own macros and I don't like to chew up the work!
VBA is very powerful and very useful for many software! So it's very good to get started, but having a ready-made code is not going to help you write your own macros!
But hey, I'll know for your next questions about macros that I won't take the time to answer them!
I wouldn't see it like that: we help people, and there's a system to reward those who have invested the most. It's an interesting plus. But why would I take time knowing that I will never write a full macro, because I think that's not helping people!