Jump to content

Search the Community

Showing results for tags 'csv file'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 6 results

  1. Please, someone help me. I thought my program was in its final stages, but it is not. I used AutoCAD 2002 and 2007 during development, but when I tried to install it in AutoCAD 2021, this happened (see the picture). It prompts as if I need to edit the attributes one by one. Also, how can I eliminate the automatic prompts in the command line made by AutoCAD, while keeping the programmed prompts within the AutoLISP? (defun c:nancsv ( / fname dummy pts newline blockName height x y base-point auto-numbering num) (princ "\nImport CSV/Text File by: Nan Glase (2025-01-04)") ; (princ "\nEnter \"NANCSV\" to run.") ; (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) ) ) ; Set the block name (setq blockName "Nan Glase") ; Prompt for text height (setq height (getreal "\nEnter text height [0.60]: ")) ; Prompt for text height ; If the user presses Enter without input (height is nil), set the default value to 0.60 (if (not height) (setq height 0.60) ) ; Apply the formula (value entered / 2) (setq height (/ height 2)) ; Divide the height by 2 ; Define acceptable inputs for Yes and No (setq yes-options '("" "Y" "y" "Yes" "yes" "YES")) (setq no-options '("N" "n" "No" "no" "NO")) ; Prompt for automatic point numbering in a loop until valid input is given (setq auto-numbering nil) (while (not (or (member auto-numbering yes-options) (member auto-numbering no-options))) (setq auto-numbering (getstring "\nAutomatic point numbering? (Yes/No): ")) ) ; Start numbering from 1 if automatic numbering is enabled (if (member auto-numbering yes-options) (setq num 1) (setq num nil) ; Set num to nil if automatic numbering is not enabled ) ; Open the CSV file (setq fname (open (getfiled "Import CSV/Text File" "d:\\" "csv;txt" 16) "R")) (setq dummy (read-line fname)) ; ; (while (setq newline (read-line fname)) (setq pts (csv->lst newline)) ; ; If automatic numbering is enabled, modify the first element in pts (if num (setq pts (cons (itoa num) (cdr pts))) ; ) ; Extract coordinates from the list (setq x (atof (nth 2 pts))) ; X coordinate from CSV (setq y (atof (nth 1 pts))) ; Y coordinate from CSV (setq base-point (list x y)) ; Create the base point list ; Insert the block reference with the specified base point (command "-insert" blockName ; base-point ; Use the base point defined above height ; Scale X (use the calculated height) height ; Scale Y (use the calculated height) 0 ; Rotation (nth 0 pts) ; column A from CSV (last pts) ; column E from CSV (nth 3 pts) ; column D from CSV ) ; Increment the number for the next point if automatic numbering is enabled (if num (setq num (1+ num)) ) ) ; Close the file after processing (close fname) ; Close the file ; Notify user that the process is complete (princ "\nProcess completed successfully!") ; Completion message (princ) ; End of the function ) ; (princ "\nImport CSV/Text File by: Nan Glase (2025-01-04)") (princ "\nEnter \"NANCSV\" to run Import CSV/Text File.") Nan Glase.dwg
  2. 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
  3. I'm trying to get a custom association list with the format: ((("TAG1" . "VAL1A") ("TAG2" . "VAL2A")("TAG3" . "VAL3A") ...) (("TAG1" . "VAL1B")("TAG5" . "VAL5B) ("TAG7". "VAL7B") ...) (("TAG1" . "VAL1C)("TAG3" . "VAL3C")("TAG4" . "VAL4C") ...)) So far, I can generate this list. So, in essence, the keys of each sublist (tags) in the list can differ slightly, meaning some tags can be missing in the other sub list. Where this happens is when attributes of blocks differ by a bit, with some values missing from another. When we use "ATTOUT", AutoCAD bypasses this by inserting empty values when you read the file as a csv file. When I'm trying to create a CSV file, I'd like to have these tags be at the first row and fill up values per item in the list. What I want is basically an ATTOUT but with my own association list. I'm trying to use Write CSV by Lee-Mac for this. So far, the only way I can do this is brute force the first row with the tags, and then extract each Value such that (("TAG1" "TAG2" "TAG3" "TAG4" ...) ("VAL1A" "VAL2A" "VAL3A" "VAL4A" ...) ("VAL1B" "VAL2B" "VAL3B" "VAL4B" ...)) Any ideas about how I should go forward with these.
  4. Hi all, I need some help with a lisp routine that I'm attempting to write. What I need to do is extract a panel label by selecting the text and then select the dimensions that I need extract, I've managed to extract the dimensions correctly but when the information is extracted I get is "nil" in the first cell where the panel label should be and the dimensions in the next to cells. I don't Have Excel on my workstation so I have to use CSV file, I've already wrote an extraction code to run in Excel to retrieve the information in the CVS file. Also is there a way to save the CVS file in the same location that I have the drawing open? If someone could help me I would appreciate it. (defun c:test( / s tx fn i d dl m file) (setq ss (ssget '((0 . "*text,*DIMENSION"))) fn "f:\\BrianD\\Dims.csv") (repeat (setq i (sslength ss)) (setq d (ssname ss (setq i (1- i))) dl (entget d) m (cdr (assoc 42 dl))) (setq tx (cons m tx))) (if tx (progn (setq file (open fn "a")) (write-line "" file) (foreach ss tx (princ ss file) (princ "," file) ) (if file (close file)) ) ) ) (princ) Thanks Brian
  5. Hi, i'm want to import the code (or description) from csv file (X,Y,Code) on the coordinates of each point. I can do it in excel, but i'm looking for a easy way. The layer could be current, height 2, and rotation 0. I can change this properties later, so no problem about it. Please excuse my limited English, corrections are welcome. Many thanks in advance.
  6. Hi i'm looking for an Autolisp that help me to compile title block starting from a csv file. At the moment I know this Lisp http://www.lee-mac.com/updatetitleblock.html It is exactly what I need. The problem is that this program compile all the block title (present in "model" sheet) with the first line of the csv file. So all the block title will be equal. I need a routine that -for example- compile 5 block with attribute taking information from 5 different line of the csv file. This has to be done in "model" area. Does exist some progrma that colud be ok for this ?? Tnx in advance Nicola
×
×
  • Create New...