In this tutorial you learn using CSharp, how to:
Note:
The Close Selected button acts in a similar fashion as the activate button:
if(lstFiles.SelectedIndex >= 0)
{
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.
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.
No comments:
Post a Comment