SkillAgentSearch skills...

NEPath

toolpath planning for additive manufacturing and CNC milling

Install / Use

/learn @WangY18/NEPath

README

NEPath

A Classical Toolpath and Optimization-Based Non-Equidistant Toolpath Planning Library (C++ / Python)

License

The NEPath library plans toolpaths for additive manufacturing (AM, 3D printing) and CNC milling. Toolpath planning is to generate some 1D toolpaths to filling given 2D slices. The NEPath library is able to plan the following toolpaths: (See the end of the document for visualized examples.)

  • Optimization-based non-equidistant toolpath:
    • Isoperimetric-Quotient-Optimal Toolpath (IQOP). (Recommended)
    • Variants of IQOP, like toolpaths that minimizing the perimeter, the isoperimetric quotient, and the area.
  • Classical toolpath:
    • Contour-Parallel Toolpath (CP).
    • Zigzag Toolpath.
    • Raster Toolpath.
  • Toolpath connection:
    • Connected Fermat Spiral (CFS). (Recommended)
    • Depth First Search (DFS).
  • Other functions:
    • Tool Compensating.
    • Calculating underfill rate.
    • Determining sharp corners.

Citing

If you need to use the NEPath project, please cite the following article. (Our RCIM journal paper proposed optimization-based non-equidistant toolpaths including IQOP.)

Wang Y, Hu C, Wang Z, et al. Optimization-based non-equidistant toolpath planning for robotic additive manufacturing with non-underfill orientation[J]. Robotics and Computer-Integrated Manufacturing, 2023, 84: 102599.

or in BiBTeX:

@article{wang2023optimization,
  title={Optimization-based non-equidistant toolpath planning for robotic additive manufacturing with non-underfill orientation},
  author={Wang, Yunan and Hu, Chuxiong and Wang, Ze and Lin, Shize and Zhao, Ziyan and Zhao, Wenxiang and Hu, Kehui and Huang, Zhongyi and Zhu, Yu and Lu, Zhigang},
  journal={Robotics and Computer-Integrated Manufacturing},
  volume={84},
  pages={102599},
  year={2023},
  publisher={Elsevier}
}

Statement and Dependence

  • This project cites AngusJohnson/Clipper1 as a dependent package.

  • This project depends on Gurobi OR Ipopt optimizer for solving quadratically constrained quadratic program with second-order cone constraints. If you don't need IQOP and other optimization-based toolpaths, you can unable the modules to avoid the dependence of Gurobi and Ipopt. Please refer to the tutorials for specified languages for details. We also welcome pull request if you achieve IQOP based on other optimizers.

  • The authors would like to sincerely thank <mark>Jelle Feringa</mark> for his significant contribution, providing a Python wrapper and a version that generates non-equidistant paths using IPOPT. We plan to refactor and properly repackage this library in the near future.

Supported Languages and Tutorials

The source of NEPath is achieved in C++. Based on some bindings, the supported languages include:

Introduction to IQOP

Framework

IQOP is an optimization-based non-equidistant toolpath planning method for AM and CNC milling. IQOP tries to optimize the smoothness and material cost of the child toolpath from a parent toolpath. IQOP has the following advantages:

  • Compared with the equidistant toolpath, i.e., CP, IQOP can generate smooth toolpaths. Specially, toolpaths insides tends to transform into a smooth circle.
  • IQOP can be applied for slices with arbitrary shapes and topological holes. Extra toolpaths would be added if underfill with large area exists.
  • IQOP achieves obviously lower underfill rates, higher printing efficiency, and higher toolpath smoothness than CP.
  • A general framework of non-equidistant toolpath planning for complex slices is provided.
<p align="center"> <img src="https://user-images.githubusercontent.com/75420225/229330834-c5703971-8983-416b-af8d-ca3f9a1ab629.png" alt="gallery" /> </p> <p align="center"> <b>Figure.</b> Some demos of IQOP. </p> <p align="center"> <img src="https://user-images.githubusercontent.com/75420225/229330954-a3efbecf-21c8-4343-8951-ee5c9c322d86.png" alt="different_object_functions" width="500" /> </p> <p align="center"> <b>Figure.</b> Toolpaths generated by different object functions. (a) Minimize the isoperimetric-quotient to improve smoothness and obtain circles. (b) Minimize the perimeter to concentrate the vertex angles and obtain a convex polygon. (c) Minimize the area to reduce material cost to obtain equidistant toolpaths. </p> <p align="center"> <img src="https://user-images.githubusercontent.com/75420225/229330959-f6500987-c805-4bfe-b291-896692b17eaf.png" alt="different_weight" width="500" /> </p> <p align="center"> <b>Figure.</b> Toolpaths generated by different weighting coefficient λ. The objective is to minimize Q+λS. </p>

More details of IQOP would be provided after the article is published.

Optimization Problem of IQOP

The toolpaths can be planned by offsetting non-equidistantly. The offsetting distances $(\delta_i)_{i=1}^n$ can be seen as optimization variables. $\delta_i$ is the offsetting distance at $(x_i,y_i)$.

