Fri, 04/07/2006 - 20:03
Hello OCC-Folks!
i have an MFC-Application with OCC, i use OCC for geometric stuff, now i want to integrate OCAF.
Can anyone give me a very litte, minimum example how to use OCAF with MFC, i know about the OCAF-example, but i use VS2005 and this OCAF-example does not work with that. Apart from this (i tried OCAF-example with VS2003), i generally have problems with understanding of OCAF, i also read the documentation to OCAF. I want to add an menu-item for creating an OCAF-App, and save this one, later open this one. Then use the Data(OCAF)-Browser and explore through the OCC-components hierarchy (geometry, etc.).
I need OCAF for my master thesis, and i would appreciate all hints, cause OCC in my opinion is not simple to learn for a CAD/CAM-Beginner (i spend so many hours, but the results are poor), cause its to much stuff and the documentation and the demo examples.
I hope you can help me,
greetings,
David B.
Sat, 04/08/2006 - 01:01
Hi David,
whats your problem with the example from OCC?
Greets,
Patrik
Thu, 07/13/2006 - 01:21
Hi Patrick,
I am also in bad need of using OCAF for an application related to my research project as a graduate student. If you have a working OCC Ocaf file, could you please send it to me.
I need to be able to read assembly component as well as attach non geometric data (documents on it).How can I solve this. Thank you very much in advance.
Thu, 07/13/2006 - 14:20
Hi,
I would suggest you build an OCAF application with Appwizard. After that I would use XCAFApp_Application and Handle_TDocStd_Document as base for further development.
Read about the XDE classes and add the documents to your needed labels (TDF_Label).
Now its your turn for implementation ;-)
Greets,
Patrik
Fri, 07/14/2006 - 03:23
Thank you for the reply Patrick. But I am a newbie so If you can explain more clearly it would be nice.
Also, I was trying to read a simple step file.
Here is my code and the errors I go:
Handle(TDocStd_Document) doc;
STEPCAFControl_Reader reader;
IFSelect_ReturnStatus readstat = reader.ReadFile("screw.step");
if ( !reader.Transfer ( doc ) ) {
cout<<"Cannot read any relevant data from the STEP file"<QAE@XZ)
TexturesExt_Presentation.obj : error LNK2001: unresolved external symbol "public: unsigned int __thiscall STEPCAFControl_Reader::Transfer(class Handle_TDocStd_Document &)" (?Transfer@STEPCAFControl_Reader@@QAEIAAVHandle_TDocStd_Document@@@Z)
TexturesExt_Presentation.obj : error LNK2001: unresolved external symbol "public: enum IFSelect_ReturnStatus __thiscall STEPCAFControl_Reader::ReadFile(char * const)" (?ReadFile@STEPCAFControl_Reader@@QAE?AW4IFSelect_ReturnStatus@@QAD@Z)
TexturesExt_Presentation.obj : error LNK2001: unresolved external symbol "public: __thiscall STEPCAFControl_Reader::STEPCAFControl_Reader(void)" (??0STEPCAFControl_Reader@@QAE@XZ)
TexturesExt_Presentation.obj : error LNK2001: unresolved external symbol "public: __thiscall Handle_STEPCAFControl_DictionaryOfExternFile::~Handle_STEPCAFControl_DictionaryOfExternFile(void)" (??1Handle_STEPCAFControl_DictionaryOfExternFile@@QAE@XZ)
../../Debug/TexturesExt.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.
TexturesExt.exe - 7 error(s), 0 warning(s)
--
I really appreciate your help as this is slowing me down big time.
here is my email in case you can send me a working sample Xde: madou007@hotmail.com
Fri, 07/14/2006 - 14:13
Hi,
you have to link more libs. For a fast solution link "TKXCAF.lib", "TKXCAFSchema.lib" and "TKXDESTEP.lib" to your project. If there are still some linking errors please test some other libs...
Greets,
Patrik
Fri, 07/14/2006 - 17:54
THank you for you reply. I think I am missing the basics of OCC although I can compile and execute all the Mfc simple even the OCAF and do some modification etc. I some times include the .hxx include files but I have never integrate the .lib as you have mentionned. In addition to this, I cannont find the TKXCAF.lib files in the include directory files OCC\ros\inc.
Excuse my ignorance on this as I am not a programmer but an mechanical engineer.
Please help me find my solution to move ahead.
Thank you again.
Fri, 07/14/2006 - 17:58
Hi,
you find the libs at: "..\ros\win32\lib" (depending on your installation). You can take a look at the OCC examples for library inclusion in the "stdafx.h" files.
Greets,
Patrik
Fri, 07/14/2006 - 18:37
Thank you so much Patrick. I really appreciated this help because I am working on OCC night and day without any progress.
I saw the lib and open the one "stdafx.h" file located in C:\OpenCASCADE5.2\samples\standard\Mfc\02_TopologySamples\02_4_TopologyAnalysis. I usually open the .dsw file, compile and see if it works and it does all the time. And in this "stdafx.h", the lib files includes are not between comments if I understand very well: /*
#ifndef Version15B
# ifndef Version15D
# ifndef Version20
# define Version15B
# endif // Version20
# endif // Version15D
#endif // Version15B
#pragma message ("=============================")
#ifdef Version15B
# pragma message ("Set the libs for version 1.5B")
#endif // Version15B
#ifdef Version15D
# pragma message ("Set the libs for version 1.5D")
#endif // Version15D
#ifdef Version20
# pragma message ("Set the libs for version 2.0 ")
#endif // Version20
#pragma message ("=============================")
#ifdef Version15B
# pragma comment (lib,"TKTop.lib")
# pragma comment (lib,"TShort.lib")
# pragma comment (lib,"TColQuantity.lib")
#endif
#ifdef Version15D
# pragma comment (lib,"TKTop.lib")
#endif
#ifdef Version20
# pragma comment (lib,"TKTop1.lib")
# pragma comment (lib,"TKTop2.lib")
#endif
#pragma message ("Set the specific libs for the application")
# pragma comment (lib,"TKPrs.lib")
# pragma comment (lib,"TKGeom.lib")
# pragma comment (lib,"TKGlt.lib")
# pragma comment (lib,"TKGraphic.lib")
# pragma comment (lib,"TKPrsMgr.lib")
# pragma comment (lib,"TKViewers.lib")
# pragma comment (lib,"TKSession.lib")
# pragma comment (lib,"TColgp.lib")
# pragma comment (lib,"TKernel.lib")
*/
I wonder what would be the effect of removing the comment. I will try to do the same in my sample program and see how it works.
Thank you again.