Products

Automation: Part Configurator 3

By Tushar Suradkar

This is the sixth post in the Automation series and the third article for Part Configurator.

In retrospect:

 

Take the First Steps to Automation

Takeaway: Getting started Adding references Console application.

First Steps to Automation – Part 2

Takeaway: Active Document selection Set Ribbon Customization.

Automation – Parametric Parts

Takeaway: Windows application Part features Variable Table.

Automation: Part Configurator

Takeaway: ListBoxes Suppression Variables.

Automation: Part Configurator 2

Takeaway: File Dialogs Select Case.

A nice feature to add to the file save dialog would be to provide a default file name depending upon the configuration selected. Solid Edge does this when saving a new file by suggesting a default file name like Part1.par, asm2.asm, etc.

To do this, add the line in bold as shown below for the Save Part button:

saveDialog.Title = “Save Part Configuration As…”
saveDialog.Filter = “Save Part Configuration|*.par”

saveDialog.FileName = lstShaft.SelectedItem.ToString + ” 1″

saveDialog.ShowDialog()

This simply means, take the text of the selected item in the listbox and add 1 to it and use it as the default file name to save the configuration.

01.png

So when the Shaft with Hole configuration is picked, the default file name would appear as shown besides.

Using the + sign to add strings is a powerful feature of VB.Net. Invest some time in exploring strings in VB.Net at this suggested site. This knowledge will come in handy in many situations while automating Solid Edge.

The file dialog used here is a VB.Net feature. Solid Edge provides its own flavour of the File Save dialog which can be accessed using the GetSaveAsFileName function of the application object. Thus it can be accessed as below:

sConfigFileName = oApp.GetSaveAsFileName(LinksUpdateOption.igNoLinksUpdate, 1, lstShaft.SelectedItem.ToString + ” 1″, “default_par”, 1, “Save Configuration As…”, False)

Open the Solid Edge installation folder and in the SDK folder open the sesdk.chm help file.

On the search tab, type in GetSaveAsFileName and click List Topics.

In the Select topic: list, double-click GetSaveAsFileName. The SE API documentation has detailed information on the various arguments and also a sample program on the usage of this method, hence it won’t be discussed here again.

These were the two items in the TODO list from previous post.

In the next part of the Automation series:

1. Revisit parametric parts and how to parametrically control parts from within an assembly using peer variables via VB.Net code.

2. Read in current values of variables so the user can tweak them from the current value – this is in response to a question on the Solid Edge DEV forum.

Meanwhile do post a new message for any issues you might face.

-Tushar Suradkar

http://surfandcode.blogspot.in

www.cadvertex.com

Comments

9 thoughts about “Automation: Part Configurator 3

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/solidedge/automation-part-configurator-3/