3D Contour Script

This forum is for 'Work-in-Progress' QCAD user developed script Add Ons and Plug-ins.

Please use this forum to request/submit your script Add-Ons & Plug-in idea's.

Moderators: andrew, J-J, Husky

Post Reply
B110
Newbie Member
Posts: 3
Joined: Sat Sep 28, 2024 5:42 pm

3D Contour Script

Post by B110 » Sat Sep 28, 2024 5:51 pm

Does anybody know of a script that will generate 3D polylines (contours) from a X, Y, Z survey file?
Currently, I use QGIS with some addons to create the contours and then save them as a DXF.
The only problem is that the DXF losses the Z coordinate on the polyline.
It's not the most straigth forward way of doing it, but it somewhat fills the gap at the moment.

Thanks in advance for any tips and comments on this topic.

CVH
Premier Member
Posts: 4957
Joined: Wed Sep 27, 2017 4:17 pm

Re: 3D Contour Script

Post by CVH » Sat Sep 28, 2024 6:45 pm

Hi, and welcome to the QCAD forum.

As far as I know: QCAD reads 3D data from a DXF without any problem, QCAD/CAM relies on that.
QCAD is mainly a 2D application meaning that most drawing tools are intended for 2D only.

Polylines with straight segments are correct in 3D.
A 3D line segment projected to 2D looks like a somewhat shorter line. :wink:

Under QCAD, arcs can only exit in 2D on the Z level of the center.
Polylines with bulging segments (=arcs) can not be saved. (I have no example to load)
But you can tweak them as such in QCAD although they will be rendered faulty in the current session.
A 3D arc-segment projected to 2D is in fact an ellipse-arc. e_geek
(Or a 3D spiral in G-Code perspective)

By default Z coordinates are not shown.
Goto menu Edit .. Application Preferences .. Widgets .. Property Editor .. and allow displaying Z coordinates.

If the source polylines have straight edges then it is of no issue.
Note that QCAD drawing tools may act unexpected ... Weird.

One can import points with labels from a CSV file: Tutorial
But that are no contours. :(

If 2D contours are OK then see: Reusing Drawing Positions
Then you need to filter on the associated points before storing the data points.

If anything else fails then please provide a test case in DXF or CSV format.

Regards,
CVH

B110
Newbie Member
Posts: 3
Joined: Sat Sep 28, 2024 5:42 pm

Re: 3D Contour Script

Post by B110 » Tue Oct 01, 2024 3:19 am

Thanks for your comments. At the moment I will continue to use the contour plugin in QGIS and use the Vector Add Z so that the elevation is attached to the contour polyline where I can then export the contours as a DXF file where the Z value is retained and correctly displayed under the Property Editor. It's several extra steps, but at least it works.

CVH
Premier Member
Posts: 4957
Joined: Wed Sep 27, 2017 4:17 pm

Re: 3D Contour Script

Post by CVH » Tue Oct 01, 2024 3:37 am

Hi,

It is not that hard to write a script that takes formatted data form a CSV point list and connects the dots in 3D.
A polyline with straight segments.
With more than one contour it requires some marker where one string ends and the next begins.
An empty line for example.

Usability under QCAD will be limited.
The length of the polyline is measured in 3D, the enclosed area not.
QCAD 2D drawing tools can be misled by a non-zero Z parameter.

Regards,
CVH

B110
Newbie Member
Posts: 3
Joined: Sat Sep 28, 2024 5:42 pm

Re: 3D Contour Script

Post by B110 » Tue Oct 01, 2024 3:56 am

I'll continue to use QGIS to create contours and then export them into QCAD since I figured out how to use the Z Added Vector option to the generated contours in QGIS in order for the Z feature to be included with the exported DXF.
Thanks for your comments and suggestions.

Roger

Post Reply

Return to “QCAD 'Script Add-On & Plug-in challenge' - Work in Progress”