Export ascii or .txt files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Export ascii or .txt files

Surveyor97
Hi, I'm a surveyor. My total station reads .txt files, and I would like to know if theres a way to export points in libreCAD as a .txt file. this would help me out tremendously. Any help is great thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Export ascii or .txt files

SFQ_0
Hi,

As far as I know (surveyor as well) there is no CAD system that can do this on it's own. Even with Autodesk or Bentley systems (with Allplan I'm not that sure) you only get such an output by using extensions, add-ons or 3rd-party software.

A workaround might be to use DXF. Probably your Totalstation can process DXF as well. If not - DXF is basically a text file, as you can see when you open it with an editor. Points are listed as follows:
POINT
  5
32
  8
0
  6
BYLAYER
 62
  256
 10
123457.333
 20
234568.444
  0

[export as DXF R12 - most compatible]

Now you can extract the co-ordinates [123457.333, 234568.444] using a script (or doing it manually), adding a point number and write them into a txt file.

It would be much easier if there was a command, function, tool, whatsoever in LibreCAD telling you the properties (including co-ordinates) of a selected point in the log/command window (like _idpoint or _list in AutoCAD). I haven't found it yet. Then you'd only need to copy that output into a txt file, let work some script on it to add point numbers and do some further formatting.

Hope that helps
Frank
Reply | Threaded
Open this post in threaded view
|

Re: Export ascii or .txt files

dellus
There is Plugins - List Entities.
Not exactly what you are seeking, but maybe with some wonderscript...
Reply | Threaded
Open this post in threaded view
|

Re: Export ascii or .txt files

SFQ_0
Ah, well. That helps. Me, at least.

@Surveyor97: Using this: Plugins - List Entities
and clicking every desired point you get a list as follows in a dialog box (depending on your settings in another language, maybe):

n 1: PUNKT
  Layer: P_3D
  Farbe: BYLAYER
  Linientyp: BYLAYER
  Linienstärke: BYLAYER
  ID: 15895
    im Punkt: X=2677313.3050 Y=1250263.4350

n 2: PUNKT
  Layer: P_3D
  Farbe: BYLAYER
  Linientyp: BYLAYER
  Linienstärke: BYLAYER
  ID: 15896
    im Punkt: X=2677311.4340 Y=1250266.2410

n 3: PUNKT
  Layer: P_3D
  Farbe: BYLAYER
  Linientyp: BYLAYER
  Linienstärke: BYLAYER
  ID: 15897
    im Punkt: X=2677313.2160 Y=1250267.7880

n 4: PUNKT
  Layer: P_3D
  Farbe: BYLAYER
  Linientyp: BYLAYER
  Linienstärke: BYLAYER
  ID: 15898
    im Punkt: X=2677321.6860 Y=1250265.0070

This can be copied into a txt-file and edited manually or via script.
Reply | Threaded
Open this post in threaded view
|

Re: Export ascii or .txt files

SFQ_0
In reply to this post by Surveyor97
To get some closure here I'll provide a sample for the mentioned script turning the copied text into a txt-file as well:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

fCPY=open("/home/your/path/to/copy.txt")
lines=fCPY.readlines()
AnzL=0
PNr=0
fTXT=open("/home/your/desired/output/path/to/pyTest.txt","w")
for lines in lines:
    AnzL=AnzL + 1
    lc=lines.find("im Punkt:")
    if lc > 0:
        PNr=PNr + 1
        eol=len(lines)
        sx=lines.find("X=")
        sy=lines.find("Y=")
        x=lines[sx + 2:sy - 1]
        y=lines[sy + 2:eol]
        wLine=str(PNr) + "," + x + "," + y
        fTXT.write(wLine)
fTXT.close
fCPY.close

As mentioned before you should copy the output from the 'list entities' into a file named 'copy.txt' and run the script.
It creates a file 'pyTest.txt'
You'd have to adjust the path for both the 'copy.txt' and the 'pyTest.txt'  and might change the file names as well.

Depending on the language your using you might have to change the search string "im Punkt:" into the apropriate one.

If it is some Linux you're using you'd have to make the script executable by 'chmode -x' via terminal.

Some feedback would be appreciated.
Frank
Reply | Threaded
Open this post in threaded view
|

Re: Export ascii or .txt files

perepujal
Hi, I did some modifications to your script, now it could retrieve the height of the point, the original number and the code if they were imported along with the Read Ascii Files plugin.
You will need a build of LibreCAD that contains the modified ListEntities plugin to get the script working properly.
Please, take a look at it and modify/comment anything you feel to improve it.
HTH
Pere
list-entities2ascii.py