二次開發第一要義:查幫助
CAA打開文檔函數的幫助如下:
OpenDocument
public static HRESULT OpenDocument( const CATUnicodeString& iStorageName,
CATDocument*& oOpenedDoc,CATBoolean iReadOnly =FALSE)
功能:打開一個給定的文檔。
Role: If the file already exists in the session, it will not be re-loaded.
The document must be removed from the session before exiting or when it is no longer needed. See explanations at the top of this page about the life cycle of the document.
Note: This method does not allow opening .feat or .CATfct catalogs. It is not possible to access .feat catalogs because they contain Dassault Systemes private data. To open a .CATfct catalog, see CATCatalogFactoryServices (ObjectSpecsModeler framework).
Parameters:
iStorageName
The complete access name of the file to open ( path name of the file ).
See CATDocument.StorageName for more information about the storage name.
oOpenedDoc
The opened document.
If the "open" is a "re-open", the pointer is not a new pointer. Do not remove the pointer twice.
iReadOnly
FALSE: Default value, the document will be in read/write mode.
TRUE: The document is in read only mode.
In case of a re-opening, the mode of the document is defined by the first open.
Returns:
S_OK : The document was opened sucessfully.
S_FALSE : The document has already been loaded. The returned oOpenedDoc pointer points to this document.
E_FAIL : The open operation failed.
怎麼用呢,上代碼:
CATSession *pSession = NULL;
HRESULT rc=NULL;
rc = ::Create_Session("CAA_PrdProp_Session", pSession);
// Opening an existing document with full path specified
CATDocument *pDoc =NULL;
CATUnicodeString strPath="C:\\Users\\weiwu-chen\\Desktop\\卷線器改\\juanxianqi.CATProduct";//juanxianqi.CATProduct";
rc = CATDocumentServices::OpenDocument(strPath, pDoc);
if (FAILED(rc)|| NULL==pDoc)
{
return;
}
更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!