Cancel
Showing results for 
Search instead for 
Did you mean: 

Zoom scale model or drawing to Actual Size on screen

Pioneer
Pioneer

I would like to click a button (or keyboard shortcut) and it will zoom to view a model or drawing to actual scale size on my computer screen monitor.

I've found two posts about this:

https://community.plm.automation.siemens.com/t5/Solid-Edge-Forum/exact-scale/m-p/575936

https://community.plm.automation.siemens.com/t5/Solid-Edge-Forum/where-is-Solid-Edge-Learning-tools-...

 

It appears that another CAD program can do this with a macro:

https://forum.solidworks.com/thread/17497

 

I'm not very experienced with creating macros, and I have no idea how to look up the internal value that gets or sets the Solid Edge zoom level.

sryp

ST7 Classic MP0 | Win7
11 REPLIES 11

Re: Zoom scale model or drawing to Actual Size on screen

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Hi @sryp 

 

I will have a look at the SolidWorks macro you pointed to - there are multiple versions shared in that discussion.

Moreover, swp files are encrypted so SW is required to open them and I don't have access to SW readily, but I will manage.

After this, writing the equivalent API calls for Solid Edge should be easy, if those are available.

Let's hope it works for SE too

 

~Tushar

 

Re: Zoom scale model or drawing to Actual Size on screen

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Guys,

Slow on the kudos... Smiley Happy I haven't delivered any macro or solution yet.

Re: Zoom scale model or drawing to Actual Size on screen

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Hi @Tushar 

 

 

 

it's not the macro or the solution it is Your intention to do!

 

 

regards
Wolfgang

Re: Zoom scale model or drawing to Actual Size on screen

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Here's what the latest version of the shared SW macro looks like and does:

It permits the user to set the view scale, then updates the view - see the line in bold.

 

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModView As SldWorks.ModelView

Sub main()

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

  swModView.Scale2 = 0.25 ' Change scale value here
  swModel.GraphicsRedraw2

End Sub

  

Is this good enough?

Writing the SE equivalent code will take just under a minute.

  

~Tushar

Re: Zoom scale model or drawing to Actual Size on screen

Pioneer
Pioneer
Yes I'm sure that would be great. I do not have VBA (unless Excel Developer can be rigged up to do it?). Either way, I'm an inexperienced coder.
sryp

ST7 Classic MP0 | Win7

Re: Zoom scale model or drawing to Actual Size on screen

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

@sryp Do you have a commercial license for Solid Edge or are you using Free2D or the Student Version?  I ask because I noticed your signature states you are running ST7 MP0 which usually indicates someone who does not have access to the patches and thus a "free" license which does not have an API available to run macros/addins.



Ken
Production: SE 2019 MP5, Testing: SE 2020
http://Grundey.blogspot.com

Re: Zoom scale model or drawing to Actual Size on screen

Pioneer
Pioneer

Yes I have a commercial liscence.  We've stopped subscribing to maintenance updates a few years ago (c. 2014?...before I started here).  Apparently we're  upgrading our decade-old computers soon, which I think would be a good time to upgrade SE as well.

Yes I have run macros many times here.  My favorite one so far is SEExplore.

sryp

ST7 Classic MP0 | Win7

Re: Zoom scale model or drawing to Actual Size on screen

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

OK. Now that Ken's genuine doubt about the license type is out of way, here's the equivalent code in Solid Edge for the SW macro:

 

Imports SolidEdgeFramework
Imports SolidEdgeFrameworkSupport

Module Module1
    Dim seApp As SolidEdgeFramework.Application = Nothing
    Dim seDocument As SolidEdgeDocument = Nothing

    Sub Main()
        seApp = Runtime.InteropServices.Marshal.GetActiveObject("SolidEdge.Application")
        seDocument = seApp.ActiveDocument

        Dim seActiveWindow As SolidEdgeFramework.Window = seApp.ActiveWindow
        Dim seView As View = seActiveWindow.View

        Dim seViewScale As Double = Convert.ToDouble(InputBox("Enter View Scale", "View Scale", "1.0"))

        seView.ZoomCamera(seViewScale)
    End Sub
End Module

Also attached is the macro that can be readily run, see seViewScale.zip at the end of this message.

The macro will prompt for a scale factor and update the current view in Solid Edge accordingly.

 

vsPromptBox.png

 

Notes:

1. Absolutely no error checks, no notifications.

2. Works with all 3D documents - Part, Sheetmetal, Assembly.

3. Does not work with Draft.

 

~Tushar

Re: Zoom scale model or drawing to Actual Size on screen

Pioneer
Pioneer

Thanks for the work on this, Tushar.

 

It appears that this macro will just zoom in/out a multiplied ratio to what is currently zoomed.

Eg., let's say I'm currently zoomed at 1.0.  If I run the macro and set it to 2.0, it will zoom in double (i.e. everything appears twice as large as before).  This seems correct behaviour so far...

 

However, when I now run the macro a second time and put in 2.0, it will again zoom in 2.0, so now we're at 4.0.

My desired operation is that no matter where/how I am zoomed in, it will zoom in/out to an ABSOLUTE zoom level value, so I can quickly and easily 'visualize' what real size looks like.

I wonder if there is a way to use the bounding box?

 

May I ask why this can't work in Draft also?  My guess is different commands/functions for the different environment.

sryp

ST7 Classic MP0 | Win7