Tuesday, 24 December 2013

Cust 06: Start Show Stop Solid Edge : C++ with MFC Part 3

This is part 3 of the three part tutorial where you learn:

  • How to invoke Solid Edge using C++ with MFC i.e. pure C++.
  • How to Start-Show-Hide-Stop Solid Edge from the program.
  • How to manipulate several properties and interface elements of Solid Edge.


…continued from Part 2

Finally to code for the check boxes which control the visibility of the Edge bar and the Status bar, go to the dialog in design mode and right click on the Check box for Display Status Bar and select Add Variable… from the context menu.

Specify chkStatus as the variable name for the check box.


Leave all other settings unchanged in the dialog and press Finish.

Similarly, assign a variable chkEdgeBar for the Display Edge Bar check box.

Double click the check box for Status Bar and use the following code in its OnBnClickedCheck event:

if (chkStatus.GetCheck() == 1)
  this->oApp->StatusBarVisible = TRUE;
if (chkStatus.GetCheck() == 0)
  this->oApp->StatusBarVisible = FALSE;

The code for the Edge bar display is similar:

if (chkEdgeBar.GetCheck() == 1)
  this->oApp->EdgeBarVisible = TRUE;
if (chkEdgeBar.GetCheck() == 0)
  this->oApp->EdgeBarVisible = FALSE;

Play around with the check boxes since the status of the check boxes (OFF) may not initially match with those of the Browser and Status bars in Solid Edge which would be ON.

Ultimately for the Quit Solid Edge button, write:


Summary of Part 3:

You learned how to set up a MFC project and add Button and Static controls and how to invoke Solid Edge.

The earlier parts of this tutorial post are Part 1 and Part 2

clip_image002_thumb1_thumb_thumb_thuDrop a comment below if you need the Visual Studio project files and further if you liked the depth of discussion here, similar in-depth techniques are discussed in cMayoCAD where you create your own, brand new, fully functional CAD system with scripting capabilities using a geometric modeling kernel.

Download the detailed course contents for cMayoCAD here.