Dual-screen display management on SW

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. :)

1 Like

Hello

 

Same problem, I couldn't find a solution!

 

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?

2 Likes

Like Lucas with the bi-screen since SW2013 there are management icons next to the file closing cross. Maybe that's where we should look.

 

@+

1 Like

And by 2 macros? One to send to the left and the other to the right. Do you think there is a way? Coupling that with a keyboard shortcut...

1 Like

From what I just read, you have to play on the alt key and the mosaic icon

To arrange a tiled document window on the screen :

  •  Press Alt + click Tile on the left  Tile on the right  Tile at the top  , or Tile at the bottom   in the title bar of the document window.

But it's not an easy thing :-| 

1 Like

@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 ?

2 Likes

Maybe it's possible with a macro, but I'm not sure because it's a bit of a "special" button.

You can try to record a macro by training, and during the recording, click only on the button (try once right and once left):

http://help.solidworks.com/2013/french/SolidWorks/sldworks/c_recording_playing_macros.htm

And look at the code.

1 Like

A priori you should use (according to the VBA APIs):

swApp.ArrangeWindows 1

   ' 0 = Cascade

       ' 1 = Tile horizontally

       ' 2 = Tile vertically

http://help.solidworks.com/2012/English/api/sldworksapi/Create_and_Arrange_Windows_Example_VB.htm

The code I get is the following:

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 = 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! :)

2 Likes

Okay, so you can control the position and size 

myModelView.FrameHeight = 500

Window height

myModelView.FrameLeft = 100

'distance from the left
myModelView.FrameState = swWindowNormal

'not to be used in your case I think
myModelView.FrameTop = 100

'Distance from the top
myModelView.FrameWidth = 500

Window width 

See this link:

http://help.solidworks.com/2012/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISldWorks~FrameState.html

1 Like

See this link which gives some interesting leads including a macro:

https://forum.solidworks.com/message/202935

 

 

1 Like

@Benoit.LF

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 ;-)

Good!

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

Thereupon, I assigned a keyboard shortcut for each: G for Left (instead of the fabulous SW magnifying glass !!)  and D for Right following the help http://help.solidworks.com/2012/French/SolidWorks/sldworks/t_assigning_macro_keyboard_shortcut.htm


macro_affichage_gauche_droite.zip
2 Likes

Note: if all other open files are minimized, you can simply make a tile! And assign it to a keyboard shortcut!

1 Like

@Lucas, it doesn't work as desired, in the example I gave in the question, the mosaic is done on the screen where the assembly is!

 

But I do already have shortcuts to make horizontal or vertical mosaics (H and V).

2 Likes

Do you know that when you choose one of your answers, you don't earn any points? ;-)

I think my answer below answered the question: it contains all the

information needed to control the window and moreover your macro is specific

to your resolution, so don't go help a lot of people!

But thank you anyway for the 4 points of +1!

Okay, so you can control the position and size 

myModelView. FrameHeight = 500

Window height

myModelView. FrameLeft = 100

'distance from the left
myModelView. FrameState = swWindowNormal

'not to be used in your case I think
myModelView. FrameTop = 100

'Distance from the top
myModelView. FrameWidth = 500

Window width 

See this link:

http://help.solidworks.com/2012/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISldWorks~FrameState.html

 

 

 

 

@Lucas, I suspected that this would make you react: Attached is the conversation I had with @Clémentine on this subject.

For me your message was a lead, very useful by the way, but not a complete answer.

 

A word to the wise!


screenshot462.jpg
2 Likes

No worries, and I learned something!

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!

A word to the wise!

You can take it like that. At least we know why you're here: the hunt for points! Mutual aid and exchange take a back seat!

2 Likes

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!