Importing Ascii files
Moderator: andrew
Importing Ascii files
As a programming hobbyist, I am thinking about the idea of extending QCAD's facility to import ascii points. The most practical approach would be to further develop the existing facility but I need to know how the relevant source code can be accessed and where it resides in the binaries. Can anyone help me with that?
Re: Importing Ascii files
You can find the example scripts under "scripts" in your QCAD installation or in our git repository:
https://github.com/qcad/qcad/tree/maste ... portPoints
https://github.com/qcad/qcad/tree/maste ... portPoints
Re: Importing Ascii files
hi,
Points from a CSV file ... kinda ASCII with a certain format ... can be imported with DrawFromCSV.
The tools allows importing most basic shapes from a CSV file. Usually sourced from a spreadsheet.
https://qcad.org/rsforum/viewtopic.php?t=8135
Also, one could simply use the multi line capabilities of the command line.
Copy the point data, start the point tool (PO) and paste the list in the command line.
The list should then be formatted according your QCAD native settings.
Menu .. App.Prefs .. General .. Coordinate Format (Ctrl.+,)
CVH
Points from a CSV file ... kinda ASCII with a certain format ... can be imported with DrawFromCSV.
The tools allows importing most basic shapes from a CSV file. Usually sourced from a spreadsheet.
https://qcad.org/rsforum/viewtopic.php?t=8135
Also, one could simply use the multi line capabilities of the command line.
Copy the point data, start the point tool (PO) and paste the list in the command line.
The list should then be formatted according your QCAD native settings.
Menu .. App.Prefs .. General .. Coordinate Format (Ctrl.+,)
- x.xxx,y.yyy (Comma/Dot)
x.xxx;y.yyy (Semicolon/Dot)
x,xxx;y,yyy (Semicolon/Comma)
CVH
Last edited by CVH on Mon May 31, 2021 7:49 am, edited 1 time in total.
Re: Importing Ascii files
Thank you for your response. My intention is not only to plot points but also labels for the point name, elevation and code. Librecad has an excellent facility for that and my idea is to replicate that.
Re: Importing Ascii files
Hi,
If look that up then I come to: https://forum.librecad.org/ASCII-file-f ... 07429.html
N,X,Y,Z,C
Well, I didn't include the Z value throughout the DrawFromCSV tool for the obvious reason that QCAD is 2D.
What are you going to use for N and C?
DFC supports Layers, text and custom properties.
Regards,
CVH
If look that up then I come to: https://forum.librecad.org/ASCII-file-f ... 07429.html
N,X,Y,Z,C
Well, I didn't include the Z value throughout the DrawFromCSV tool for the obvious reason that QCAD is 2D.
What are you going to use for N and C?
DFC supports Layers, text and custom properties.
Regards,
CVH
Re: Importing Ascii files
Land surveyors use CAD to plot topographic maps from ASCII coordinate files that typically list points in the format N,X,Y,Z,C for example: 1,100,25,50,CLR. Here 1 is the point name (N), 50 is the elevation (Z) and C is a description (e.g. CLR = Centreline of Road). The Z value is not plotted as a coordinate but as a label (same as N and C) which gives the spot height of the point. All of this information is contained in an ASCII file supplied by the surveyor.
The requirement is that N, Z and C must all be plotted adjacent to their point location. Is QCAD able to do that?
The requirement is that N, Z and C must all be plotted adjacent to their point location. Is QCAD able to do that?
Re: Importing Ascii files
John: thanks for the details. Sounds straightforward. Do you have a screenshot how this should be rendered? This would be a simple script that imports the CSV and plots the data accordingly.
Re: Importing Ascii files
Sure, with clever programming, all can be achieved.
The point was that before none provided a certain general format with requirements.
The code of 'tomek' should work out: https://qcad.org/rsforum/viewtopic.php?t=7425
Regards,
CVH
Re: Importing Ascii files
The rendering is per tomek's original post. As mentioned, my intention is to replicate the facility provided by Librecad which is coded in QML/C++. I also see from the documentation that it is possible to extend QCAD by means of C++ extensions. Perhaps that will be better than using JavaScript but I will need a sample of the C++ format. To get a better idea of my intention, may I suggest you take a look at the Librecad facility in the top menu >> Plugins >> Read ascii points.
Re: Importing Ascii files
And that is imported as such with the script lower in the topic.
Most/All tools are implemented in EMCAScript: https://github.com/qcad/qcad
Can't keep you from doing it over in C++
Regards,
CVH
Re: Importing Ascii files
Because the Librecad plugin is coded in C++ it makes sense to stay with that if possible. The next step is locating a sample QCAD addon coded in C++ that nserts a menu item and links to the main program with a method to add points/text to the drawing (all in C++ instead of JavaScript). Do you know where I can find that?
Re: Importing Ascii files
This has come up a few times. We will likely add a more universal import of points / labels from CSV for the next release.
Re: Importing Ascii files
The existing "Draw from CSV" doesn't work for me.
With entries as follows I get the message : Unsupported entry. Text line x.
12.5,5.4
7.3,2.5
23.5,5.6
I'd include a screen shot if there was a convenient way of doing that.
With entries as follows I get the message : Unsupported entry. Text line x.
12.5,5.4
7.3,2.5
23.5,5.6
I'd include a screen shot if there was a convenient way of doing that.
Re: Importing Ascii files
DrawFromCSV is set up different.
It can draw most basic shapes from a csv usually sourced from a spreadsheet.
Documentation can be found in the pdf: https://qcad.org/rsforum/viewtopic.php?t=8135#p32813
Example files are included.
A list like:
12.5,5.4
7.3,2.5
23.5,5.6
can be imported by Menu .. Misc .. Import/Export .. Import points.
Or simply by starting the point command and pasting the list in the command line.
If you install the code by 'tomek' as ImportPoints.js under ...\QCAD\scripts\Misc\MiscIO\ImportPoints
Then the standard ImportPoints script is superseded by import survey points.
Regards,
CVH
It can draw most basic shapes from a csv usually sourced from a spreadsheet.
Documentation can be found in the pdf: https://qcad.org/rsforum/viewtopic.php?t=8135#p32813
Example files are included.
A list like:
12.5,5.4
7.3,2.5
23.5,5.6
can be imported by Menu .. Misc .. Import/Export .. Import points.
Or simply by starting the point command and pasting the list in the command line.
If you install the code by 'tomek' as ImportPoints.js under ...\QCAD\scripts\Misc\MiscIO\ImportPoints
Then the standard ImportPoints script is superseded by import survey points.
Regards,
CVH