|
Summary : there are three terrible questions on SW translator as below
Description : Hi,
I’m working on SW translator (SW DCI) efficiency for Wilcox Company, your SW partner. By the way, I maybe also need a constant technical supporter for a long time. Now, there are three terrible questions on SW translator as below.
1. If SW is running in the foreground and is visible, are there other OLE functions or ways to catch and connect SW? (My current way is that of m_pSldWorks.CreateDispatch(_T("SldWorks.Application"));) Sometimes my customers need network to connect SW with a floating license.
2. What is the operation of Release ISldWorks in OLE automation?
It maybe has some problems when I close the SolidWorks session via the following code.
My code as follows:
// code 2 start
ISldWorks m_pSldWorks;
// connects to an already running instance of SW
//?????????????
// or will start SW if not already running
m_pSldWorks.CreateDispatch(_T("SldWorks.Application"));
//…………………
// close the SolidWorks session
m_pSldWorks.ExitApp ();
m_pSldWorks.DetachDispatch();
m_pSldWorks.ReleaseDispatch();
m_pSldWorks.m_lpDispatch = NULL;
// code 2 end
3. Are there other ways to rapidly get model doc from ISldWorks? According to the below steps, it takes a long time to get model doc via the following code. I guess the reason of that m_pSldWorks open filename in SW if SW is running in the foreground and is visible. But our requirement is that SW translator reads or gets majority model data or information of SW 3D part via OLE Automation and SW 3D part doesn’t need display in SW.
My code as follows:
// code 3 start
// Get the pModelDoc - Open the SolidWorks file
dModelDoc = m_pSldWorks.OpenDoc6 (fileName, fileType, fileOptions, fileConfigs, &errors, &warnings);
dModelDoc = m_pSldWorks.ActivateDoc2 (fileName, silent, &errors);
// get the active model doc
LPDISPATCH dModelDoc = m_pSldWorks.GetActiveDoc();
// code 3 end
> Yanhua |
|