尊重作者,支援原創,如需轉載,請附上原位址:
https://blog.csdn.net/libaineu2004/article/details/89053246
先來看看B站的視訊
https://www.bilibili.com/video/BV1Bt4y1y74P
CRC/CNC
Cutter Radius Compensation for Milling machines.
cutter radius compensation
cutter comp
https://github.com/shooter64738/CRC
https://github.com/grbl -- rs274/ngc parser,不支援G40/G41/G42
https://github.com/synthetos/g2
https://github.com/modmaker/BeBoPr
http://gerbv.geda-project.org/
https://github.com/eduard-x/cnc-qt
https://github.com/vlachoudis/bCNC
https://github.com/Smoothieware/Smoothieware ++ http://smoothieware.org/
https://github.com/OpenBuilds
https://github.com/winder/Universal-G-Code-Sender
https://github.com/arkypita/LaserGRBL
https://github.com/svenhb/GRBL-Plotter
https://github.com/cncjs/cncjs
LinuxCNC
http://www.linuxcnc.org/ -- Supports rigid tapping, cutter compensation, and many other advanced control features.
https://github.com/LinuxCNC/linuxcnc
https://github.com/LinuxCNC/linuxcnc/tree/master/src/emc
https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/rs274ngc/interp_convert.cc -- 刀具補償
https://github.com/LinuxCNC/simple-gcode-generators
http://linuxcnc.org/dists/lucid/emc2.4/ linuxcnc老版本名稱叫EMC2,Enhanced Machine Controller (EMC2)
Open CASCADE Technology(簡稱OCCT)
opengl是基礎圖形庫,open cascade是一個進階的CAD開發庫,OCC基礎就是OpenGL。
https://www.opencascade.com/ 官網
https://www.opencascade.com/content/download-center 下載下傳中心
https://www.opencascade.com/content/latest-release 最新版本下載下傳,隻提供x64版本的庫,不提供x86
https://www.opencascade.com/content/previous-releases 曆史版本下載下傳
https://www.opencascade.com/content/3rd-party-components 第三方依賴庫,其中Freetype和Tcl/Tk是必須的
https://dev.opencascade.org/ 開發者平台
https://dev.opencascade.org/doc/overview/html/index.html 開發文檔
https://dev.opencascade.org/doc/overview/html/occt_dev_guides__building.html 環境搭建
https://github.com/topics/opencascade github相關
重量級應用:
1、FreeCAD是一個基于OpenCASCADE的開源CAD/CAE工具。 OpenCASCADE是一套開源的CAD/CAM/CAE幾何模型核心,來自法國Matra Datavision公司,是著名的CAD軟體EUCLID的開發平台。
https://github.com/FreeCAD/FreeCAD
https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Import/App/ImpExpDxf.cpp Dxf檔案解析
https://www.freecadweb.org/
https://www.freecadweb.org/wiki/CompileOnWindows 源碼編譯說明
https://github.com/FreeCAD/FreeCAD-ports-cache/releases 依賴庫官方釋出
https://github.com/apeltauer/FreeCAD/releases 依賴庫非官方純私人釋出,版本比較新
https://github.com/FreeCAD/FreeCAD_Conda 依賴庫新方式
2、heekscad
HeekCAD是一個免費,開源CAD應用程式,作者是Dan Heeks,[email protected]
https://www.opencascade.com/content/heekscad
https://github.com/Heeks/heekscad
https://github.com/Heeks/heekscad/blob/master/src/HDxf.cpp Dxf檔案解析
https://github.com/Heeks/heekscnc
https://github.com/danheeks/dxfconv dxf檔案讀寫
https://github.com/danheeks/HeeksCAM
https://github.com/danheeks/PyCAD
https://github.com/danheeks/PyCAM
https://code.google.com/archive/p/heekscad/downloads
https://code.google.com/archive/p/heekscnc/downloads
https://sites.google.com/site/heekscad/
3、PythonOCC
Python wrapper for Open CASCADE Technology.
http://www.pythonocc.org/
4、cadquery
CadQuery2.0是pythonocc的進階封裝庫,使用了Qt語言作為界面語言,是一款正在起步的指令行模組化軟體,由于pythonocc的使命在于封裝opencascade而非關注界面,那麼對于有界面需求的開發人員,便可以好好關注一下cadquery。
https://github.com/CadQuery/cadquery
5、OpenShapefactory
OpenShapefactory is a Qt-based Geometry Factory that provides a single-point of entry to the most of OCCT geometrical operations.It is a Middle-Man between you, OpenCascade and QT, it serves as a Geometry Factory wrapping OpenCascade, and providing a single-point of entry to the creation of most geometrical operations.
http://code.google.com/p/openshapefactory
6、declaracad
https://github.com/codelv/declaracad
7、mayo
https://github.com/fougue/mayo -- 3D viewer based on OpenCascade,Support of STEP/IGES assemblies (colors and tree structure)
https://github.com/cbernardo/libIGES -- IGES解析
編譯源碼之前,需要在mayo源工程的opencascade.pri檔案手動添加OpenCascade路徑:
# Declare pure QMake variables out of OCC envvars
COMMON_PATH = "D:/My Resources/OpenCASCADE-7.5.0-vc14-64/opencascade-7.5.0"#注意斜杆的方向;引号;
CASCADE_INC_DIR = $${COMMON_PATH}/inc
CASCADE_LIB_DIR = $${COMMON_PATH}/win64/vc14/lib
CASCADE_BIN_DIR = $${COMMON_PATH}/win64/vc14/bin
CASCADE_SRC_DIR = $${COMMON_PATH}/src
8、eryar
https://github.com/eryar/occQt Qt demo
http://www.cppblog.com/eryar/ OCCT精品部落格,[email protected]
https://www.cnblogs.com/opencascade/ 同上
x、其他相關的部落格和輕量級應用:
https://github.com/miho/OCC-CSG -- Simple but powerful CSG tool based on OpenCascade
https://github.com/lvk88/OccTutorial
https://github.com/tpaviot/oce OCE,在OCC基礎上擴充
https://github.com/tianxiao/occsamplemfc MFC demo
http://www.zyh1690.org/cadcg/ 部落格
https://blog.csdn.net/augusdi/article/category/695059 部落格
CAD
1、QCAD
https://www.qcad.org/en/
https://github.com/qcad/qcad
https://qcad.org/en/90-dxflib -- dxflib首頁,配套開源庫
https://github.com/mcneel/opennurbs -- 配套開源庫
https://www.ribbonsoft.com/doc/qcad/latest/developer/
https://www.ribbonsoft.com/doc/qcad/2.2/reference/zh_CN/
最早的版本v2.0.5:https://sourceforge.net/projects/qcadbin-win/
QCAD v2.2.2.1 最後一個v2.x系列的版本
QCAD v3.0.9.0 從v3.x開始使用ECMA Script interface
qcad的dxf讀取在\src\io\dxf\RDxfImporter.cpp
void RDxfImporter::endEntity()
{
QSharedPointer<RSplineEntity> entity(new RSplineEntity(document, RSplineData(spline)));
importEntity(entity);
}
qcad的樣條曲線的繪圖在/src/core/RPainterPath.cpp
void RPainterPath::addSpline(const RSpline& spline) {
int degree = spline.getDegree();
if (degree<=3) {
moveTo(spline.getStartPoint());
}
QList<RSpline> list = spline.getBezierSegments();
for (int i=0; i<list.count(); i++) {
QList<RVector> cps = list[i].getControlPoints();
// very rare splines of degree >= 4:
if ((cps.size()>=5 && degree==cps.size()-1)) {
QList<QSharedPointer<RShape> > segments = spline.getExploded(16);
for (int k=0; k<segments.length(); k++) {
QSharedPointer<RLine> l = segments[k].dynamicCast<RLine>();
if (k==0) {
moveTo(l->getStartPoint());
}
lineTo(l->getEndPoint());
}
}
else if (cps.size()==4 && degree==3) {
cubicTo(cps[1], cps[2], cps[3]);
}
else if (cps.size()==3 && degree==2) {
quadTo(cps[1], cps[2]);
}
else if (cps.size()==2 && degree==1) {
lineTo(cps[1]);
}
else {
qWarning() << "RPainterPath::addSpline: invalid bezier segment: " << list[i];
continue;
}
}
}
//\src\core\RPainterPath.h
void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty) {
QPainterPath::quadTo(ctrlPtx, ctrlPty, endPtx, endPty);
}
void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, qreal endPtx, qreal endPty) {
QPainterPath::cubicTo(ctrlPt1x, ctrlPt1y, ctrlPt2x, ctrlPt2y, endPtx, endPty);
}
//QPainterPath源碼來自Qt官方\Qt\Qt5.12.7\5.12.7\Src\qtbase\src\gui\painting
//cubicTo和quadTo都是用來實作貝塞爾曲線的,那有什麼不一樣呢?
官方是這麼說的:
Same as cubicTo, but the coordinates are considered relative to the current point on this contour.
說白了,就是多了一個控制點而已。
//https://doc.qt.io/qt-5/qpainterpath.html
//https://qtdebug.com/qt-smooth-curve/
2、LibreCAD
LibreCAD 是一款開源免費的 2D CAD 制圖軟體,原名為 CADuntu 。它是基于社群版本 QCad 建構,并利用 Qt4 進行了重構,原生支援 Mac OSX, Windows 和 Linux 。它提供了基于 GPL 協定的讀取/修改/建立 CAD 檔案 (.dxf ) 方案。
LibreCAD最早源自QCad的老版本,v2.0.5,using mingw-5.1.4 and qt-3.3.x-p8.
https://librecad.org/
https://github.com/LibreCAD
https://sourceforge.net/projects/librecad/
LibreCAD v1.0.4 最後一個v1.x系列的版本
LibreCAD v2.0.0alpha2 開始使用c++ boost庫
3、KiCAD EDA
A Cross Platform and Open Source Electronics Design Automation Suite
https://www.kicad-pcb.org/
https://gitlab.com/kicad/code/kicad ++ https://www.wxwidgets.org/ 界面不是用Qt寫的,而是wxWidgets
https://github.com/KiCad/kicad-source-mirror
https://gitlab.com/kicad/code/kicad/-/tree/master/thirdparty/tinyspline_lib 改版的tinyspline,可以和QCAD的dxflib配套
https://github.com/msteinbeck/tinyspline 原版的tinyspline
https://gitlab.com/kicad/code/kicad/-/tree/master/thirdparty/dxflib_qcad 改版的dxflib
https://qcad.org/en/90-dxflib 原版的dxflib
請重點關注https://gitlab.com/kicad/code/kicad/-/blob/master/pcbnew/import_gfx/dxf_import_plugin.cpp,它用dxflib庫解析dxf檔案
\pcbnew\import_gfx\dxf_import_plugin.cpp
#include "tinyspline_lib/tinysplinecpp.h"
void DXF_IMPORT_PLUGIN::insertSpline( int aWidth )
{
unsigned imax = m_curr_entity.m_SplineControlPointList.size();
if( imax < 2 ) // malformed spline
return;
// Use bezier curves, supported by pcbnew, to approximate the spline
tinyspline::BSpline dxfspline( m_curr_entity.m_SplineControlPointList.size(),
/* coord dim */ 2, m_curr_entity.m_SplineDegree );
std::vector<double> ctrlp;
for( unsigned ii = 0; ii < imax; ++ii )
{
ctrlp.push_back( m_curr_entity.m_SplineControlPointList[ii].m_x );
ctrlp.push_back( m_curr_entity.m_SplineControlPointList[ii].m_y );
}
dxfspline.setCtrlp( ctrlp );
dxfspline.setKnots( m_curr_entity.m_SplineKnotsList );
tinyspline::BSpline beziers( dxfspline.toBeziers() );
std::vector<double> coords = beziers.ctrlp();
// Each Bezier curve uses 4 vertices (a start point, 2 control points and a end point).
// So we can have more than one Bezier curve ( there are one curve each four vertices)
for( unsigned ii = 0; ii < coords.size(); ii += 8 )
{
VECTOR2D start( mapX( coords[ii] ), mapY( coords[ii+1] ) );
VECTOR2D bezierControl1( mapX( coords[ii+2] ), mapY( coords[ii+3] ) );
VECTOR2D bezierControl2( mapX( coords[ii+4] ), mapY( coords[ii+5] ) );
VECTOR2D end( mapX( coords[ii+6] ), mapY( coords[ii+7] ) );
m_internalImporter.AddSpline( start, bezierControl1, bezierControl2, end , aWidth );
}
}
\pcbnew\import_gfx\graphics_importer_buffer.h
void ImportTo( GRAPHICS_IMPORTER& aImporter ) const override
{
aImporter.AddSpline( m_start, m_bezierControl1, m_bezierControl2, m_end, m_width );
}
\pcbnew\import_gfx\graphics_importer_pcbnew.cpp
void GRAPHICS_IMPORTER_PCBNEW::AddSpline( const VECTOR2D& aStart, const VECTOR2D& BezierControl1,
const VECTOR2D& BezierControl2, const VECTOR2D& aEnd, double aWidth )
{
unique_ptr<DRAWSEGMENT> spline( createDrawing() );
spline->SetShape( S_CURVE );
spline->SetLayer( GetLayer() );
spline->SetWidth( MapLineWidth( aWidth ) );
spline->SetStart( MapCoordinate( aStart ) );
spline->SetBezControl1( MapCoordinate( BezierControl1 ) );
spline->SetBezControl2( MapCoordinate( BezierControl2 ) );
spline->SetEnd( MapCoordinate( aEnd ) );
spline->RebuildBezierToSegmentsPointsList( aWidth );
if( spline->Type() == PCB_MODULE_EDGE_T )
static_cast<EDGE_MODULE*>( spline.get() )->SetLocalCoord();
addItem( std::move( spline ) );
}
\pcbnew\class_drawsegment.cpp
void DRAWSEGMENT::RebuildBezierToSegmentsPointsList( int aMinSegLen )
{
// Has meaning only for S_CURVE DRAW_SEGMENT shape
if( m_Shape != S_CURVE )
{
m_BezierPoints.clear();
return;
}
// Rebuild the m_BezierPoints vertex list that approximate the Bezier curve
std::vector<wxPoint> ctrlPoints = { m_Start, m_BezierC1, m_BezierC2, m_End };
BEZIER_POLY converter( ctrlPoints );
converter.GetPoly( m_BezierPoints, aMinSegLen );
}
\common\bezier_curves.cpp
void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen )
{
}
4、BRL-CAD
BRL-CAD 是一個構造實體幾何(CSG) 實體模型計算機輔助設計(CAD) 系統。
https://sourceforge.net/projects/brlcad/
https://brlcad.org
5、openscad
https://github.com/openscad/openscad
http://www.openscad.org/ OpenSCAD是一個建立立體3D CAD物體的得力軟體
6、RapCAD
https://github.com/GilesBathgate/RapCAD
7、AnyCAD 國産軟體
http://www.anycad.net/
https://github.com/anycad
8、Vero WorkNC
CNC刀路設計軟體。WorkNC是vero worknc系列軟體的新版本,軟體具有多種自動刀具路徑類型,可以滿足使用者的各種需求,包括粗加工、精加工、優化加工、清根加工、外形輪廓加工、曲線加工及鑽孔等,可以實作全局粗加工刀具路徑通過允許微小刀柄近似來通路更難的區域。
9、Coin3D
https://bitbucket.org/Coin3D/coin/wiki/Home
10、某位大牛的作品
https://www.cnblogs.com/ucancad/
11、NaroCAD
NaroCAD is a fully fledged and extensible 3D parametric modeling CAD application. It is based on OpenCascade.
http://narocad.com/
https://github.com/mikowiec/rhiocad
12、JCAE
JAVA based environment for CAE applications.
http://jcae.sourceforge.net/
13、gCAD3D
http://www.gcad3d.org/
14、boardcad
http://www.boardcad.com/
15、solvespace
http://solvespace.com/index.pl
16、DraftSight 不開源
https://www.3ds.com/products-services/draftsight-cad-software/
17、CAD from a parallel universe
https://github.com/mkeeter/antimony
x、大全集合
https://github.com/mrkaban/Lpro/wiki/%D0%A1%D0%90%D0%9F%D0%A0
http://www.anderswallin.net/open-source-software/
https://sourceforge.net/directory/science-engineering/mechcivileng/caddcam/os:windows/ 可以搜尋到很多開源項目
CAM
CNC Master
https://sourceforge.net/projects/cncmaster/
Techne (R) CAD/CAM
https://sourceforge.net/projects/technecadcam/ 2.5D CAD CAM emphasis on CAM and toolpaths
https://camotics.org/ ++ https://github.com/CauldronDevelopmentLLC/CAMotics
https://github.com/aewallin
https://github.com/aewallin/openvoronoi OpenVoronoi for 2D toolpaths
https://github.com/aewallin/opencamlib OpenCAMLib for 3D toolpaths
http://www.anderswallin.net/CAM/ 文章
http://www.anderswallin.net/open-source-software/ 文章
https://github.com/OpenBuilds/OpenBuilds-CAM Online CNC CAM System,JavaScript
Monocam
DXF2GCODE
dxf2gcode is a tool for converting 2D (dxf, pdf, ps) drawings to CNC machine compatible GCode.
https://sourceforge.net/projects/dxf2gcode/ 與EMC2內建/G0通過路徑優化減少移動/通過Line and Arc's改進了樣條線導入的精度
https://github.com/pcb2gcode pcb2gcode最短路徑
https://sourceforge.net/projects/dxf2gcode/ dxf2gcode: converting 2D dxf drawings to CNC machine compatible G-Code
系統資料庫 HKEY_CURRENT_USER\Software\dxf2gcode
配置檔案 C:\Users\<使用者名>\.config\dxf2gcode
PyCharm python3.7+PyQt5.0學習開源代碼dxf2gcode
PCB Milling/CAM
嘉立創EDA
https://lceda.cn/
https://lceda.cn/editor
PCBMilling
https://wiki.base48.cz/PCBMilling
https://reprap.org/wiki/PCB_Milling
http://solvespace.com/index.pl CRC
https://github.com/solvespace/solvespace Solvespace is open source and claims to export tool paths as gcode with cutter radius compensation
https://github.com/malichao/GerberCAM
https://github.com/SmartMachines/OpenCAM -- Qt
FlatCAM
是免費和開源的 PCB CAM,采用 Python + PyQt編寫,在大多數平台上穩定運作。FlatCAM 是一種為在數控雕刻機上制造 pcb 的數控工作的程式。它将您的 PCB 工程項目生成的 Gerber 檔案,轉換成數控雕刻機通用的 G-Code 代碼。
http://flatcam.org/ -- 2D Computer-Aided PCB Manufacturing
https://bitbucket.org/jpcgt/flatcam
http://flatcam.org/manual/objectreference.html#paint-area 刀補算法使用的是shapely,它是計算幾何庫GEOS的Python包。
https://bitbucket.org/jpcgt/flatcam/src/master/ 穩定版源碼下載下傳
https://bitbucket.org/jpcgt/flatcam/src/Beta/ 最新版beta源碼下載下傳
https://bitbucket.org/jpcgt/flatcam/downloads/ 安裝程式下載下傳
Clipper計算機圖形庫,刀補
https://libaineu2004.blog.csdn.net/article/details/103525859
https://github.com/LibrePCB/LibrePCB
Candle 蠟燭
https://github.com/Denvi/Candle -- GRBL controller application with G-Code visualizer written in Qt
Candle的檔案解析GcodeParser.cpp來源自Will Winder編寫的“ Universal GcodeSender”開源項目。此檔案最初是從“ GcodeViewParse.java”類移植的。而Universal-G-Code-Sender又是基于grbl的java版本。
grbl:使用優化的C語言編寫的開源,嵌入式,高性能g代碼解析器和CNC銑削控制器,将在直接的Arduino上運作。
https://github.com/gnea/grbl
https://github.com/grbl/grbl/wiki
http://bengler.no/grbl
Universal-G-Code-Sender:A Java based GRBL compatible cross-platform G-Code sender.
https://github.com/winder/Universal-G-Code-Sender
https://github.com/winder/Universal-G-Code-Sender/tree/master/test_files 提供了測試用的*.nc檔案
https://github.com/synthetos/TinyG
https://github.com/synthetos/g2
http://smoothieware.org/ ++ https://github.com/Smoothieware/Smoothieware
Cura
https://github.com/Ultimaker/Cura -- 3D printer / slicing GUI built on top of the Uranium framework
https://github.com/Ultimaker/CuraEngine
開源的仿真軟體HOPSAN
Hopsan是一個免費的開源多域系統仿真工具,由林平大學流體與機電系統系開發。
https://github.com/Hopsan/hopsan
SoftPLC, IEC 61131-3
按照工業控制領域常用的IEC61131-3标準來看,工業控制領域程式語言被分為了兩大類五種語言,兩大類是指圖形化程式設計和代碼程式設計,圖形化程式設計中有Ladder(梯形圖),FBD(Function Block Diagram,功能塊圖)和SFC(Sequential Function Chart,序列功能表),而代碼程式設計有IL(Instruction List,指令集)和ST(Structured Text,結構化文本)。
幾個著名的開源項目:
- PLCEdit:完全按照IEC61131标準開發,所有五種語言均支援,使用Python開發,故可以做到跨平台。
- Beremiz:一套完整的開源PLC解決方案,不過放在這裡主要是因為它不但使用了上面說的PLCEdit,同時還對其進行了增強,使得其增加了重要的線上調試功能。推薦!!!
- SoapBox Snap:使用C#+WPF開發的,僅支援梯形圖一種語言,不過卻已經支援了線上調試功能,含模拟器。
- LDmicro: Ladder Logic for PIC and AVR http://cq.cx/ladder.pl && https://github.com/LDmicro/LDmicro
- 國人:https://blog.csdn.net/yunhaiC/article/details/74518176
官網連結:
http://www.plcedit.org/
https://beremiz.org/index.html.en
https://bitbucket.org/skvorl/beremiz/src/default/
https://sourceforge.net/p/beremiz/beremiz/ci/default/tree/
https://github.com/nucleron/beremiz
http://soapboxautomation.com/
https://www.openplcproject.com/plcopen-editor openplc
https://github.com/thiagoralves/OpenPLC-Ladder-Editor
https://github.com/thiagoralves/OpenPLC_v2
https://github.com/starsight/RobotStudio
https://github.com/starsight/iec-compiler