PDA

View Full Version : Remove certain prompts from QLeader ie Just pick points and enter text



Mike_R
2007-03-15, 05:42 PM
I'm trying to write a program that will allow me to draw a qleader with a certain dimstyle and not have to enter the default width, or tell it that I want to use the MTEXT Editor. Basically skipping the last 2-3 steps and just picking points, and entering the text. It then resets the dimstyle back to my style I use for dimensions.

I would use the "leader only" option when creating a new dimstyle, but since I have 2-3 seperate requirements for leaders (company policy) that doesn't work in my case.

The problem is, I can't find a way to throw in a while loop for setting the vertices. Everything I've tried to do has gotten it caught in the loop and I have to manually quit the routine. For now I've put a band-aid on it, so to speak. My Qleader settings have a max 3 points, and the code is set to reflect that... But I'd like to take the limit off for the few times I need to have more than 3 points in my leaders.

Here's the code... Any help would be great.


(defun c:lt (/ lay)
(command "-DIMSTYLE" "R" "LeaderTXT")
(c:t-lead)
(princ)
)
(defun c:t-lead ()
(setq lay (getvar "CLAYER"))
(setvar "CLAYER" "DIM")
(setvar "DIMSCALE" sf)
(command "qleader" "\\" "\\" "\\" "0" "")
(command "-DIMSTYLE" "R" "SGS")
(setvar "DIMSCALE" sf)
(setvar "CLAYER" lay)
)[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

watsonlisp
2007-03-15, 09:46 PM
;The leader command(vs. qleader) allows more than three points to be entered,
; but doesn't use mtext.
;Substitute (command "qleader" "\\" "\\" "\\" "0" "") with the lines below.






(SETQ CMDE (GETVAR "CMDECHO"))
(SETVAR "CMDECHO" 1)
(COMMAND "leader")
(SETQ LP 1)
(WHILE LP
(IF (= (GETVAR "CMDACTIVE") 9) (COMMAND PAUSE) (SETQ LP NIL))
);END LP
(SETVAR "CMDECHO" CMDE)

Mike_R
2007-03-19, 05:18 PM
Thank you for the help, but every time I run that code on my system, it would always just quit out of the routine. Turns out that CMDACTIVE was always at 1, and not 9. CMDACTIVE at 1 is obviously not a viable option for a while loop involving text (text string of ///////////////////////// anyone?).

But, seeing how you setup your while loop got me to think outside of what I normally do, and I came up with this....


(setq p1 '(0,0,0)
p2 '(1,1,1)
)
(command "QLEADER")
(while (or (/= (car p1) (car p2)) (/= (cadr p1) (cadr p2)))
(setq p1 (getvar "LASTPOINT"))
(COMMAND PAUSE)
(setq p2 (getvar "LASTPOINT"))
)
(command "" "")

This might not be too pretty, but it does exactly what I need it to do. It gets rid of the unnecessary prompts and I can still see the leader as it's being created.

Thanks again, without attempting your code I probably wouldn't have come up with that on my own.

Tom Beauford
2007-03-19, 06:03 PM
Save qlset.lsp from http://forums.augi.com/attachment.p...tid=37378&stc=1 in your support path.
Add (or acet-ql-get (load "qlset.lsp"))
as the second line in your routine after (defun

Here's some example lines you can add later in your routine.
(acet-ql-set '((40 . 1.5))) Sets width to 1.5.
(acet-ql-set '((68 . 0))) Turns width prompt off.
(acet-ql-set '((68 . 1))) Turns width prompt on.
(acet-ql-set '((67 . 1))) Sets no limit on points.

Lots more you can do with this routine from Autodesk. Try searching this Forum for qlset.lsp for more info.

watsonlisp
2007-03-19, 10:27 PM
I guess qleader which uses dialog boxes for mtext needs CMDACTIVE = 9 and
leader needs CMDACTIVE = 1. Or you could use CMDACTIVE > 0.

Tom Beauford
2007-03-20, 12:53 PM
You could test for a dialog box with something like:
(while (= 1 (logand 8 (getvar "cmdactive")))
although I don't use a dialog box for mtext with qleader. I type the in the mtext when prompted. If you hit enter instead the dialog box comes up if you need it. When I'm using it cmdactive = 1 and cmdnames = qleader start to finish.

I guess qleader which uses dialog boxes for mtext needs CMDACTIVE = 9 and
leader needs CMDACTIVE = 1. Or you could use CMDACTIVE > 0.

RobertB
2007-03-21, 05:15 AM
Thank you for the help, but every time I run that code on my system, it would always just quit out of the routine. Turns out that CMDACTIVE was always at 1, and not 9. CMDACTIVE at 1 is obviously not a viable option for a while loop involving text (text string of ///////////////////////// anyone?).
TextEval=1, and then pausing will work correctly.