if in a product or in a drawing, one or more references do not exist any more (e.g. some prt-files are deleted accidentally), how can I still get the info, which files are absent?
With the following code:
pfcSession_ptr session = pfcGetProESession();
pfcModelDescriptor_ptr desc = pfcModelDescriptor::CreateFromFileName("test.asm"); // or drawing file
pfcModel_ptr model = session->RetrieveModel(desc);
I get an exception when calling RetrieveModel (If a direct child of the root assembly cannot be found). In ModelDescription or exception, no message about the missing file can be found.
I am running the application in batch mode.
I found the documentation for fpcSolid::HasRetrievalErrors:
Models may be retrieved even if some component models are missing. The missing components will be suppressed, and geometry referencing these models will be frozen. The retrieval methods will not give an indication that this error occurred. Call this method after retrieval to see if any such errors occurred. pfcSession::BaseSession::RetrieveModel pfcSession::BaseSession::RetrieveModelWithOpts pfcSession::BaseSession:penFile pfcSession::BaseSession::RetrieveAssemSimpRep true if errors occurred during retrieval, false if there was no error.
But if I get an exception already at "BaseSession::RetrieveModel", I have no chance to get a model and thus no Solid. And this method cannot be called.
I found out, BaseSession::RetreiveModel does not throw exception, if some file is missing, when creo is in interactive mode. So I start Creo with -g:no_graphics but WITHOUT -batch_mode. It may be not good in performance, but it solves the problem.