哈利波特的C语言版魔盒工具台hpCBox

Chinese forum
Post Reply
User avatar
johnwang
Posts: 578
Joined: Sun Jan 27, 2019 12:41 am

哈利波特的C语言版魔盒工具台hpCBox

Post by johnwang » Thu Oct 08, 2020 11:08 pm

这个帖子提供了一个python版的工具台例子hpBox。https://forum.freecadweb.org/viewtopic.php?f=40&t=44893

这个帖子用C语言在工具台里添加了一个工具。https://forum.freecadweb.org/viewtopic.php?f=40&t=50934

现在来尝试一下用C语言写工具台hpCBox。

你需要能自己编译FreeCAD。

新的工具台的名字叫hpCBox, 即C语言版的Box工具台。我下载的FreeCAD源码解压在c:\FreeCAD-master目录里。首先把c:\FreeCAD-master\src\Mod\surface复制一份。把复制的目录改成c:\FreeCAD-master\src\Mod\hpCBox。我们在此基础上删减和修改。把其中叫做Surface的,都改成叫hpCBox。
Last edited by johnwang on Fri Oct 09, 2020 12:42 am, edited 1 time in total.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)

User avatar
johnwang
Posts: 578
Joined: Sun Jan 27, 2019 12:41 am

Re: 开始写哈利波特的C语言版魔盒工具台hpCBox

Post by johnwang » Thu Oct 08, 2020 11:20 pm

要编译这个项目,需要用文本编辑器打开C:\FreeCAD-master\src\Mod\CMakeLists.txt文件,加入hpCBox目录:

Code: Select all

if(BUILD_SURFACE)
  add_subdirectory(Surface)
endif(BUILD_SURFACE)

if(BUILD_HPCBOX)
  add_subdirectory(hpCBox)
endif(BUILD_HPCBOX)
这个BUILD_HPCBOX开关需要在C:\FreeCAD-master\cMake\FreeCAD_Helpers\InitializeFreeCADBuildOptions.cmake中加入:

Code: Select all

    option(BUILD_SURFACE "Build the FreeCAD surface module" ON)
    option(BUILD_HPCBOX "Build the FreeCAD hpCBox module" ON)
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)

User avatar
johnwang
Posts: 578
Joined: Sun Jan 27, 2019 12:41 am

Re: 哈利波特的C语言版魔盒工具台hpCBox

Post by johnwang » Fri Oct 09, 2020 12:49 am

下载后解压到src\Mod\hpCBox目录。然后编译。3个项目,右键点击,然后选Build.
solution.jpg
solution.jpg (14.25 KiB) Viewed 408 times
hpCBox.jpg
hpCBox.jpg (28.49 KiB) Viewed 408 times
hpCBox.zip
(12.24 KiB) Downloaded 19 times
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)

Post Reply