2D cam software - start

David

Active CAD practitioner
I want to write a simple 2D cam software based on OCCT. NC part extremely simple (more like a teaching software). I want to start simple and ask if you know any 2D cam free (open source) software based on OCCT that I can use as a start point.
 

David

Active CAD practitioner
Thank you JSlyadne, I was not aware of that source and will have a deeper look into it.
 

David

Active CAD practitioner
Still I am not sure, which GUI to use. It just need to run on Windows. But MFC seems outdated and the C# might just be useful for visualization but not interaction (probably). Any idea which GUI to use to have long term possibility with OpenCascade ?
 

DanB

CAD community veteran
Still I am not sure, which GUI to use. It just need to run on Windows. But MFC seems outdated and the C# might just be useful for visualization but not interaction (probably). Any idea which GUI to use to have long term possibility with OpenCascade ?
I'd say Qt for sure. Probably the most developed GUI framework out there.
 

JSlyadne

Administrator
Staff member
Still I am not sure, which GUI to use. It just need to run on Windows. But MFC seems outdated and the C# might just be useful for visualization but not interaction (probably). Any idea which GUI to use to have long term possibility with OpenCascade ?
If the desktop and Windows are the targets, then I would say there are 2 vendors of GUI framework (exclude imgui as it's not the GUI framework but UI library as far as I know) - Windows and Qt.

Qt approaches GUI development with the Widgets and Quick/QML UI packages. The last one is preferable if the brand-looking, highly customizable UI with the unified UX for all platforms and devices is important for you. The main idea behind Quick/QML is to separate the business logic from presentation (how the application looks: style, fonts, colors) where the presentation level can be delegated to the designers, not developers. This results, as broadly believed, to the level up of complexity in comparison to the Widgets because of the necessity to establish the communication bridge between native C++ level and QML (javascript-based language from Qt). However, personally, I wouldn't go with this opinion. I enjoy the freedom Quick/QML gives to me and don't suffer from the specifics mentioned above (great thanks to the documentation and examples the Qt team shares).

Regarding the GUI frameworks by Windows, I would say the things are trickier. Windows frameworks and technologies are:
  • MFC is officially not supported from Windows 8 if I'm not mistaken.
  • Windows Forms. This framework is based on Win32 API and .Net technologies with C# language, and seems more dead than alive.
  • WPF (Windows Presentation Presentation). It was born back in 2006 and followed the same idea as Qt Quick/QML. This framework is also based on Win32 API and .Net technologies with C#, but for visual layer you supposed to use the XAML (XML-based markup language) language. This framework seems also to be on pause for a long time.
  • UWP (Universal Windows Platform) was introduced in Windows 10 and is available for all devices (mobile, desktop, console, hololens, etc.) run by Windows 10+. The UWP brings the application model of the sandbox where the application is restricted to use the system resources, however, with the latest updates it should be possible to choose the application model - traditional Win32 or sandbox. The applications of the "sandbox" app model are distributed by Windows Store. In regards to the development of the visual layer, there are UWP XAML frameworks and UWP XAML controls, both part of the WinUI package, so the same to WPF you're supposed to use XAML language. The C++ is supported for the development of the business logic in UWP, unlike WPF and WinForms.
So, to conclude, I would not say that OpenCascade should be considered as a major factor for making a decision on what technology and GUI framework to choose. If I were you, I would decide on the preferable deployment and development strategy, and consequently, whether it's Qt, Windows, Web, or Native, and then check if OpenCascade graphics (the other packages of OpenCascade are not so sensitive) works, if it can at all, with the selected framework.
 

David

Active CAD practitioner
Hallo JSlyadne,

Thank you for the very thoroughful explanations and recommendations. UWP sounds good, as it were in C++ like OpenCascade. But I never saw a sample coming along with OpenCascade for it, so I wonder if were a development involved in using OpenCascade with UWP GUI. If there is any sample that you are aware of, please provide it.
So far I came to the conclusion to use MFC as I am not sure if the C# OCCTProxy.dll wrapper is useful for visualization or also for interactive features.
 

David

Active CAD practitioner
@Quaoar: I am close to giving up. I installed OpenCascade 7.6.0 on a new Windows 11 machine. I have installed VS 2022, CMake 3.23 and then I tried from QT 6 down to QT4 all but without success.
Last one I tried was QT 5.12.5. getting fault from CMake:

CMake Error at adm/cmake/occt_toolkit.cmake:35 (include_directories):
include_directories given empty-string as include directory.
Call Stack (most recent call first):
CMakeLists.txt:14 (include)
samples/qt/FuncDemo/CMakeLists.txt:4 (OCCT_INCLUDE_CMAKE_FILE)


CMake Error at adm/cmake/qt_macro.cmake:48 (qt4_wrap_cpp):
Unknown CMake command "qt4_wrap_cpp".
Call Stack (most recent call first):
adm/cmake/occt_toolkit.cmake:222 (FIND_AND_WRAP_MOC_FILES)
CMakeLists.txt:14 (include)
samples/qt/FuncDemo/CMakeLists.txt:4 (OCCT_INCLUDE_CMAKE_FILE)

What is a working combination within OCC with QT? Is Windows 11 not useful ? Shall it be another Visual Studio version or has it to be another compiler though ? Or which QT version shall I try ?
Shall I step down to OCCT 7.4.0 and maybe stepping down to QT 4.8.6 ? with another compiler ?
 

DanB

CAD community veteran
Qt4 is quite old, while I have not seen any projects using Qt6 together with OCCT. The examples that come with OCCT is from my knowledge based on Qt5. So I would say that Qt5 and OCCT 7.6.0 is the safest bet.

What msvc compiler are you using?
 

JSlyadne

Administrator
Staff member
Hallo JSlyadne,

Thank you for the very thoroughful explanations and recommendations. UWP sounds good, as it were in C++ like OpenCascade. But I never saw a sample coming along with OpenCascade for it, so I wonder if were a development involved in using OpenCascade with UWP GUI. If there is any sample that you are aware of, please provide it.
So far I came to the conclusion to use MFC as I am not sure if the C# OCCTProxy.dll wrapper is useful for visualization or also for interactive features.
I suppose the samples basing on WPF are a good point to start even you're going to deal with UWP apps, at least the integration of OpenCascade graphical services should be more or less the same. Take a look at CSharp samples inside OpenCascade installation package.
 

JSlyadne

Administrator
Staff member
@Quaoar: I am close to giving up. I installed OpenCascade 7.6.0 on a new Windows 11 machine. I have installed VS 2022, CMake 3.23 and then I tried from QT 6 down to QT4 all but without success.
Last one I tried was QT 5.12.5. getting fault from CMake:

CMake Error at adm/cmake/occt_toolkit.cmake:35 (include_directories):
include_directories given empty-string as include directory.
Call Stack (most recent call first):
CMakeLists.txt:14 (include)
samples/qt/FuncDemo/CMakeLists.txt:4 (OCCT_INCLUDE_CMAKE_FILE)


CMake Error at adm/cmake/qt_macro.cmake:48 (qt4_wrap_cpp):
Unknown CMake command "qt4_wrap_cpp".
Call Stack (most recent call first):
adm/cmake/occt_toolkit.cmake:222 (FIND_AND_WRAP_MOC_FILES)
CMakeLists.txt:14 (include)
samples/qt/FuncDemo/CMakeLists.txt:4 (OCCT_INCLUDE_CMAKE_FILE)

What is a working combination within OCC with QT? Is Windows 11 not useful ? Shall it be another Visual Studio version or has it to be another compiler though ? Or which QT version shall I try ?
Shall I step down to OCCT 7.4.0 and maybe stepping down to QT 4.8.6 ? with another compiler ?

First of all, no panic, not stress! Keep trying - no reason to give up, what you're trying to do is possible :)

Apart of motivation... If look inside the "qt.cmake" configuration file (aimed to set up the Qt environment) of OpenCascade, we see this -

1646295988152.png

what makes me think that Qt5 was not found, and so, the procedure felt down to the "qt4_wrap_cpp()" method, and since Qt4 is not installed, you got the message saying this.

So, at this point you need first to understand why Qt5 isn't found. OpenCascade expects you to point the 3RDPARTY_QT_DIR variable to .../Qt/6.2.3/msvc2019_64/bin. Do that and then make sure that 3RDPARTY_QT_DIR still points where you set - it's a mark that everything is in the order.
 

David

Active CAD practitioner
Regarding Qt4 this is true, but I tried all variants. Regarding the Qt examples I understand your point and will try it.
Most probably an experienced user has no problem to adapt the "minor" issues.
What I miss is a recommended set of software versions that are proven to work without any issue. E.g. VS2022, Version 17.1 + OCCT 7.6.0 + Qt5.12.5. and 3rd parties libraries:.... and so forth. Quaoar did show in one of his tutorials a working system, that is why I used Qt 4.8.2 version but obviously, there is setup work to do if you deviate from this proven path. These minor changes are difficult for me now as I am on the learning path of OCCT and now additionally QT.
First of all, no panic, not stress! Keep trying - no reason to give up, what you're trying to do is possible :)

Apart of motivation... If look inside the "qt.cmake" configuration file (aimed to set up the Qt environment) of OpenCascade, we see this -

View attachment 174

what makes me think that Qt5 was not found, and so, the procedure felt down to the "qt4_wrap_cpp()" method, and since Qt4 is not installed, you got the message saying this.

So, at this point you need first to understand why Qt5 isn't found. OpenCascade expects you to point the 3RDPARTY_QT_DIR variable to .../Qt/6.2.3/msvc2019_64/bin. Do that and then make sure that 3RDPARTY_QT_DIR still points where you set - it's a mark that everything is in the order.
Hallo JSlyadne,
thank you for the encouraging message. No, I never give up. Although I am quite sure, I had the set-up as you request, I will evidently try it accordingly. I will keep you updated and if I find a working mode, I will post it.
 

JSlyadne

Administrator
Staff member
Regarding Qt4 this is true, but I tried all variants. Regarding the Qt examples I understand your point and will try it.
Most probably an experienced user has no problem to adapt the "minor" issues.
What I miss is a recommended set of software versions that are proven to work without any issue. E.g. VS2022, Version 17.1 + OCCT 7.6.0 + Qt5.12.5. and 3rd parties libraries:.... and so forth. Quaoar did show in one of his tutorials a working system, that is why I used Qt 4.8.2 version but obviously, there is setup work to do if you deviate from this proven path. These minor changes are difficult for me now as I am on the learning path of OCCT and now additionally QT.

Hallo JSlyadne,
thank you for the encouraging message. No, I never give up. Although I am quite sure, I had the set-up as you request, I will evidently try it accordingly. I will keep you updated and if I find a working mode, I will post it.
The configuration you mentioned, namely OCCT 7.6.0 in combination with Qt5.12.5, is definitely a working combination. Post more information about the failures you face.
 

David

Active CAD practitioner
went to:
downloaded there the file: opencascade-7.6.0.tgz
unpacked it to e.g. c:\Users\Public\opencascade-7.6.0

went to:
clicked on Windows32
under Products vc14 downloaded the following 64bit products:
FFmpeg 3.3.4
Freeimage 3.17.0
Freetype 2.5.5
unpacked them to e.g. c:\Users\Public\3rd_party

went to https://visualstudio.microsoft.com/de/downloads/
download the Community Version 17.1 and installed it

downloaded the file qt-opensource-windows-x86-5.12.5.exe
installed it not under c:\qt\Qt5.12.5. but under c:\Qt .
Just selected the following component: MSVC2017 64 bit

installed CMake 3.23.0-rc2.
when starting it: Browse Source the source code: C:\Users\Public\opencascade-7.6.0
and in "Where to build the binaries": C:\Users\Public\opencascade-7.6.0-build
Clicked Configure. Then selected: generator for the project: Visual Studio 17 2022, use default native compilers and clicked "Finish".

Then I got the error:
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
The C compiler identification is MSVC 19.31.31104.0
The CXX compiler identification is MSVC 19.31.31104.0
Detecting C compiler ABI info
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.

It fails with the following output:
Change Dir: C:/Users/Public/opencascade-7.6.0-build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_f6251.vcxproj /p:Configuration=Debug /p:platform=x64 /p:VisualStudioVersion=17.0 /v:m && Microsoft (R)-Build-Engine, Version 17.1.0+ae57d105c fr .NET Framework
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten
Microsoft (R) C/C++-Optimierungscompiler Version 19.31.31104 fr x64
testCCompiler.c
C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\testCCompiler.c : fatal error C1090: Fehler beim PDB-API-Aufruf, Fehlercode "3": C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\cmTC_f6251.dir\Debug\vc143.pdb [C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\cmTC_f6251.vcxproj]
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_f6251.dir\Debug\\" /Fd"cmTC_f6251.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue "C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\testCCompiler.c"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:39 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/Public/opencascade-7.6.0-build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Public/opencascade-7.6.0-build/CMakeFiles/CMakeError.log".



In the CMakeError.log I find the following:

Detecting C compiler ABI info failed to compile with the following output:
Change Dir: C:/Users/Public/opencascade-7.6.0-build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_63662.vcxproj /p:Configuration=Debug /p:platform=x64 /p:VisualStudioVersion=17.0 /v:m && Microsoft (R)-Build-Engine, Version 17.1.0+ae57d105c fr .NET Framework
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Microsoft (R) C/C++-Optimierungscompiler Version 19.31.31104 fr x64
CMakeCCompilerABI.c
C:\Program Files\CMake\share\cmake-3.23\Modules\CMakeCCompilerABI.c : fatal error C1090: Fehler beim PDB-API-Aufruf, Fehlercode "3": C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\cmTC_63662.dir\Debug\vc143.pdb [C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\cmTC_63662.vcxproj]
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_63662.dir\Debug\\" /Fd"cmTC_63662.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue "C:\Program Files\CMake\share\cmake-3.23\Modules\CMakeCCompilerABI.c"
Determining if the C compiler works failed with the following output:
Change Dir: C:/Users/Public/opencascade-7.6.0-build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_f6251.vcxproj /p:Configuration=Debug /p:platform=x64 /p:VisualStudioVersion=17.0 /v:m && Microsoft (R)-Build-Engine, Version 17.1.0+ae57d105c fr .NET Framework
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Microsoft (R) C/C++-Optimierungscompiler Version 19.31.31104 fr x64
testCCompiler.c
C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\testCCompiler.c : fatal error C1090: Fehler beim PDB-API-Aufruf, Fehlercode "3": C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\cmTC_f6251.dir\Debug\vc143.pdb [C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\cmTC_f6251.vcxproj]
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_f6251.dir\Debug\\" /Fd"cmTC_f6251.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue "C:\Users\Public\opencascade-7.6.0-build\CMakeFiles\CMakeTmp\testCCompiler.c"


Any help appreciated.
 

JSlyadne

Administrator
Staff member
Then I got the error:
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
The C compiler identification is MSVC 19.31.31104.0
The CXX compiler identification is MSVC 19.31.31104.0
Detecting C compiler ABI info
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):

I'm succeed in building a solution file for OCC v7.6 for VS 2022 and Windows 10 64bit. Let's keep Qt aside for a while since the error happens before Qt engaging. So it's a good sign.

However, I never use a source package from the web-site, I use Git for that. Can you try to do the same? Clone OCCT repo from GitHub, https://github.com/Open-Cascade-SAS/OCCT, and switch to the branch tagged by v760.
 
Last edited:
Top