<p align="center"> <img src="https://github.com/WangY18/NEPath/assets/75420225/169ab971-35b6-42b3-a1ce-8fa356532902" alt="Underfill" height="200" /> </p> <p align="center"> <b>Figure.</b> Optimization variables. </p> Given $l$, the optimization problem for generating $\tilde{l}$ can be written as: <p align="center"> <img src="https://github.com/user-attachments/assets/e617e046-9342-4383-b8e7-39a21c01881e" alt="optimization_problem" height="220" /> </p> In our paper [`Optimization-Based Non-Equidistant Toolpath Planning for Robotic Additive Manufacturing with Non-Underfill Orientation`](https://doi.org/10.1016/j.rcim.2023.102599), the above optimization problem is convexified, and the problem of self-intersection is solved. The above method can be applied for slices with arbitrary shapes and topological structures.

What can NEPath Library do?

Toolpath Generation

IQOP (Isoperimetric-Quotient-Optimal Toolpath, Wang Y et al., 2023)

You can plan non-equidistant toolpaths based on different optimizer.

Based on Gurobi
<p align="center"> <img src="https://github.com/WangY18/NEPath/assets/75420225/6f5a6369-1eda-444f-838b-c260aac58ecf" alt="IQOP-gurobi" height="300" /> </p> <p align="center"> <b>Figure.</b> IQOP toolpath minimizing Q based on gurobi. </p> <p align="center"> <img src="https://github.com/WangY18/NEPath/assets/75420225/65b5b1a7-ebc4-4f8b-b2d0-f72352afda9d" alt="IQSOP-gurobi" height="300" /> </p> <p align="center"> <b>Figure.</b> IQOP toolpath minimizing Q+1.0S based on gurobi. </p> <p align="center"> <img src="https://github.com/WangY18/NEPath/assets/75420225/aac675c2-644e-4ff2-b608-36d26226fc26" alt="IQLOP-gurobi" height="300" /> </p> <p align="center"> <b>Figure.</b> IQOP toolpath minimizing L based on gurobi. </p>
Based on Ipopt

The IQOP paths generated by IPOPT often fail to achieve the near-perfect circularity that can be attained by Gurobi.

<p align="center"> <img src="https://github.com/user-attachments/assets/a7c03420-5131-446a-8f8b-6a6174281012" alt="IQOP-ipopt" height="300" /> </p> <p align="center"> <b>Figure.</b> IQOP toolpath minimizing Q based on ipopt. </p>

CP (Contour-Parallel)

You can plan traditional contour-parallel (equidistant) toolpaths.

<p align="center"> <img src="https://user-images.githubusercontent.com/75420225/229331109-58155b93-d897-4553-b923-28be4eecfee1.png" alt="CP" height="300" /> </p> <p align="center"> <b>Figure.</b> CP toolpath. </p>

Zigzag

You can plan Zigzag toolpaths.

<p align="center"> <img src="https://user-images.githubusercontent.com/75420225/229331070-887c0172-7ad4-42dd-85a1-6c35f09a6cc4.png" alt="zigzag" height="300" /> </p> <p align="center"> <b>Figure.</b> Zigzag toolpath. </p>

Raster

You can plan Raster toolpaths.

<p align="center"> <img src="https://user-images.githubusercontent.com/75420225/229333683-670c0890-1a34-4e2a-b1ca-5de918815e09.png" alt="raster" height="300" /> </p> <p align="center"> <b>Figure.</b> Raster toolpath. </p>

Toolpath Connection

CFS Connector

The Connected Fermat Spiral (CFS) can connect separate IQOP toolpaths into a single one. CP can be connected by CFS in the same way.

<p align="center"> <img src="https://github.com/user-attachments/assets/38b01606-ff3e-4149-89c8-39335ed70ac3" alt="iqop_cfs" height="300" /> </p> <p align="center"> <b>Figure.</b> IQOP connected by CFS. </p>

DFS Connector

The Depth First Search (DFS) approach can connect separate IQOP toolpaths into a single one. CP can be connected by DFS in the same way.

<p align="center"> <img src="https://github.com/user-attachments/assets/c03acb4f-c14f-40b9-81f5-ad49f758611d" alt="iqop_dfs" height="300" /> </p> <p align="center"> <b>Figure.</b> IQOP connected by DFS. </p>

Others

Tool compensate

We recommend that the tool compensate function should be called before planning toolpaths to avoid overfill at edges of slices. Both outside and inside contours are supported.

<p align="center"> <img src="https://user-images.githubusercontent.com/75420225/229334415-da87d12b-8c18-4a2b-b646-a8fe7558b06e.png" alt="Tool compensate" height="300" /> </p> <p align="center"> <b>Figure.</b> Tool compensate. </p>

Under

Related Skills

View on GitHub
GitHub Stars59
CategoryDevelopment
Updated4d ago
Forks21

Languages

C++

Security Score

100/100

Audited on Mar 25, 2026

No findings