Wednesday, 3 December 2014

Making of PacEdge Part 10

...continued from part 9

Subsequent to removing the node, the count needs to be updated. For this the Sub-Item is accessed via nodePAR.SubItems(1).Text whose contents is a number which is a string. This string is converted to an integer using the convert.ToInt16 function of .Net, 1 is reduced from the number and the reduced number is again converted to a string using ToString and assigned back to the Column via the SubItem.Text property:

nodePAR.SubItems(1).Text = (Convert.ToInt16(nodePAR.SubItems(1).Text) - 1).ToString

Also the Count in the total of Solid Edge Files needs to be updated. For this the Parent of the removed node is accessed and similarly reduced by 1 as below:

nodePAR.Parent.SubItems(1).Text = (Convert.ToInt16(nodePAR.Parent.SubItems(1).Text) - 1).ToString

The Remove Files button applies to both the PAR+PSM PacEdge and the Draft PacEdge which is discussed next.

The Remove Files button applies to files in both the Solid Edge and Other Files nodes.

A limitation that arises in this situation is in the Assembly PacEdge mode, files cannot be removed from Other Files group even when this is valid. This is an item in the TO DO list and you can perhaps address this problem in your own version of PacEdge.

Draft PacEdge: This is a unique feature of the PacEdge program not found in the competing Pack-n-Go features of SolidWorks or Inventor.

The Draft PacEdge lets user select a single Draft files and gathers all model i.e. Part, Sheetmetal and Assembly files which are referenced in the Draft file.

This however does not involve further traversing any Assembly file in the Draft which would involve calling the assembly package to include all sub-assemblies beneath. The Draft PacEdge is limited to views of Part and Sheetmetal in the Draft only.

In an earlier version of PacEdge I had used the ModelLinks collection of the Draft document to gather files which are required to be included in the PacEdge so no views fail. Later I discovered the Linked Documents of the Revision Manager also does this, but not sure if the two are same.

However I am glad that with Linked Documents I do not require Solid Edge to running which is a must when using ModelLinks. Revision Manager works lightning fast as compared to Solid Edge.

The Draft PacEdge button too resets the PacEdge and throws a File Dialog with a DFT file filter:

ResetPacEdge()

ActivePacEdgeMode = PacEdgeMode.DraftPacEdge

dlgOpen.Title = "Select Solid Edge Draft"

dlgOpen.Filter = "Solid Edge Draft Files (*.dft)|*.dft"

dlgOpen.ShowDialog()

sFile = dlgOpen.FileName

Further it opens the Draft file in Revision Manager:

If sFile <> String.Empty Then

oApp = CreateObject("RevisionManager.Application")

oDocD = oApp.Open(sFile)

oDocs = oDocD.LinkedDocuments

Dim sFullName As String = String.Empty

Then iterates through the linked documents:

For Each oDoc As RevisionManager.Document In oDocs

  sFullName = oDoc.FullName

  If File.Exists(sFullName) Then

    If Not FileExistInList(sFullName, ListOfSolidEdgeFiles) Then

      ListOfSolidEdgeFiles.Add(sFullName)

    End If

    If sFile.ToUpper.Equals((Path.ChangeExtension(sFullName, "DFT")).ToUpper) Then

      bFlag = True

    End If

  End If

Next

The Linked Documents are all Part, Sheetmetal or Assembly documents.

Chances are the Draft file also has an Assembly, Part or Sheetmetal document with the same name along with other Part or Sheetmetal files referenced in the views. When the selected Draft file’s name is included in the ListOfSolidEdgeFiles, the Draft node is added twice since the Part or Sheetmetal node for the file is also processed for a “YES” in the Draft Exist? Column. This creates two entries under the Draft node in the TreeList.

To overcome this, a flag i.e. Boolean variable is initiated as False before the loop and if the Linked Document already has a Draft file in the same path as the referenced file, the Flag is set to true.

Outside the loop, the flag is checked and the main Draft file selected by the user is added to the ListOfSolidEdgeFiles only if it is still False.

If bFlag = False Then

  If Not FileExistInList(sFile, ListOfSolidEdgeFiles) Then

    ListOfSolidEdgeFiles.Add(sFile)

  End If

End If

The ListOfSolidEdgeFiles is finally processed by calling ProcessSolidEdgeFiles which displays he PacEdge contents in the TreeList.

Continued to part 11... 


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