Tuesday, 11 November 2014

Making of PacEdge Part 03

...continued from part 2

05

In this dialog, use the Add button to pick an image which will be eventually added to a node in the TreeList control. Make sure you use all images of the same size viz. 16x16 or all 24x24, etc.

Note the numbers or indices for each image in the left-most column in the Members list in image above. This number is used as the second argument in the Add method of the TreeList.

The ImageList is in turn attached to the TreeList control by setting the TreeList controls SmallImageList property to ImageList control’s name.

13

PacEdge from Assembly: This button first calls the ResetPacEdge function which simply clears off two lists which hold the filenames of Solid Edge and Other i.e. non-Se files in the PacEdge. The lists are:

ListOfSolidEdgeFiles declared as:

Dim ListOfSolidEdgeFiles As List(Of String) = New List(Of String)

And ListOfOtherFiles declared as:

Dim ListOfOtherFiles As List(Of String) = New List(Of String)

The function also clears the TreeList control and removes all nodes.

lstFiles.Items.Clear()

The active PacEdgeMode is then set to AssemblyPacEdge:

ActivePacEdgeMode = PacEdgeMode.AssemblyPacEdge

Where the enum PacEdgeMode is declared as:

Private Enum PacEdgeMode
    AssemblyPacEdge = 1
    PartAndSheetmetalPacEdge = 2
    DraftPacEdge = 3
End Enum

The next step is to allow the user to pick a Solid Edge Assembly via a standard dialog. A OpenFileDialog control is added from the Toolbox which appears in the tray besides the ImageList control added earlier.

The Name is changed to dlgOpen and in the Assembly PacEdge Button’s Click event the first property for the dlgOpen control is changed for the Title which is set as below:

dlgOpen.Title = "Select Solid Edge Assembly"

Next the Filter property is set to *.asm as below:

dlgOpen.Filter = "Solid Edge Assembly|*.asm"

This is a string which has two distinct parts separated by a pipe (|) character that can be produced by pressing Shift+Backslash (\) on the keyboard.

06

The left side of the | is the description which appears in the File Open dialog’s Filter area and the right side of the | is the actual filter (*.asm) which displays only the files with an .asm extension in the file selection area as shown in image above.

After this the file open dialog is displayed:

dlgOpen.ShowDialog()

Continued to part 4... 


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