Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Import points from a CSV file, AutoLISP routine importcsv.lsp

ImportCSV is an AutoLISP routine to import points from a CSV file.

Download the file from mediafire.com

To use it:

  1. download the file
  2. in Bricscad choose Tools → Load Application...
  3. click Add and choose the downloaded file importcsv-0.1.lsp
  4. make sure the file is selected and click Load
  5. type importcsv to Bricscad command line and press enter
  6. follow the prompts as in any Bricscad command

Features:

  • import any number of points
  • show the 0,0,0 point of CSV coordinate axis with mouse
  • independent scaling by axis, default 1,1,1 means no scaling, 1,0.5,1 means Y axis divided by 2
  • represent points as points or make these connected by lines
  • autodetection of column order, if correct header is present
  • super easy column order specification with a simple string, e.g ENZ or PXYZL
  • autodetection of CSV format, supported are column separators comma or semicolon and decimal point separator comma or point
  • CSV fields can be masked with single or double parentheses
  • remembers the filename from last import (only within the session)
  • possible to set points to different layers
  • code is not super nice (it's LISP), but it is modular and some changes should be easy

I wrote it yesterday night for fun, therefore it has numerous ways yet to be improved. The most notable problems it yet has are the following:

  • column separation is done so: if first line contains any semicolon, it must be the separator (which may not be the optimal choice, also parentheses are ignored here)
  • number detection is done so: if a column contents starts with a minus, comma, point or with a number, it must be a number (parentheses and trailing characters do not count, if it contains a comma or dot, it is float, integer otherwise)
  • not all private variables are marked as such
  • probably more, it's for you to discover.

Comments

  • Hello !

    I tried tu use your lips to import csv file which have this order of column : Number,X,Y,Z,Description (like road, building...)

    in the command line I have this when I lanch it :

    the first line of this csv contained 5 columns separated by , : 11, 600000,100000,85.50,st45

    Column may be X/Y/Z/North/East/Layer/Point/Unused

    No header were detected, please specify the right order :

    Questions :

    For the separator comma, do I need to use / ?

    What means "no header detected"? I specified that my file is point,X,Y,Z,description

    After, I said I needed Point (no line), insertion point (0,0,0), scale factor (1,1,1). It works but, I loose the string "description" ?

    Is it possible to generate columns for altitude and description which will be in specify layer and which will be write in caracters on the screen (interface) ?

    Any idea ?

    thank a lot

    Xavier

  • What means "no header detected"? I specified that my file is point,X,Y,Z,description

    "Headers" mean that the very first line in CSV could be "N,E,Z," or "North,East,Z" for example, so the file itself may contain data about columns.

     

    After, I said I needed Point (no line), insertion point (0,0,0), scale factor (1,1,1). It works but, I loose the string "description" ?

    There is no place where to put this description other than draw it as text on screen (no special "description field").

     

    Is it possible to generate columns for altitude and description which will be in specify layer and which will be write in caracters on the screen (interface) ?

    So that altitude and description both are as text? Yes, it is possible, but this script does not do it yet, but this is not complex. Unfortunately I am a little busy right now.

  • Ok, thanks.

    Let me know when you will offer a version with "altitude" and "description" both as text and included on the csv file for "description"....

    Thanks a lot.

     

  • HI Matias
    The file is no loger avaiable. Can you upload that again ?

Sign In or Register to comment.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam