Reply

Is it possible to open document invisible in SE?

[ Edited ]

 

Hello!

Sometimes  from my program It would be great  to open document without window( or in invisible state ), for example for doing small operations like writing attributes. But I haven't found the way how to open it invisible. The other CAD systems like UG, ProE can do it. Is it possible in SE?

Thanks.

 

Posted by: Sergey Sergeenko
Post date: 6/1/2010 10:13:11 PM

11 REPLIES

RE: Is it possible to open document invisible in SE?

[ Edited ]

Dim objApp As SolidEdgeFramework.Application

objApp.visible=false

'Do your thing

objApp.visible=true

 

This will hide Solid Egde completely. I found out that operations take approx. 2/3 of the normal time in this mode. But it can also create some strange behaviour. Always make sure your procedure works, and than do it in invisible mode.

 

Good Luck!

 

Erwo

 

Posted by: Wouter Sloof
Post date: 6/2/2010 2:51:14 AM

RE: Is it possible to open document invisible in SE?

[ Edited ]

Erwo, the idea is really interesting! Thanks

 

But it is also possible from the logic of program that SE is already running and other documents are opened.

So, that way is not acceptable all the times.

But anyway, thanks

 

Posted by: Sergey Sergeenko
Post date: 6/2/2010 4:04:55 AM

RE: Is it possible to open document invisible in SE?

[ Edited ]

 

I don't really know if that's possible but you can hide the window of the document, maybe that is an option?_________________________________________________________________________

Public Sub HideDocument()

'On Error Resume Next

Dim objApp As SolidEdgeFramework.Application

Dim objDoc As SolidEdgePart.PartDocument

Dim objWindows As SolidEdgeFramework.Windows

Dim objWindow As SolidEdgeFramework.Window

'Get SE

    Set objApp = GetObject(, "SolidEdge.Application")

    If Err Then

        Err.Clear

        Set objApp = CreateObject("SolidEdge.Application")

    End If

    objApp.Visible = True

 

'Set

    Set objWindows = objApp.Windows

    Set objDoc = objApp.ActiveDocument

'Hide all window

    For Each objWindow In objWindows

        objWindow.Visible = True

    Next

 

'Release objects

    Set objApp = Nothing

    Set objDoc = Nothing

    Set objWindows = Nothing

    Set objWindow = Nothing

 

End Sub

 

Posted by: Wouter Sloof
Post date: 6/2/2010 4:54:03 AM

RE: Is it possible to open document invisible in SE?

[ Edited ]

Thanks, Erwo.

 

I've tried your method. But it closes only the window of a document. But the document remains active.All the commands i.e. toolbar, pathfinder .. are opened for that document

 

 

Posted by: Sergey Sergeenko
Post date: 6/3/2010 8:59:52 PM

RE: Is it possible to open document invisible in SE?

[ Edited ]

 

Try using:

 

Set objPart = CreateObject(strFilename)

 

so something like this:

 

Set objPart = CreateObject("C:\Temp\Test.par")

 

I use this method quite often for creating parts without letting the user see what I am actually doing.

EDIT:

I made an error, it is GetObject(strFilename) instead of CreateObject.

 

Posted by: T. Jissink
Post date: 6/10/2010 6:40:06 AM

RE: Is it possible to open document invisible in SE?

[ Edited ]

Thanks!

 

It really works. The only question: the document would be unload from SE(closed) when the pointer will be released?

 

Posted by: Sergey Sergeenko
Post date: 7/21/2010 4:32:41 AM

RE: Is it possible to open document invisible in SE?

[ Edited ]

 

 

The following C++ code will open a document with no UI. This should work even if Solid Edge is not running in the background. It is essentially how Solid Edge assemblies quietly open a document without showing the UI for the document. Make sure you close the document when you are done. The trick Edge looks for is the second arg being an int and the value being 8.

#define JDOCUMENTPROP_NOWINDOW 0x00000008

DocumentsPtr pDocs = GetApplicationPtr()->Documents;

_bstr_t FullName;

 

{

PartDocumentPtr pPartDoc;

VARIANT vOption;

V_VT( &vOption ) = VT_UI4;

V_UI4( &vOption ) = (

pPartDoc = pDocs->Open(

 

{

FullName = pPartDoc->FullName;

pPartDoc->Close();

}

}if( NULL != pDocs )unsignedlong )JDOCUMENTPROP_NOWINDOW;"c:\\temp\\block.par", vOption );if( NULL != pPartDoc )

 

Posted by: R.D. Holland
Post date: 9/24/2010 4:53:49 AM

RE: Is it possible to open document invisible in SE?

[ Edited ]

The post I just made looks totally different than what I saw in the reply window. Let me try again:

 

 

The following C++ code will open a document with no UI. This should work even if Solid Edge is not running in the background. It is essentially how Solid Edge assemblies quietly open a document without showing the UI for the document. Make sure you close the document when you are done. The trick Edge looks for is the second arg being an int and the value being 8.

 

// This command demonstrates a little know method of opening a Part document without

// creating a window. It relies on setting the option input arg to an unsigned int. The

// value of the int is eight.

 

#define JDOCUMENTPROP_NOWINDOW 0x00000008

 

DocumentsPtr pDocs = GetApplicationPtr()->Documents;

 

_bstr_t FullName;

 

if( NULL != pDocs )

{

PartDocumentPtr pPartDoc;

 

VARIANT vOption;

 

V_VT( &vOption ) = VT_UI4;

V_UI4( &vOption ) = (unsigned long )JDOCUMENTPROP_NOWINDOW;

 

pPartDoc = pDocs->Open( "c:\\temp\\block.par", vOption );

 

if( NULL != pPartDoc )

{

FullName = pPartDoc->FullName;

 

pPartDoc->Close();

}

}

 

 

 

 

Posted by: R.D. Holland
Post date: 9/24/2010 4:56:24 AM

RE: Is it possible to open document invisible in SE?

[ Edited ]

Wow, what a great tip. I need to get that documented in the SDK.

 

Posted by: Jason Newell
Post date: 9/24/2010 8:36:55 AM