Jump to content

Need a great balloon/bubble feature with AutoNUMBER!


tmelancon

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

You want an auto-increment feature then right?

 

That is what you asked for right? Confirmation? I just wanted to be clear. Thanks

Link to comment
Share on other sites

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

Link to comment
Share on other sites

"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 by ReMark
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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