Friday, 20 February 2015

Making of Zoom To Selection Part2

...continued from part1

In the Module1, declare variables for Solid Edge, the Draft Document, Sheet and the Sheet Window as below:

11

Some of the other variables are:

12

The XMin, YMin, XMax and YMax variables are for storing the coordinates of the selected object's range in sheet coordinates. These need to be transformed to Window or Screen coordinates which are stored in XWin1, YWin1, XWin2 and YWin2.

X1, Y1, X2, Y2 are temporary variables.

Inside the Sub Main, some rudimentary checks are done to ensure Solid Edge is running and that a Draft document is currently active.

15

Note how a message box can still be displayed in a Console application by using the Imports System.Windows.Forms statement at the top of the code window.

If indeed there is a Draft document open, it is stored in oDoc and the current i.e .Active sheet into oSheet.

17

oSel is a selection set which holds all currently selected items in the sheet. Even if no object is selected, the selection set still exists with a count of 0.

The selection set is similar to the Documents collection which also exists with a count of 0 when no document if open.

Continued to Part 3...


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