NanGlase Posted January 3 Posted January 3 (edited) please help me write a code. i have csv file contains point, northing, easting, elevation, description. i also have a drawing file that has attributes-point,description,elevation. this drawing file is in a support file search path. i want to make an autolisp that import csv data into autocad. The northing and easthing will be the location of the point. NANCSV.DWGUnavailable SURVEY POINTS.csvUnavailable Edited January 3 by NanGlase Quote
NanGlase Posted January 3 Author Posted January 3 On 1/3/2025 at 1:29 PM, hosneyalaa said: Try https://lee-mac.com/ptmanager.html it changes the cordinates and columns' data were interchanged. cant find exact setup to correct. Quote
Steven P Posted January 3 Posted January 3 Not sure what you are meaning it changes the coordinates, are X and Y coordinates interchanged? (CAD is off - holiday - so not checking), if you selected the Y - Coordinate button but pointed it to the X and vice versa would it work OK? There are plenty of 'read CSV Lisps' or "Read Text File' Lisps out there if you want to use one of them as a basis though 1 Quote
BIGAL Posted January 3 Posted January 3 (edited) This is like part one of a two part question. I may be wrong and only points wanted. Part one import csv file, inserting blocks, code is out there. Part two string all the points using the description, yes use CIV3D or Stringer or Civil Site Design. Also includes step one. Yes have looked at stringing points. There is another post and out there and a couple of people are looking at the stringing function. Anyway try this. I made a block called SurvPoint which is made up of a POINT and your attdef's. (defun c:survpoints ( / fname dummy pts newline) ; thanks to Lee-mac for this defun comma is 44 (defun csv->lst ( str / pos ) (if (setq pos (vl-string-position 44 str)) (cons (substr str 1 pos) (csv->lst (substr str (+ pos 2)))) (list str) ) ) (setq fname (open (getfiled "Pts FILES" "d:\\" "csv" 16) "R")) (setq dummy (read-line fname)) ; throw away 1st line (while (setq newline (read-line fname)) (setq pts (csv->lst newline)) (command "-insert" "SurvPoint" (list (atof (nth 1 pts))(atof (nth 2 pts))) 1 1 0 (nth 3 pts) (last pts)(nth 0 pts)) ) (close fname) (princ) ) Please note don't need a csv can read excel direct. Edited January 3 by BIGAL 1 Quote
NanGlase Posted January 3 Author Posted January 3 On 1/3/2025 at 11:06 PM, BIGAL said: This is like part one of a two part question. I may be wrong and only points wanted. Part one import csv file, inserting blocks, code is out there. Part two string all the points using the description, yes use CIV3D or Stringer or Civil Site Design. Also includes step one. Yes have looked at stringing points. There is another post and out there and a couple of people are looking at the stringing function. Anyway try this. I made a block called SurvPoint which is made up of a POINT and your attdef's. (defun c:survpoints ( / fname dummy pts newline) ; thanks to Lee-mac for this defun comma is 44 (defun csv->lst ( str / pos ) (if (setq pos (vl-string-position 44 str)) (cons (substr str 1 pos) (csv->lst (substr str (+ pos 2)))) (list str) ) ) (setq fname (open (getfiled "Pts FILES" "d:\\" "csv" 16) "R")) (setq dummy (read-line fname)) ; throw away 1st line (while (setq newline (read-line fname)) (setq pts (csv->lst newline)) (command "-insert" "SurvPoint" (list (atof (nth 1 pts))(atof (nth 2 pts))) 1 1 0 (nth 3 pts) (last pts)(nth 0 pts)) ) (close fname) (princ) ) Please note don't need a csv can read excel direct. Expand thanks a lot. Happy new year! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.