Is there a macro out there that...

Is there a macro or small program out there that when I close any part or assembly it sets the view to diametric and zooms out to encompass the whole part or assembly in the window? Also for drawings to zoom out to encompass the whole sheet? The guys I am working with are killing me.... Doesn't seem like a hard thing to do, but they cannot seem to do it. Would be nice if SW can make up for the shortcomings. Ben

Reply to
Loading thread data ...

You could probably develop this macro yourself using the macro recorder. The macro recorder isn't great but it should be able to record the macro for this simple task. There is information in the help files on how it works. One suggestion. When you're recording the macro start with setting your view (it should zoom to fit the screen automatically when you select the diametric view) and then save and close the file.

When you run the macro it should do those 3 steps in that order in which case the macro will actually shut down the file.

Reply to
Rock Guy

The easiest way I can think of to do your task is to create a macro that does what you want plus closes the active part or assembly. That would only take a few minutes to write. Install the macro to all users macro toolbar and make them use it for closing the file in place of other methods. If you need help, let me know.


formatting link

Reply to
KCS Company

Hi Ben, Here you are my macro. Whit it you can: .- Put your model or assy in ISO view .- Zoom to fit .- Rebuild .- Save

Bye, Danferes

********************************************************************** Dim swApp As Object Dim CurrentDoc As Object Dim swModel As SldWorks.ModelDoc2

Sub main()

Set swApp = CreateObject("SldWorks.Application") Set swModel = swApp.ActiveDoc Set swApp = Application.SldWorks Set CurrentDoc = swApp.ActiveDoc

swModel.ShowNamedView2 "*Isometric", -1 swModel.ViewZoomtofit2 ' zoom to fit CurrentDoc.EditRebuild ' rebuild doc CurrentDoc.Save2 False ' save doc

swApp.QuitDoc swModel.GetTitle

End Sub

Reply to

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.