Author Topic: bALLOON ROUTINE  (Read 4495 times)

0 Members and 1 Guest are viewing this topic.

TJAM51

  • Guest
bALLOON ROUTINE
« on: October 19, 2004, 06:26:22 PM »
I have the following balloon routine and all works well except when you have to type in the text. I receive the following error message. I am using 2004 architectural desktop.



Enter text:  (at this point I entered the letter A. It did the same with the
                   nymber 1)
Command: A Unknown command "A".  Press F1 for help.



ROUTINE

;;;This file allows the user to draw Balloon references
;;;to call out items in a drawing

;;;© Alan Henderson 2000

;;; type "BAL1" to insert a single item balloon.
;;; type "BAL2" to insert an assembly item balloon.
;;; A single item balloon is defined by a single circle around the text
;;; An assembly balloon is defined by a double circle around the text

;;;SINGLE ITEM BALLOON*********************************************
(defun C:BAL1 ()

  (setq   old_lay   (getvar "clayer")
   size   (getvar "textsize")
  )
  (setvar "orthomode" 0)
  (command "layer" "set" "text" "")
  (prompt
    "\nPlease ensure you have selected the text height!..... \n"
  )
  (princ)

;;;Draws the leader & Attaches the line to the leader
  (command "leader" pause pause "" "" "n")
  (setq pt1 (getvar "lastpoint"))
  (setvar "orthomode" 1)
  (command "line" pt1 pause "")
  (setq pt2 (getvar "lastpoint"))

;;;Draws the circle at the line endpoint
  (command "circle" pt2 size)
  (setq cl (entlast))

;;;Trims the line to the circle
  (command "trim" cl "" pt2 "")

;;;Put the text at the circle centre
  (setq t1 (getstring "\nEnter Item number:"))
  (command "text" "J" "MC" pt2 size "" t1)
  (command "layer" "set" old_lay "")
)

;;;ASSEMBLY BALLOON**************************************************
(defun C:BAL2 ()

  (setq   old_lay   (getvar "clayer")
   size   (getvar "textsize")
  )
  (setvar "orthomode" 0)
  (command "layer" "set" "text" "")
  (prompt
    "\nPlease ensure you have selected the text height!..... \n"
  )
  (princ)

;;;Draws the leader & Attaches the line to the leader
  (command "leader" pause pause "" "" "n") ;Draws the leader
  (setq pt1 (getvar "lastpoint"))
  (setvar "orthomode" 1)
  (command "line" pt1 pause "")
  (setq pt2 (getvar "lastpoint"))

;;;Draws the circle at the line endpoint
  (command "circle" pt2 size)
  (setq cl (entlast))

;;;Copies & offsets the second circle & trim the line to the circle
  (command "copy" cl "" pt2 pt2)
  (setq cl2 (entlast))
  (command "scale" cl2 "" pt2 "1.2")
  (command "trim" cl2 "" pt2 "")

;;;Puts the text at the circle centre
  (setq t2 (getstring "\nEnter Item number:"))
  (command "text" "J" "MC" pt2 size "" t2)
 
  (command "layer" "set" old_lay "")

[/b]

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
bALLOON ROUTINE
« Reply #1 on: October 19, 2004, 06:39:30 PM »
I would suspect that it is in conjuntion with the text command being used....but it looks ok though .... perhaps a setting with the particular text you are using? Some text style definitions if they are predefined, will cause the text command to utilize a different number of prompts. When this occurs the problem you mention crops its head up....

have you tried looking at the one here?
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
bALLOON ROUTINE
« Reply #2 on: October 19, 2004, 07:10:34 PM »
TJ
Keith has a much better routine, but the text height requires that you
test for zero size.
I added that but you will still have problems with the circle from time to time.
Code: [Select]
;;;This file allows the user to draw Balloon references
;;;to call out items in a drawing

;;;© Alan Henderson 2000

;;; type "BAL1" to insert a single item balloon.
;;; type "BAL2" to insert an assembly item balloon.
;;; A single item balloon is defined by a single circle around the text
;;; An assembly balloon is defined by a double circle around the text

;;;SINGLE ITEM BALLOON*********************************************
(defun c:bal1 ()

  (setq old_lay (getvar "clayer")
        size    (getvar "textsize")
  )
  (setvar "orthomode" 0)
  (command "layer" "set" "text" "")
  (prompt
    "\nPlease ensure you have selected the text height!..... \n"
  )
  (princ)

;;;Draws the leader & Attaches the line to the leader
  (command "leader" pause pause "" "" "n")
  (setq pt1 (getvar "lastpoint"))
  (setvar "orthomode" 1)
  (command "line" pt1 pause "")
  (setq pt2 (getvar "lastpoint"))

;;;Draws the circle at the line endpoint
  (command "circle" pt2 size)
  (setq cl (entlast))

;;;Trims the line to the circle
  (command "trim" cl "" pt2 "")

;;;Put the text at the circle centre
  (setq t1 (getstring "\nEnter Item number:"))
  ;; If text height is undefined (signified by 0 in the table)
  (if (= (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))) 0)
    ;; Draw the text using the current text height (textsize)
    (command "text" "mc" pt2 size "" t1)
    ;; Otherwise use the defined text height
    (command "text" "mc" pt2 "" t1)
  ) ; endif
  (command "layer" "set" old_lay "")
)

