Search the Community
Showing results for tags 'block reference'.
-
import csv file into autocad using autolisp and block reference (part2)
NanGlase posted a topic in AutoLISP, Visual LISP & DCL
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 -
import csv file into autocad using autolisp and block reference
NanGlase posted a topic in AutoLISP, Visual LISP & DCL
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 -
Hello, I was getting a drawing that I have to modify. The problem is, that in this drawing are several block references with the name. I.e. I have about 100 block references calling "WcLux" . Is there a possibility to make the name of the block reference unique with a script: WcLux_1, WcLux2, ... WcLux100 Thx Frank
-
Closest point on a polyline from a block reference
jes_g posted a topic in AutoLISP, Visual LISP & DCL
Hello, there, I am trying to find a LISP routine which will find the closest point on a polyline from a selected block reference. This routine finds the closest distance between two objects by selecting both objects, but it does not seem to work with block reference. After it finds the closest point, how to create a new vertex on that point? Thank you in advance Best wishes, Jes G- 7 replies
-
- point on polyline
- create vertex
-
(and 3 more)
Tagged with:
-
I have recently downloads a pile of files, blocks for inserting, symbols. Apparently all files have block in them of the same name of the file name. Thus, upon inserting a file I get the error "block reference itself" and will not insert. Is there a means of removing the block in the file in a batch method? Since there is over 8700 blocks, I do not want to open each file, explode, purge, save, individually. Looking for a batch method that basically does the same thing. Or some other method to not only remove the error, but also to avoid the purging nested block on layer problems.
-
- nested
- block reference
-
(and 2 more)
Tagged with:
-
Pasteclip is pasting everything as a block reference
aosp posted a topic in AutoCAD Bugs, Error Messages & Quirks
I'm using AutoCAD 2015 on a 2D drawing, and usually use CTRL-C and CTRL-V for my copying. Today, for some reason, everything I copyclip and pasteclip comes out as a block reference. It happened first with a single-segment polyline, then I tried a few other objects - dtext, rectangle, closed polyline. Same thing. The regular copy command still works fine, however. Anyone have any idea what's going on? Is this a setting I inadvertently changed, or a bug? Also, this is a file I've been working in regularly for a year, and it's just today that I saw this problem for the first time. -
Updating block references.
SAFeSTeR posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Ok so here's the situation... I have approx 150 files all with multiple layouts, each layout containing a legend block that needs updating. I edited the existing block and used WBLOCK to save it out ready for use in the other drawings. When I try to insert it into another drawing it gives me 2 options: 1. 'Redefine block - All block references will be updated'. 2. 'Don't redefine block'. When I try option 1 I cannot insert the block, I get this response and nothing gets updated: Block Notes_Block references itself Regenerating layout. Regenerating model. *Invalid* When I try option 2 it allows me to insert the block but it is this one that gets updated from the existing block in the drawing. I have even tried opening the block.dwg copy / pasting it but I get the same result... I really need some help with this because I need to get all these drawings updated today and doing each one manually will just take way too long. What am I doing wrong? Thanks in advance. -
How to make double clicking on a Block to open the in-place editor
petsagouris posted a topic in AutoLISP, Visual LISP & DCL
I have followed the article about Using the In-Place Block Editor (REFEDIT) and I now need the macro to press the "Ok" on the Refedit confirmation dialog automatically. How would I go about that? -
Hi all, new here! I need some help creating and displaying unique IDs for all of my block references in a drawing. I'm self-taught CAD and self taught Filemaker and now I'm trying to figure out how to get the two to work together (I think I can, I think I can). My database is tracking trees and the CAD drawing locates those trees but I need a unique ID that can help translate information between formats. I have set up blocks with attributes and successfully extracted data into filemaker but I can't figure out how to get CAD to create and display a unique ID for each block reference. I can extract the "handles" of the references but I can't display those on the drawing. Any thoughts?
- 5 replies
-
- data extraction
- block reference
-
(and 1 more)
Tagged with: