From: SolidWorks Nut on 19 Dec 2007 12:10 Is there a way to get the "Frame" dimensions of the SolidWorks application? That is, the working area where its windows are tiled? For example, I can get a Model's window position and dimensions (FrameLeft, FrameTop, FrameWidth, FrameHeight), but how can I get the total width and total height available for it to "fit" in the SW application (as if it were maximized)?
From: SolidWorks Nut on 19 Dec 2007 16:54 On Dec 19, 11:10 am, SolidWorks Nut <solidworks...(a)gmail.com> wrote: > Is there a way to get the "Frame" dimensions of the SolidWorks > application? That is, the working area where its windows are tiled? > > For example, I can get a Model's window position and dimensions > (FrameLeft, FrameTop, FrameWidth, FrameHeight), but how can I get the > total width and total height available for it to "fit" in the SW > application (as if it were maximized)? Also, having another problem in window arranging - I can't seem to cycle through all the open documents. This is really weird. Even though the macro returns the "title" correctly for all open documents, it only changes the Frame properties of the active document. How do I make it activate each open document so that I can change its Frame properties??? Ugh.. Here's the macro I have so far: Public ModelView As Object Public DocCount As Integer Public swApp As SldWorks.SldWorks Public swModelDoc As SldWorks.ModelDoc2 Public swFrame As SldWorks.Frame Public swWindow As SldWorks.ModelWindow Public varModelWindows As Variant Public vobj As Variant Sub ArrangeSolidWorksWindowsNow() Set swApp = Application.SldWorks Set swFrame = swApp.Frame varModelWindows = swFrame.ModelWindows TotalNumberOfWindows = swFrame.GetModelWindowCount n = 0 For Each vobj In varModelWindows Set swWindow = vobj Debug.Print swWindow.Title ' Get the model document in this model window Set swModelDoc = swWindow.ModelDoc Set ModelView = swModelDoc.GetFirstModelView ModelView.FrameWidth = 400 + n * 5 ModelView.FrameHeight = 400 + n * 5 ModelView.FrameTop = n * 5 ModelView.FrameLeft = n * 5 Set swModelDoc = Nothing Set ModelView = Nothing Set swWindow = Nothing n = n + 1 Next vobj End Sub
From: Philippe Guglielmetti on 20 Dec 2007 02:14 check http://swapi.wordpress.com/2007/01/12/viewsize/ for a related problem. You'll find some code to access data returned by the GetViewDIB API.
From: SolidWorks Nut on 20 Dec 2007 08:19 On Dec 20, 1:14 am, Philippe Guglielmetti <goo...(a)goulu.net> wrote: > checkhttp://swapi.wordpress.com/2007/01/12/viewsize/for a related > problem. > You'll find some code to access data returned by the GetViewDIB API. Yikes! >>> "Access to the actual values is done through the (very dangerous) RtlMoveMemory Win32 API call..." I'm not unfamiliar with code, but stuff like this makes me think twice. I'm kinda used to my computer working normally now.
From: SolidWorks Nut on 4 Jan 2008 09:00 On Dec 20 2007, 7:19 am, SolidWorks Nut <solidworks...(a)gmail.com> wrote: > On Dec 20, 1:14 am, Philippe Guglielmetti <goo...(a)goulu.net> wrote: > > > checkhttp://swapi.wordpress.com/2007/01/12/viewsize/fora related > > problem. > > You'll find some code to access data returned by the GetViewDIB API. > > Yikes! > > >>> "Access to the actual values is done through the (very dangerous) RtlMoveMemory Win32 API call..." > > I'm not unfamiliar with code, but stuff like this makes me think > twice. I'm kinda used to my computer working normally now. Ok - finally got it to work now. I had the "Show Model Window" statement too late in the procedure. Moving it up fixed it. Here's the routine (simplified just to show how to cycle through open documents and change their Frame properties): Public ModelView As Object Public swApp As SldWorks.SldWorks Public swModelDoc As SldWorks.ModelDoc2 Public swFrame As SldWorks.Frame Public swModelWindow As SldWorks.ModelWindow Public varModelWindows As Variant Public vobj As Variant Sub ManipulateFramesOfOpenDocuments Set swApp = Application.SldWorks Set swFrame = swApp.Frame varModelWindows = swFrame.ModelWindows TotalNumberOfWindows = swFrame.GetModelWindowCount For Each vobj In varModelWindows Set swWindow = vobj ' Get the model document in this model window Set swModelDoc = swWindow.ModelDoc Set ModelView = swModelDoc.GetFirstModelView 'Here's the title for each window Debug.Print swWindow.Title ' Show the model window swFrame.ShowModelWindow swWindow 'Get the current windows frame information, or place and size the current Window Debug.Print ModelView.FrameWidth Debug.Print ModelView.FrameHeight Debug.Print ModelView.FrameTop Debug.Print ModelView.FrameLeft Next vobj End Sub
|
Pages: 1 Prev: Save bom as csv Next: Mathematical functions for curves in sketch |