Saturday, 7 March 2015

Making of SE Equation Curve Part2

...continued from part 1

Inside the Form class, declare variables for the Solid Edge Application, Part and Draft documents, Units of Measure and the Sheet.


This program will support a draft and Part document only, though it can be easily extended to work in the Sheetmetal and Assembly environments too.

The Form Load event relies on the good old On Error Resume Next statement to perform some rudimentary checks if Solid Edge is running and further if a document is open:


A deeper investigation is then done to check if the open document is a Part or Draft document and if it is a Part document, further if a sketch is active i.e. if the user is in the sketcher environment. The sketcher environment is called by the name LayoutInPart:


The Draw Curve button evaluates the equation and calculates the values of y for each value of x over the specified range of x


First the values of the start and end values of x are acquired from the Range of x and to TextBoxes which are named txtX1 and txtX2, which are stored in dMin and dMax respectively. Also the number of points on the curve are stored in iPoints.


The number of steps through which to run the For loop for calculating the x and y coordinates is calculated by dividing the difference between the range values by the number of points.

As seen in the above screenshot of the dialog, the range 0-60 is divided by 8 points on the curve resulting in a step value of 5 which is the interval or gap between successive x values. The corresponding y value is calculated using the equation.


Continued to Part 3...

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