NanGlase Posted Friday at 12:15 PM Posted Friday at 12:15 PM (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.DWG SURVEY POINTS.csv Edited Friday at 12:20 PM by NanGlase Quote
hosneyalaa Posted Friday at 01:29 PM Posted Friday at 01:29 PM Try https://lee-mac.com/ptmanager.html 1 Quote
NanGlase Posted Friday at 05:53 PM Author Posted Friday at 05:53 PM 4 hours ago, 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 Friday at 08:07 PM Posted Friday at 08:07 PM 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 Friday at 11:06 PM Posted Friday at 11:06 PM (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 Friday at 11:07 PM by BIGAL 1 Quote
NanGlase Posted Friday at 11:43 PM Author Posted Friday at 11:43 PM 36 minutes ago, 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. 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.