termal007 Posted June 28, 2013 Posted June 28, 2013 hi i have 1356 points and i want insert number for each points in autocad . how can i do that is simple ? Quote
ReMark Posted June 28, 2013 Posted June 28, 2013 Perhaps with a custom lisp routine that utilizes incremental numbering? Here is one by forum member and lisp guru Lee Mac... http://www.lee-mac.com/numinc.html Quote
termal007 Posted June 28, 2013 Author Posted June 28, 2013 thanks but i don't want doing click by click in 1530 points !! is very Time-consuming are u doing simple by one click ? Quote
ReMark Posted June 28, 2013 Posted June 28, 2013 One click.....1530 points? That's asking a lot don't you think? How would the program know which point is the first? Which one should be the last? Should it number the points starting at the top and working towards the bottom or start on the left and number to the right? What's the order? What's the sequence? Quote
Tharwat Posted June 28, 2013 Posted June 28, 2013 One click.....1530 points? That's asking a lot don't you think? Yes I think so too . Termal try this routine . (defun c:Pnum (/ i s h) (if (and (setq i 0 s (ssget '((0 . "POINT"))) ) (setq h (getdist "\n Specify height of text :")) ) ((lambda (x / n e) (while (setq n (ssname s (setq x (1+ x)))) (setq e (entget n)) (entmakex (list '(0 . "TEXT") (assoc 10 e) (cons 11 (cdr (assoc 10 e))) (assoc 8 e) (cons 7 (getvar 'TEXTSTYLE)) (cons 40 h) (cons 1 (itoa (setq i (1+ i)))) ) ) ) ) -1 ) ) (princ) ) Quote
termal007 Posted June 28, 2013 Author Posted June 28, 2013 it is not important which of point in first or end !!! each point is one number so not needs i think which one was first !! please see attach file . this attach is part of total points coordinate of alignment . how i doing easy put numbers on points ? point.dwg Quote
ReMark Posted June 28, 2013 Posted June 28, 2013 (edited) Calm down dude. Since you did not make that point clear in your initial post someone had to ask. That someone happened to be me. Next time be more specific about your criteria. Edited June 28, 2013 by ReMark Quote
GP_ Posted June 28, 2013 Posted June 28, 2013 it is not important which of point in first or end !!!each point is one number so not needs i think which one was first !! please see attach file . this attach is part of total points coordinate of alignment . how i doing easy put numbers on points ? Have you tried Tharwat's code?!? Works fine for your purposes, but in dwg posted all points are duplicated. Quote
stevesfr Posted June 28, 2013 Posted June 28, 2013 Yes I think so too . Termal try this routine . (defun c:Pnum (/ i s h) (if (and (setq i 0 s (ssget '((0 . "POINT"))) ) (setq h (getdist "\n Specify height of text :")) ) ((lambda (x / n e) (while (setq n (ssname s (setq x (1+ x)))) (setq e (entget n)) (entmakex (list '(0 . "TEXT") (assoc 10 e) (cons 11 (cdr (assoc 10 e))) (assoc 8 e) (cons 7 (getvar 'TEXTSTYLE)) (cons 40 h) (cons 1 (itoa (setq i (1+ i)))) ) ) ) ) -1 ) ) (princ) ) @Tharwat the lisp program works (almost perfect) however it puts two consecutive numbers on each point instead of ONE. Just a little bug somewhere. Steve Quote
Tharwat Posted June 28, 2013 Posted June 28, 2013 however it puts two consecutive numbers on each point instead of ONE. Just a little bug somewhere. Steve As GP_ stated the drawing contains duplicated points Works fine for your purposes, but in dwg posted all points are duplicated. Quote
stevesfr Posted June 28, 2013 Posted June 28, 2013 Yes I think so too . Termal try this routine . (defun c:Pnum (/ i s h) (if (and (setq i 0 s (ssget '((0 . "POINT"))) ) (setq h (getdist "\n Specify height of text :")) ) ((lambda (x / n e) (while (setq n (ssname s (setq x (1+ x)))) (setq e (entget n)) (entmakex (list '(0 . "TEXT") (assoc 10 e) (cons 11 (cdr (assoc 10 e))) (assoc 8 e) (cons 7 (getvar 'TEXTSTYLE)) (cons 40 h) (cons 1 (itoa (setq i (1+ i)))) ) ) ) ) -1 ) ) (princ) ) @tharwat, oh oh, my bad, the original OP drawing somehow on my system has double points at each location. I will try to fix at my end.... I think your program is OK and not in error !! Steve Quote
Tharwat Posted June 28, 2013 Posted June 28, 2013 I think your program is OK and not in error !! Me too . Quote
CADWORKER Posted November 3, 2023 Posted November 3, 2023 On 6/28/2013 at 7:17 PM, Tharwat said: Yes I think so too . Termal try this routine . (defun c:Pnum (/ i s h) (if (and (setq i 0 s (ssget '((0 . "POINT"))) ) (setq h (getdist "\n Specify height of text :")) ) ((lambda (x / n e) (while (setq n (ssname s (setq x (1+ x)))) (setq e (entget n)) (entmakex (list '(0 . "TEXT") (assoc 10 e) (cons 11 (cdr (assoc 10 e))) (assoc 8 e) (cons 7 (getvar 'TEXTSTYLE)) (cons 40 h) (cons 1 (itoa (setq i (1+ i)))) ) ) ) ) -1 ) ) (princ) ) Hi Tharwat, Can this lisp be modified to ask for the start number and to add a suffix to layer as -RPS Quote
marko_ribar Posted November 3, 2023 Posted November 3, 2023 (edited) Quick and dirty : (defun c:Pnum (/ i s h) (if (and (setq i (1- (getint "\nStarting number : "))) (setq s (ssget '((0 . "POINT")))) (setq h (getdist "\nSpecify height of text : ")) ) ((lambda (x / n e) (while (setq n (ssname s (setq x (1+ x)))) (setq e (entget n)) (entmakex (list '(0 . "TEXT") (assoc 10 e) (cons 11 (cdr (assoc 10 e))) (cons 8 (strcat (cdr (assoc 8 e)) "-RPS")) (cons 7 (getvar 'TEXTSTYLE)) (cons 40 h) (cons 1 (itoa (setq i (1+ i)))) ) ) ) ) -1 ) ) (princ) ) Edited November 3, 2023 by marko_ribar Quote
CADWORKER Posted November 3, 2023 Posted November 3, 2023 Just now, marko_ribar said: Quick and dirty : (defun c:Pnum (/ i s h) (if (and (setq i (1- (getint "\nStarting number : "))) (setq s (ssget '((0 . "POINT"))) (setq h (getdist "\nSpecify height of text : ")) ) ((lambda (x / n e) (while (setq n (ssname s (setq x (1+ x)))) (setq e (entget n)) (entmakex (list '(0 . "TEXT") (assoc 10 e) (cons 11 (cdr (assoc 10 e))) (cons 8 (strcat (cdr (assoc 8 e)) "-RPS")) (cons 7 (getvar 'TEXTSTYLE)) (cons 40 h) (cons 1 (itoa (setq i (1+ i)))) ) ) ) ) -1 ) ) (princ) ) IAM GETTING THIS ERROR Quote
marko_ribar Posted November 3, 2023 Posted November 3, 2023 It was closing bracket here : (setq s (ssget '((0 . "POINT")))) I've updated the code... Sorry, I overlooked those initial (setq's... 1 Quote
CADWORKER Posted November 4, 2023 Posted November 4, 2023 8 hours ago, marko_ribar said: It was closing bracket here : (setq s (ssget '((0 . "POINT")))) I've updated the code... Sorry, I overlooked those initial (setq's... Thanks for the Update, 1 last request is to assign the color to the new layer (i.e. -RPS) same as the Original layer . ex. points which by default has color 1 so points-rps also should have color red. If possible. Thanks again. Quote
marko_ribar Posted November 4, 2023 Posted November 4, 2023 (edited) Just pick color for your POINTS-RPS Layer and newely created points will inherit that layer as the one with the same color if you add line : (cons 62 (getvar 'cecolor)) at the end under line : (cons 1 (itoa (setq i (1+ i))))... But untested if you give RGB color to Layer, you don't even need (cons 62 ... I just don't know what boders you with colors issue... It should work well as 'cecolor is only variable responsible for newly appended entities to database... Edited November 4, 2023 by marko_ribar Quote
CADWORKER Posted November 4, 2023 Posted November 4, 2023 29 minutes ago, marko_ribar said: Just pick color for your POINTS-RPS Layer and newely created points will inherit that layer as the one with the same color if you add line : (cons 62 (getvar 'cecolor)) at the end under line : (cons 1 (itoa (setq i (1+ i))))... But untested if you give RGB color to Layer, you don't even need (cons 62 ... I just don't know what boders you with colors issue... It should work well as 'cecolor is only variable responsible for newly appended entities to database... Thanks for all your support But I am getting error. Quote
Steven P Posted November 5, 2023 Posted November 5, 2023 'error'. That will help us work out what is wrong. What error are you getting? 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.