Hi to All,
I am looking for a lisp;
Get 2radius by selecting text and Draw 2circles from 1 center point.
An explanation image attaching here:
Thanks in advance
|
Hi to All,
I am looking for a lisp;
Get 2radius by selecting text and Draw 2circles from 1 center point.
An explanation image attaching here:
Thanks in advance
Try this:
Hope this helps!Code:(defun c:dbl () (setq rad1 (getstring "\n First Radius ")) (setq rad2 (getstring "\n Second Radius ")) (setq cntr (getpoint "\n Select Center Point ")) (if (/= cntr nil) (progn (command ".circle" cntr rad1) (command ".circle" cntr rad2) ) ) )
Rob
oops, guess it would help if I wasn't asleep.
I forgot you want to select text.
Are your labels text or attributes?
Rob
Here is something for you to start with, but it do not treat stupid text
: ) Happy Computing !Code:(defun c:2c (/ Ent1 Ent2 Pkt1 ) (if (and (setq Ent1 (car (entsel "Select text: " )) ) (not (redraw Ent1 3 )) (setq Ent2 (car (entsel "Select text: " )) ) (not (redraw Ent2 3 )) (setq Pkt1 (getpoint "Select point " ) ) ) (progn (if (and (= (cdr (assoc 0 (entget Ent1 ))) "TEXT" ) (= (cdr (assoc 0 (entget Ent2 ))) "TEXT" ) ) (progn ; Here can be a lot of pain, text can be 15 15.2 15,2 15Kg and so on, and the only legal type is 15.2 or 15 (if (or (= 0.0 (atof (cdr (assoc 1 (entget Ent1 ))))) (= 0.0 (atof (cdr (assoc 1 (entget Ent2 ))))) ) (alert "One of the text generate a 0 radius \n Quitting !" ) (progn (command "._circle" Pkt1 (atof (cdr (assoc 1 (entget Ent1 )))) ) (command "._circle" Pkt1 (atof (cdr (assoc 1 (entget Ent2 )))) ) ) ) ) (princ " wrong object type " ) ) ) (princ "not enough input" ) ) (redraw Ent1 4 ) (redraw Ent2 4 ) (princ) )
kennet
Last edited by kennet.sjoberg; 2005-09-22 at 10:09 PM.
thanks kennet..it works..well done..
thanks Rob..your dbl.lsp also works.. is it posible to Fetch value from attributes to circle command?
xp5
kennet,
You may be better off changing this
to this, as the distof is more forgiving.Code:(if (or (= 0.0 (atof (cdr (assoc 1 (entget Ent1 ))))) (= 0.0 (atof (cdr (assoc 1 (entget Ent2 ))))) )
Code:(if (or (= 0.0 (distof (cdr (assoc 1 (entget Ent1 ))))) (= 0.0 (distof (cdr (assoc 1 (entget Ent2 ))))) )
Yes, correct ab2draft, but as a sayOriginally Posted by ab2draft
Actually I do not simply use atof or distof my self, ( I am not so forgiving )Originally Posted by kennet.sjoberg
I use a subroutine that check the string from the first character until a space (if it exist)
then check if that part is made of legal characters "0-9" "+" "-" "." and ","
replace the "," with "." and then check again in different ways to see if the sting is legal.
: ) Happy Computing !
kennet
I was just thinking that we should have a function that acted like an entsel function but allowed the user to include a selection set filter like the ssget function.
Like this
The syntax to allow for a single selection of text is:
(entselwithfilter '(list (cons 0 "text")) "Select text: ")
Peter Jamtgaard P.E.
Code:(defun entselWithFilter (lstOfFilters strPrompt / ssSelections) (vl-load-com) (if strPrompt (princ (strcat "\n" strPrompt)) ) (while (not (setq ssSelections (ssget ":S:E" (eval lstOfFilters)))) (princ "\nInvalid Selection Please Select Again: ") ) (list (ssname ssSelections 0) (getvar "lastpoint")) )
Last edited by peter; 2005-09-26 at 11:42 AM.