Concave Hull Function?

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
Dauu
Newbie Member
Posts: 5
Joined: Wed Jun 23, 2021 4:58 pm

Concave Hull Function?

Post by Dauu » Sat Jun 26, 2021 8:56 pm

I have set of many points .
Is there any concave hull function or plugin instead of manual connection with line tool? :(

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Concave Hull Function?

Post by Husky » Sat Jun 26, 2021 9:18 pm

For all support requests, please:
- Indicate the operating system you are using and the version thereof (e.g. Windows 10 32bit, Windows 8.1 64bit, Ubuntu 14.2 64bit, macOS 10.12, etc.)
- Indicate the exact version of QCAD you are using (see "Help" > "About" or "QCAD" > "About QCAD" or indicate the name of the file you have downloaded and installed)
- Attach original drawing files (DXF, DWG, ...) if appropriate
- Attach exported files (SVG, PNG, PDF, G-Code, ...) if appropriate
- Include screenshots if appropriate
- If there is an error message, indicate the exact message or include a screenshot of the message
- Indicate what post processor you are using
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Concave Hull Function?

Post by andrew » Sat Jun 26, 2021 9:22 pm

Not as a ready-made tool, but you can do it with a bit of scripting in the script shell (Misc > Development > Script Shell).

First select only the points, then paste this simple code in to the script shell command prompt:

Code: Select all

var doc = getDocument();
var ids = doc.querySelectedEntities();
var points = [];
for (var i=0; i<ids.length; i++) { var e=doc.queryEntity(ids[i]); points.push(e.getPosition()); }
var pl = RPolygonHull.getConcaveHull(points, 0.1);
addShape(pl);
Notes:
- There is no error handling in this code and you will get an exception if you select other entities than points.
- 0.1 is the concavity (smaller is more detailed, larger less detailed or even convex for very large numbers).
- This works in QCAD Professional or QCAD/CAM

Post Reply

Return to “QCAD 'How Do I' Questions”