Trouble with selected sets cmd

[ Edited ]


Howdy all

I'm scraching up a bit of code to open a explorer window with the  folder that has the currently selected part selected. Seem's to work fine... well sort of. I can't get the file path of a component that is  selected in a sub assembly (Can't see the wood for the trees). Sorry It's in VB guys as i don't have .net & I'm working in SEv15.

Lookin forward to your replys 


Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _

(ByVal hwnd As Long, ByVal lpOperation As String, _

ByVal lpFile As String, ByVal lpParameters As String, _

ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Const SW_NORMAL = 1

Private DocPath As String

Private DocName As String

Private SelectedPart As String

Private SelectedPartTemp As String

Private PartFileLength As Long

Private Sub Form_Load()

Me.Visible = False

Set objse = GetObject(, "SolidEdge.Application")            'Switch to edge

Set objDoc = objse.ActiveDocument


DocName = objDoc.Name

DocPath = objDoc.Path

DocType = Right$(DocName, 3)


If objDoc.SelectSet.Count = 0 Then

 MsgBox "No Component Selected"

 Set objse = Nothing

 Set objDoc = Nothing


End If


SelectedPart = objDoc.SelectSet(1).Name                                                           'find the name

SelectedPart = objDoc.Occurrences(SelectedPart).OccurrenceFileName  '  find the filename of the selected component


'----------Prep up the component info to find the file path-----------

SelectedPartTemp = SelectedPart

PartFileLength = Len(SelectedPart)

For x = PartFileLength To 1 Step -1

    SelectedPartTemp = Mid$(SelectedPart, x, 1)

    If SelectedPartTemp = "\" Then

        Exit For

    End If

Next x



SelectedPart = Left$(SelectedPart, x - 1)

ShellExecute Me.hwnd, vbNullString, _

SelectedPart, vbNullString, _


Set objse = Nothing

Set objDoc = Nothing


End Sub


Posted by: Snow Mackenzie
Post date: 3/23/2008 12:53:24 PM