;;;ASSEMBLY BALLOON**************************************************
(defun c:bal2 ()

  (setq old_lay (getvar "clayer")
        size    (getvar "textsize")
  )
  (setvar "orthomode" 0)
  (command "layer" "set" "text" "")
  (prompt
    "\nPlease ensure you have selected the text height!..... \n"
  )
  (princ)

;;;Draws the leader & Attaches the line to the leader
  (command "leader" pause pause "" "" "n") ;Draws the leader
  (setq pt1 (getvar "lastpoint"))
  (setvar "orthomode" 1)
  (command "line" pt1 pause "")
  (setq pt2 (getvar "lastpoint"))

;;;Draws the circle at the line endpoint
  (command "circle" pt2 size)
  (setq cl (entlast))

;;Copies & offsets the second circle & trim the line to the circle
  (command "copy" cl "" pt2 pt2)
  (setq cl2 (entlast))
  (command "scale" cl2 "" pt2 "1.2")
  (command "trim" cl2 "" pt2 "")

;;Puts the text at the circle centre
  (setq t2 (getstring "\nEnter Item number:"))

  ;; If text height is undefined (signified by 0 in the table)
  (if (= (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))) 0)
    ;; Draw the text using the current text height (textsize)
    (command "text" "mc" pt2 size "" t2)
    ;; Otherwise use the defined text height
    (command "text" "mc" pt2 "" t2)
  ) ; endif
  (command "layer" "set" old_lay "")
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

hendie

  • Guest
bALLOON ROUTINE
« Reply #3 on: October 20, 2004, 08:03:00 AM »
oh no.. another old embarrassing moment  :oops:

daron

  • Guest
bALLOON ROUTINE
« Reply #4 on: October 20, 2004, 08:06:49 AM »
Want a vba version of the same program, written by the same person?

hendie

  • Guest
bALLOON ROUTINE
« Reply #5 on: October 20, 2004, 08:14:56 AM »
:horror:



Daron, I don't think that ever got finished.. did it ?
Keith & I were talking about that one just the other day. You're right, the VBA version is much better, having more error control etc but as far as I can remember, the project got kind of halted due to other work

daron

  • Guest
bALLOON ROUTINE
« Reply #6 on: October 20, 2004, 08:24:40 AM »
Yeah. I'm not sure if it did get finished. At the same time, I've come to learn that different browsers in the same family are bothersome. My version of Mozilla 1.6 views everything as I wrote it, but firefox hides the submit button on the original screen to my page and doesn't give a scroll bar, as well it does the same in the content areas. I haven't had much time to play with it since moving. I'd like to get that going again sometime.

TJAM51

  • Guest
bALLOON ROUTINE
« Reply #7 on: October 20, 2004, 11:05:31 AM »
I tried the routine dimbal that is dialog driven. I am seeking a way to draw a simple balloon or even a hex that is based on the dimscale.

hendie

  • Guest
bALLOON ROUTINE
« Reply #8 on: October 20, 2004, 11:10:33 AM »
you mention you're using ADT 2004 ~ this was written way back in 2000 ~ for Acad 2000 ~ have the text prompts changed ?
(or perhaps your text style ~as Keith mentioned)

for a quick test, check your current text style and change the height to 0 then run the lisp again ~what happens ?

TJAM51

  • Guest
bALLOON ROUTINE
« Reply #9 on: October 20, 2004, 11:12:43 AM »
I may have not ben clear...sorry...I am using ADT2004.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
bALLOON ROUTINE
« Reply #10 on: October 20, 2004, 12:13:03 PM »
Quote from: TJAM51
I tried the routine dimbal that is dialog driven. I am seeking a way to draw a simple balloon or even a hex that is based on the dimscale.
I think if you make this mod it will work for you.
Code: [Select]
(setq dsc (getvar "dimscale"))
(setq cad_dim_asz (*(getvar "dimasz")dsc))   ;Arrow size (in drawing units)
(setq cad_dim_tsz (*(getvar "dimtxt")dsc))   ;Text size (in drawing units)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

megamike

  • Guest
bALLOON ROUTINE
« Reply #11 on: October 20, 2004, 02:13:45 PM »
If you are using ADT, why not use the leader routines already there under the "documentation" content?
They work! :wink:

TJAM51

  • Guest
bALLOON ROUTINE
« Reply #12 on: October 20, 2004, 03:26:24 PM »
If you are using ADT, why not use the leader routines already there under the "documentation" content?






I am not sure of this. Does this offer balloons?


Thanks

megamike

  • Guest
bALLOON ROUTINE
« Reply #13 on: October 20, 2004, 03:34:24 PM »
TJAM51 wrote:

Quote
I am not sure of this. Does this offer balloons?


Yes, balloons, squares, diamonds, hex, of just text, all with your choice of splined or straight leaders.
Check it out in the "Documentation" content under "leaders".