Monday, 16 February 2015

Making of Zoom To Selection Part1

Solid Edge's View Fit tool has Ctrl+Fit for zoom to sheet and Shift+Fit for zoom to all elements or drawing objects including those outside the sheet's border.


SolidWorks introduced a Zoom To Selection command with 2015. Making such a facility available in Solid Edge would be both challenging and fun.

This Solid Edge Maker Faire tutorial takes you through the complete process of coding this program. Other making tutorials in this series can be accessed here.

01_thumb2_thumb_thumb_thumb This Solid Edge Zoom To Selection program and its source code can be downloaded at the end of this tutorial.

This tutorial uses Visual Studio 2010, .Net 4.0.

Start a VB.Net 'Console Application' and name it ZoomToSelection. Make sure the check box settings are as shown below (3):


From the menu, select Project >  Add Reference... and from the dialog that appears, take the COM tab. Add references to Solid Edge Framework and the Solid Edge Draft libraries.

You can see these added under References in the Solution Explorer:

08 The References node is hidden by default. To make it visible, click the Show all Files button (2nd from left) on the mini-toolbar of the Solutions Explorer.

Also add reference to Windows Forms which can be typically found in the location:

\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\vx.x\System.Windows.Forms.dll

This will be useful for displaying message boxes in a console application. Select the project in the Solution Explorer and click the first button in its mini toolbar to change the project properties.

Set the Application type to Windows Form, which will get rid of the flashing black console window. Alternatively, you can begin with a Windows Forms Application and then remove the default Form followed by adding a module to the project.

Also make sure the Startup object is Sub Main.


Add the following Imports statements at the top of the code window. Each of these will be discussed as and when referenced in the code later.


Continued to Part 2...

Index of all Solid Edge Tips, Tutorials and Videos...