tmelancon Posted August 29, 2014 Share Posted August 29, 2014 We have a routine that allows us to pick initial point (for a leader to begin) then a second point (where we want a bubble with a number) We then input a number and it draws a circle around it. Any way to make this code automatically number as we pick our points? For example just enter the command in the command line and then PT1 PT2 and number 1 shows up appropriately. Then PT1 PT2 and number 2 shows up appropriately. If there is even anything out there that you may suggest I would greatly appreciate it. For times when we start a project from scratch it would be nice when we have 200 points to enter, not to have to *click* *click* *type #1*, then *click* *click* *type #2* ... all the way to #200. IT would be nice just to keep clicking (defun c:BALLOON2 (/ *error* oldlayr oldos) (setvar "CMDECHO" 0) (defun *error* (msg) (if oldlayr (setvar "clayer" oldlayr)) (if oldos (setvar "osmode" oldos)) (if msg (prompt msg)) (princ) ) (setq oldlayr (getvar "clayer")) (setq oldos (getvar "osmode")) (command "._-layer" "s" "TEXT" "") (initget (+ 1)) (setq pt1 (getpoint "\nDatapoint location on pipe: ")) ; Get 1st loc (initget (+ 1 32)) (setvar "osmode" 0) (setq pt2 (getpoint pt1 "\nDatapoint bubble location: ")) ; Get 2nd loc (initget (+ 1 2 4)) (if (= etype "G") (progn (setq dps (strcase (getstring "\nEnter datapoint ID (A1 - A999) or (A1 - AZ99): "))) ; Get DP# (if (< (strlen dps) 3) (setq csize (* (getvar "userr1") 1.2)) ; balloon for A1 (progn (if (< (strlen dps) 4) (setq csize (* (getvar "userr1") 1.9)) ; balloon for A22 (setq csize (* (getvar "userr1") 2.3)) ; balloon for A333 ) ) ) ) (progn (setq dpnum (getreal "\nEnter datapoint number (1.0-999.9): ")) ; Get DP# (setq dps (rtos dpnum 2 1)) (if (< (strlen dps) 4) (setq csize (* (getvar "userr1") 1.6)) ; balloon for 9.9 (progn (if (< (strlen dps) 5) (setq csize (* (getvar "userr1") 2.0)) ; balloon for 99.9 (setq csize (* (getvar "userr1") 2.4)) ; balloon for 999.9 ) ) ) ) ) (command "._circle" pt2 csize) (setq a (angle pt2 pt1)) ;(setq OLDOS (getvar "OSMODE")) ;(setvar "OSMODE" 0) (command "._line" pt1 (osnap (polar pt2 a csize) "nearest") "" ) ;(setvar "OSMODE" OLDOS) (command "._solid" pt1 (polar pt1 (- a 85) (getvar "userr1")) (polar pt1 (+ a 85) (getvar "userr1")) "" "") (command "._text" "m" pt2 (GETVAR "USERR1") 0 dps) (command "._-layer" "s" oldlayr "") (*error* nil) (prin1)) This is what we have always used but we have to manually type the numbers for each bubble we create. I know, first world problem, but I am certain there is something better out there to automate. Quote Link to comment Share on other sites More sharing options...
ReMark Posted August 29, 2014 Share Posted August 29, 2014 You want an auto-increment feature then right? Quote Link to comment Share on other sites More sharing options...
tmelancon Posted August 29, 2014 Author Share Posted August 29, 2014 That sounds like something I am looking for. I just always thought about it but never posted. Like instead of having to manually enter in the numbers all the way from 1 for the first bubble to 200 for the last bubble. It would be beastly just to like click the point for the leader then click the point for the bubble and it automatically number it with the next number in the sequence. That way if we had say 133 bubbles entered, but needed to quickly draw something else in, then resume popping in our bubbles it would know to continue on 134. Quote Link to comment Share on other sites More sharing options...
ReMark Posted August 29, 2014 Share Posted August 29, 2014 OK...basically you just confirmed what I said. Quote Link to comment Share on other sites More sharing options...
tmelancon Posted August 29, 2014 Author Share Posted August 29, 2014 You want an auto-increment feature then right? That is what you asked for right? Confirmation? I just wanted to be clear. Thanks Quote Link to comment Share on other sites More sharing options...
ReMark Posted August 29, 2014 Share Posted August 29, 2014 I'm pretty sure Lee Mac wrote an auto-increment lisp routine. Can't recall the exact nature of how it works but if it doesn't meet your needs you could always tweak it. Here you go. A link to Lee Mac's Incremental Numbering Suite. http://www.lee-mac.com/numinc.html Quote Link to comment Share on other sites More sharing options...
tmelancon Posted August 29, 2014 Author Share Posted August 29, 2014 Man that is exactly what we are looking for but just being able to have a leader placed prior to each bubble. I will see if I can make it happen. In the meantime if someone else can chime in it would be absolutely appreciated to the max. I will shoot Lee an email and see if he has even considered this before. Thanks Quote Link to comment Share on other sites More sharing options...
ReMark Posted August 29, 2014 Share Posted August 29, 2014 (edited) "You can't always get what you want, but if you try some time, you just might find you get what you need." Have fun. BTW....there are a number of auto-increment lisp routines floating around the Internet. You might try over at Cadalyst magazine, AUGI or over at The Swamp. Edited August 29, 2014 by ReMark Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 30, 2014 Share Posted August 30, 2014 This is an old one it uses a block but searches first for last number used or enter number, you will need a block called setout_pt-number ;(defun trap (errmsg) ; (prompt "\nAn error has occured.") ; (command "undo" "b") ; (setvar "osmode" os) ; (setq *error* temperr) (defun c:SETOUTPT () (setvar "cmdecho" 0) ; (setq temperr *error*) ; (setq *error* trap) (if (= dwgscale nil) (setq dwgscale (/ (getreal "\n Enter drawing scale ")1000.0 )) ) (setq os (getvar "osmode")) ; (command "undo" "m") (if (= pno nil) (setq pno 1)) (prompt "\nEnter Setout Point No.<")(prin1 pno)(prompt ">:") (setq newpno (getint)) (if (= newpno nil) (setq newpno pno)) (setq ss1 (ssget "x" '((2 . "setout_point")))) (if (/= ss1 nil) (progn (setq n (sslength ss1)) (setq t1 1) (while t1 (setq index 0) (setq t2 1) (while t1 (setq en (ssname ss1 index)) (setq index (+ index 1)) (setq el (entget en)) (setq en1 (entnext en)) (setq el1 (entget en1)) (setq att (cdr (assoc 1 el1))) (setq testpno (itoa newpno)) (if (= att testpno) (progn (prompt "\nSetout Point No.")(prin1 newpno)(prompt " already exists.") (prompt "\nEnter new number:") (setq newpno (getint)) (setq t2 nil) );progn ;else (if (= index n) (progn (setq t1 nil) (setq t2 nil) );progn );if = index );if = att );while t2 );while t1 );progn );if ss1 /= nil (setq pt1 (getpoint "\nPick setout point: ")) (command "osmode" 0) (prompt "\nPoint for circle: ") (command "insert" "setout_point_no" pause dwgscale "" "" newpno) (setq pt2 (getvar "lastpoint")) (command "insert" "setout_point" pt1 (* 0.5 dwgscale) "" "" newpno) (setq ang (angle pt1 pt2)) (setq pt3 (polar pt2 (- ang pi) (* 3.2 dwgscale))) ; text ht 2.5 (command "line" pt1 pt3 "") (setq pno (+ newpno 1)) (setvar "osmode" os) ; (setq *error* temperr) (princ) ) Quote Link to comment Share on other sites More sharing options...
stevesfr Posted August 30, 2014 Share Posted August 30, 2014 This is an old one it uses a block but searches first for last number used or enter number, you will need a block called setout_pt-number ;(defun trap (errmsg) ; (prompt "\nAn error has occured.") ; (command "undo" "b") ; (setvar "osmode" os) ; (setq *error* temperr) (defun c:SETOUTPT () (setvar "cmdecho" 0) ; (setq temperr *error*) ; (setq *error* trap) (if (= dwgscale nil) (setq dwgscale (/ (getreal "\n Enter drawing scale ")1000.0 )) ) (setq os (getvar "osmode")) ; (command "undo" "m") (if (= pno nil) (setq pno 1)) (prompt "\nEnter Setout Point No.<")(prin1 pno)(prompt ">:") (setq newpno (getint)) (if (= newpno nil) (setq newpno pno)) (setq ss1 (ssget "x" '((2 . "setout_point")))) (if (/= ss1 nil) (progn (setq n (sslength ss1)) (setq t1 1) (while t1 (setq index 0) (setq t2 1) (while t1 (setq en (ssname ss1 index)) (setq index (+ index 1)) (setq el (entget en)) (setq en1 (entnext en)) (setq el1 (entget en1)) (setq att (cdr (assoc 1 el1))) (setq testpno (itoa newpno)) (if (= att testpno) (progn (prompt "\nSetout Point No.")(prin1 newpno)(prompt " already exists.") (prompt "\nEnter new number:") (setq newpno (getint)) (setq t2 nil) );progn ;else (if (= index n) (progn (setq t1 nil) (setq t2 nil) );progn );if = index );if = att );while t2 );while t1 );progn );if ss1 /= nil (setq pt1 (getpoint "\nPick setout point: ")) (command "osmode" 0) (prompt "\nPoint for circle: ") (command "insert" "setout_point_no" pause dwgscale "" "" newpno) (setq pt2 (getvar "lastpoint")) (command "insert" "setout_point" pt1 (* 0.5 dwgscale) "" "" newpno) (setq ang (angle pt1 pt2)) (setq pt3 (polar pt2 (- ang pi) (* 3.2 dwgscale))) ; text ht 2.5 (command "line" pt1 pt3 "") (setq pno (+ newpno 1)) (setvar "osmode" os) ; (setq *error* temperr) (princ) ) please describe the two blocks needed... Quote Link to comment Share on other sites More sharing options...
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.