Monday 13 January 2014

Cust 17: Solid Edge Documents: VB.Net Part 3

In this tutorial you learn using VB.Net, how to:

  1. Create new Solid Edge document.
  2. Save document.
  3. Save As a document with different name.
  4. Open a Solid Edge document.
  5. Count open documents in Solid Edge.
  6. Access the active document.
  7. Export a document to other CAD formats.
  8. Iterate through all open documents.
  9. Activate a desired document from among open documents.
  10. Close a specific document.
  11. Close all open documents at once
image_thumb4_thumb_thumb

    Note:


…continued from Part 2

The Close Selected button acts in a similar fashion as the activate button:

If lstFiles.SelectedIndex >= 0 Then
  oDocs.Item(lstFiles.SelectedItem).Close()
  lstFiles.Items.Remove(lstFiles.SelectedItem)
Else
 MessageBox.Show("No file selected !", "Close")

The only difference or addition here is the item in the list for the file selected is removed from the list also. This way the documents in the list and in Solid Edge remain in sync.

Finally for the Close All button, a direct API is available:

oDocs.Close()
lstFiles.Items.Clear()

The Close method of the documents collection oDocs which is not to be confused with the Close method of the document object oDoc closes all documents in Solid Edge. The Close method of the documents collection takes no argument.

Also note how the list is cleared since all documents in Solid Edge are now closed.

Summary: This covers most of the techniques related to documents in Solid Edge. Drop a comment below if you think any thing else related to Solid Edge documents needs to be covered.

 image_thumb1_thumb Also, post a comment below if you need the Visual studio code files and be aware of 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.

cMayoCAD24[2]

 cmayocad14222

No comments:

Post a Comment