kivancsi
Mechanical
- Jun 19, 2013
- 4
Hi everyone!
How can I change the activeDocument from Part to Assembly and back in an API written in Visual Basic 6?
Indeed my problem is I open a Part modify it and close it with
objDocP.Close
then open the assembly on the way
'Connect to a running instance of Solid Edge.
Set objApp = GetObject(, "SolidEdge.Application")
If Err Then
'Clear the error.
Err.Clear
'Start Solid Edge.
Set objApp = CreateObject("SolidEdge.Application")
End If
'Turn off error handling.
On Error GoTo 0
'Make the application window visible.
objApp.Visible = True
'Access the Documents collection.
Set objDocs = objApp.Documents
'Find out if any documents are open.
If objDocs.Count = 0 Then
'Add an Assembly document.
Set objDoc = objDocs.Add("SolidEdge.AssemblyDocument")
Else
'Access the currently open document.
Set objDoc = objApp.ActiveDocument
End If
and get an Error for Set objDoc
but when I put infront of Set objDoc an If
'Access the currently open document.
If objApp.ActiveDocumentType <>3 Then MsgBox objApp.Name
Set objDoc = objApp.ActiveDocument
it works, but I have to push OK button on messagebox
so the question is: how can I ater closing the PartDocument set the focus on opened AssemblyDocument?
How can I change the activeDocument from Part to Assembly and back in an API written in Visual Basic 6?
Indeed my problem is I open a Part modify it and close it with
objDocP.Close
then open the assembly on the way
'Connect to a running instance of Solid Edge.
Set objApp = GetObject(, "SolidEdge.Application")
If Err Then
'Clear the error.
Err.Clear
'Start Solid Edge.
Set objApp = CreateObject("SolidEdge.Application")
End If
'Turn off error handling.
On Error GoTo 0
'Make the application window visible.
objApp.Visible = True
'Access the Documents collection.
Set objDocs = objApp.Documents
'Find out if any documents are open.
If objDocs.Count = 0 Then
'Add an Assembly document.
Set objDoc = objDocs.Add("SolidEdge.AssemblyDocument")
Else
'Access the currently open document.
Set objDoc = objApp.ActiveDocument
End If
and get an Error for Set objDoc
but when I put infront of Set objDoc an If
'Access the currently open document.
If objApp.ActiveDocumentType <>3 Then MsgBox objApp.Name
Set objDoc = objApp.ActiveDocument
it works, but I have to push OK button on messagebox
so the question is: how can I ater closing the PartDocument set the focus on opened AssemblyDocument?