准备工作:安装opencascade
一、配置项目属性
1、创建一个MFC 单文档空文件(OCCMFC)
2、VC++ Directories
Include Directories:OpenCASCADE-7.6.0-vc14-64/opencascade-7.6.0/inc 完整路径
Library Directories:OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib 完整路径
3、添加外部依赖项
1、打开cmd,进入到OpenCASCADE-7.4.0-vc14-64\opencascade-7.4.0\win64\vc14\lib目录下,输入dir /b>libName.txt 可得到libName.txt 文件:
TKBin.lib
TKBinL.lib
TKBinTObj.lib
TKBinXCAF.lib
TKBO.lib
TKBool.lib
TKBRep.lib
TKCAF.lib
TKCDF.lib
TKD3DHost.lib
TKDCAF.lib
TKDFBrowser.lib
TKDraw.lib
TKernel.lib
TKFeat.lib
TKFillet.lib
TKG2d.lib
TKG3d.lib
TKGeomAlgo.lib
TKGeomBase.lib
TKHLR.lib
TKIGES.lib
TKIVtk.lib
TKIVtkDraw.lib
TKLCAF.lib
TKMath.lib
TKMesh.lib
TKMeshVS.lib
TKOffset.lib
TKOpenGl.lib
TKPrim.lib
TKQADraw.lib
TKRWMesh.lib
TKService.lib
TKShapeView.lib
TKShHealing.lib
TKStd.lib
TKStdL.lib
TKSTEP.lib
TKSTEP209.lib
TKSTEPAttr.lib
TKSTEPBase.lib
TKSTL.lib
TKTInspector.lib
TKTInspectorAPI.lib
TKTObj.lib
TKTObjDRAW.lib
TKToolsDraw.lib
TKTopAlgo.lib
TKTopTest.lib
TKTreeModel.lib
TKV3d.lib
TKVCAF.lib
TKView.lib
TKViewerTest.lib
TKVInspector.lib
TKVRML.lib
TKXCAF.lib
TKXDEDRAW.lib
TKXDEIGES.lib
TKXDESTEP.lib
TKXMesh.lib
TKXml.lib
TKXmlL.lib
TKXmlTObj.lib
TKXmlXCAF.lib
TKXSBase.lib
TKXSDRAW.lib
2、复制上面所有lib文件名粘贴到Linker-Input-Additional Dependencies
注意:是添加所有文件,不止上面红色框中的
二、编写代码
网上有很多资料把OCC分别写入doc文件和view文件,我这边因为项目需要,所以OCC全部在view文件下完成
OCCMFCView.h添加:
#include <Graphic3d_GraphicDriver.hxx>
#include <AIS_InteractiveContext.hxx>
public:
Handle(Graphic3d_GraphicDriver) m_GraphicDriver