Question about the Interface "ISEInProcSupport" V17

Valued Contributor
Valued Contributor

from the sample program to enumerate surface bodies in a Part file using SmartView in-process handler we know, that the Client does not have to use Object Linking or Embadding to access the OLE for DM Geometry and Topology for Surface interface. But my problem is, if i want to get the IDispatch Interface and the SmartPoint (for example: PartDocumentPtr).

The ISEInProcSupport interface allows the Container to get and set the process mode of Solid Edge.

 

IOleObject* pIOle = NULL;

pServerUnk->QueryInterface(IID_IOleObject,(void**)&pIOle);

 

 

ISEInProcSupport* pISEInPro = NULL;

pIOle->QueryInterface(IID_ISEInProcSupport,(void**)&pISEInPro);

 

boolean pMode;

pISEInPro->GetInProcMode(&pMode);

 

if(pMode == TRUE)

pISEInPro->SetInProcMode(FALSE);

 

The out-of-process mode uses the primary executable of Solid Edge with its full capabilities, in which all the interface calls are marshalled across process boundaries, including the OLE for DM interfaces. But i don't know, how can i do that?

 

 

Posted by: Julia Schneider
Post date: 5/16/2007 10:24:45 PM

3 REPLIES

RE: Question about the Interface "ISEInProcSupport" V17

Valued Contributor
Valued Contributor

Hi Julia,

 

You post a very interesting question about OLE for DM support in Solid Edge. I've always been interested in looking into it but never took the time. I've ended up spending more time on it than I'd care to admit but I've attached what I ended up with to this post. It still doesn't work the way that I wanted it to. Maybe you can complete it. I also noticed that SetInProcMode does not work the same across different versions of Solid Edge. Maybe I'm just tired and missed something but I don't think so. I also noticed that dmroot.h, a dependent header file was silently excluded from my V19 installation. I had to go get the file off a V17 CD. Not sure if that was on purpose or not. I have spoken with Solid Edge development about their support for OLE for DM. They said that it was a very old technology and that they thought there was some previous licensing issues around it. They also mentioned that they didn't think anyone was using it. You'd need to send a PR to GTAC to get the full response.

 

I tried to document everything. Good luck and let me know how it goes!

 

Posted by: Jason Newell
Post date: 5/17/2007 6:15:38 PM

RE: Question about the Interface "ISEInProcSupport" V17

Valued Contributor
Valued Contributor

Hello Jason,

 

Thanks for your answer. Now I have a list of the SolidEdgeDocument (.par,.asm,.psm), and I want to write a Batch-program to analyze these data. The program must be able to enumerate surface bodies in a Part or Assembly file(I want to use here the G&T interface (IDMSurfaceBodies, IDMEdge, IDMCurve etc.) and IDispatch will at the same time). We known, that A dual interface exposes its methods through both a vtable and IDispatch, but in SolidEdge is the IDispatch not a dual interface. My first question is, how can I get the G&T interface from the IDispatchPtr (without using Addin)?(1)

 

I have tried to write some code:

 

At first I can get the ApplicationPtr _application;

 

SolidEdgeDocumentPtr sDoc = _application->GetDocuments()->open(FileName,0,true);//I don't known here how can I get the "SolidEdgeDocumentPtr" without opening the file if I have the FullName of the file.(2)

 

IDMSurfaceBodiesPtr pBodies = sDoc;

IEnumDMSurfaceBodiesPtr pEnumBodies;

IDMSurfaceBodyPtr pBody;

IEnumDMFacesPtr pEnumFaces;

IDMFacePtr pFace;

ULONG uBodiesFetched = 0;

ULONG uFacesFetched = 0;

int nBodies = 0;

int nFaces = 0;

 

 

COMCALL(pBodies->EnumSurfaceBodies(&pEnumBodies), "getting surface bodies enumerator");

 

for(nBodies = 0, nFaces = 0, COMCALL(pEnumBodies->Next(1, &pBody, &uBodiesFetched), "getting first body");

uBodiesFetched == 1;

COMCALL(pEnumBodies->Next(1, &pBody, &uBodiesFetched), "getting next body"))

{

nBodies++;

 

COMCALL(pBody->EnumFaces(&pEnumFaces), "getting Faces enumerator");

 

for(nFaces = 0, COMCALL(pEnumFaces->Next(1, &pFace, &uFacesFetched), "getting first face");

uFacesFetched == 1;

COMCALL(pEnumFaces->Next(1, &pFace, &uFacesFetched), "getting next face"))

{

nFaces++;

}

cout

}

......

IDMEdgePtr pEdge;//not NULL!!!

IDMCurve* pCurve = NULL;

pEdge->QueryInterface(IID_IDMCurve,(void**)&pCurve);

/////////////////

Error!(3)

pEnumFaces = NULL

pCurve = NULL

 

But if I use the code in the sample program:

bstr_t fileName = asciiName;

 

// get the class from the file and start the inproc handler

CLSID fileClass;

COMCALL(GetClassFile(fileName, &fileClass), "getting class of input file");

 

IUnknownPtr pServerUnk;

COMCALL(CoCreateInstance(fileClass, NULL, CLSCTX_INPROC_HANDLER, IID_IUnknown, (LPVOID *)&pServerUnk),

"creating class object for input file");

 

// bring the server (part.exe in your case) to the running state. This is

// required if the handler needs the server to process an interface call.

// If the server is not in a running state then an interface call on the server

// from inside the handler would fail because COM does not automatically run the

// server for us.

OleRun(pServerUnk);

 

// get the IPersistStorage interface from the server

IPersistStoragePtr pPersistStg = pServerUnk;

 

 

// open the file as a storage

IStoragePtr pStorage;

COMCALL(:Smiley FrustratedtgOpenStorage(fileName, NULL,

STGM_SHARE_EXCLUSIVE | STGM_READWRITE,

NULL, 0, &pStorage), "opening root storage of input file");

 

// load the file storage

COMCALL(pPersistStg->Load(pStorage), "loading the class object with storage");

 

// get the IDMSurfaceBodies interface and enumerate bodies in the file

IDMSurfaceBodiesPtr pBodies = pPersistStg;

/////////////////////////

then the program works but I also want to use all the Solid Edge specific OLE Automation APIs(IDispach).

 

please help me!

Thanks

 

 

 

Posted by: Julia Schneider
Post date: 5/21/2007 10:10:48 AM

RE: Question about the Interface "ISEInProcSupport" V17

Valued Contributor
Valued Contributor

Julia,

 

I've spent all the time that I have on this for you. I did not get a good feeling from talking with the Solid Edge development staff about this API. It's old and has not been updated in a very long time. It would not surprise me at all that it does not work as documented in the SDK. Like I said in my last post, I spent quite a bit of time on it but I got to a point that I didn't know what else to try. I suggest that you file an IR with GTAC requesting help. That's the only advice that I have for you. Sorry I couldn't figure it out. Goodness knows I wanted to and tried to.

 

 

 

Posted by: Jason Newell
Post date: 5/22/2007 1:42:50 PM