UPDATED: Import and draw entities from a CSV file

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 1559
Joined: Wed Sep 27, 2017 4:17 pm

UPDATED: Import and draw entities from a CSV file

Post by CVH » Thu Feb 18, 2021 3:45 pm

Based on the same basic principle as these:
viewtopic.php?t=7497
https://qcad.org/rsforum/viewtopic.php?t=7544

And posted especially for Kramerica:
https://qcad.org/rsforum/viewtopic.php?f=32&t=8116

Installation:
Close QCAD
Create a new folder ...QCAD\scripts\Misc\Examples\IOExamples\DrawFromCSV (Mandatory)
The script file is called ...QCAD\scripts\Misc\Examples\IOExamples\DrawFromCSV\DrawFromCSV.js (Mandatory)

Simply copy the files and the icon over to the DrawFromCSV folder.
Start QCAD
There should be a newly added menu item under Misc .. Script Examples .. Import/Export
It should have an icon.
The command is 'drawcsv' but I can't come up with a good and available shortcut.

There are two test files included:
- One for the 'real' CSV style with comma and dot.
- One for the CSV style with semicolon and comma.
- Semicolon and dot is also accepted.
- The script looks up your local QCAD list separator setting. (mine is the EU style)
- What to include in a CSV is also listed in the test files.

Scripts are textual files, a lot of readable info is in the script itself.

Any comment or request welcome.
Only don't ask me for money or world peace. :wink:

The script may be completed and updated in due time.
This one is hustled together with copy/paste.

Kind regards,
CVH

*** EDIT ***
This is the Beta version and was downloaded 46 times before the update.
Please see lower for the latest release.
The latest version might be included in the latest (snapshot) release of QCAD.

*** EDIT ***
I can confirm that DrawFromCSV is included in the standard installation 3.26.2.0.
*** EDIT ***
Attachments
DrawFromCSV.zip
(22.43 KiB) Downloaded 140 times
Last edited by CVH on Thu May 06, 2021 5:05 pm, edited 7 times in total.

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

Update: Import and draw entities from a CSV file

Post by CVH » Wed Apr 07, 2021 4:54 am

Major update 3.01:
DrawFromCSV.png
Result from DrawCSV_test.csv (or EU)
DrawFromCSV.png (34.61 KiB) Viewed 2900 times
Supports:
- Different CSV styles
- Layer handling, layer attributes
- Entity general attributes
- Entity custom properties
- Custom origin (logical UCS), last relative position (conform QCAD).
- Absolute, relative & relative/polar notation.

Draws:

- Point, Line, Vector, Ray, XLine
- Arc, Arc3P, Circle, Circle+P, Circle3P
- Triangle, Square, Rectangle, Quad, Polygon
- Polyline, FitSpline, ControlSpline
- Text

Extra:

- LineTo, VectorTo, ArcTo+A, ArcTo+R (Starting from the last position)
- Solids: 3 & 4 point solids
- Select all / Zoom to all

Included are documentation, test and example files.
Scripts are textual files, a lot of readable info is in the script itself.
CSV files include comments.

Andrew is provided in a copy that might be included under Misc .. Import/Export in future releases of QCAD.
Any comment or request is welcome.

Kind regards,
CVH
DrawFromCSV_v3.01.zip
Complete zip package
(624.38 KiB) Downloaded 122 times
DrawCSV_doc.pdf
Method documentation
(83.33 KiB) Downloaded 132 times
Immediate installation:
Close QCAD
Create a new folder ...QCAD\scripts\Misc\Examples\IOExamples\DrawFromCSV (Mandatory)
The script file is called ...QCAD\scripts\Misc\Examples\IOExamples\DrawFromCSV\DrawFromCSV.js (Mandatory)
Simply copy the files, icons and subfolders over to the DrawFromCSV folder.
Start QCAD

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

Re: Import and draw entities from a CSV file

Post by andrew » Wed Apr 07, 2021 10:29 am

Thanks for your contribution!

I've added this to https://github.com/qcad/qcad/tree/maste ... rawFromCSV

Kramerica
Newbie Member
Posts: 8
Joined: Tue Feb 16, 2021 4:04 am

Re: UPDATED: Import and draw entities from a CSV file

Post by Kramerica » Mon Apr 19, 2021 6:47 pm

Looking forward to this update!

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

Re: UPDATED: Import and draw entities from a CSV file

Post by CVH » Thu May 06, 2021 5:02 pm

All,
Downloaded QCAD version 3.26.2.0 just now and installed it.
I can confirm that DrawFromCSV is included in the standard installation. :P

Thanks, Andrew. :wink:

Kind regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”