Jump to content

Recommended Posts

Posted

hi

 

i have 1356 points and i want insert number for each points in autocad .

 

 

how can i do that is simple ?

Posted

thanks but i don't want doing click by click in 1530 points !! is very Time-consuming

are u doing simple by one click ?

Posted

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?

Posted
One click.....1530 points? That's asking a lot don't you think?

 

Yes I think so too . :lol:

 

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)
)

Posted

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

Posted (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 by ReMark
Posted
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.

Posted
Yes I think so too . :lol:

 

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

Posted

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.

Posted
Yes I think so too . :lol:

 

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

Posted
I think your program is OK and not in error !!

 

Me too . :D

  • 10 years later...
Posted
On 6/28/2013 at 7:17 PM, Tharwat said:

 

Yes I think so too . :lol:

 

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

Posted (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 by marko_ribar
Posted
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

image.png.d6ed05b1e7af4d86d81ad4f3ea29c090.png

Posted

It was closing bracket here :

(setq s (ssget '((0 . "POINT"))))

 

I've updated the code...

Sorry, I overlooked those initial (setq's...

  • Like 1
Posted
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.

Posted (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 by marko_ribar
Posted
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.

Posted

'error'.

 

That will help us work out what is wrong. What error are you getting?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...