HI all,
Is there some sort of a getradius function in lisp? I'd like to display a preview of a circle as the user drags the cursor away from the centre point, similar to the way getcorner displays a preview of a rectangle. I have searched this forum and elsewhere, but haven't been able to find anything, so any help will be appreciated.
Thanks in advance.
John
Solved! Go to Solution.
Solved by iwafb. Go to Solution.
Hi,
Perhaps this function, return center point and radius.
(defun getradius (pt_cen msg / inc tmp rad p1 p2 lst) (setq inc (/ pi 18)) (princ msg) (princ "\nRadius ?") (while (= 5 (car (setq tmp (grread t 5 0)))) (cond ((= 5 (car tmp)) (setq lst nil) (redraw) (repeat 36 (setq rad (distance pt_cen (cadr tmp)) p1 (polar pt_cen inc rad) inc (+ inc (/ pi 18)) p2 (polar pt_cen inc rad) lst (append lst (list p1 p2)) ) ) (grdraw pt_cen (cadr tmp) 7) (grvecs lst) ) ) ) (list pt_cen rad) )
Exemple of call in your code:
((lambda ( / pt)
(initget 9)
(setq pt (getpoint "\nCenter point: "))
(getradius pt "\nRadius: ")
))
This source is BEST;;;
If you need convert your program in C++ADS/C++,please you use my source bellow:
you can use the source ARX progams.......
[code]
/*c2s:
inc=(kpi/18);
mg=str_calloc(msaj,"\nRadius:");
pt=dfn_var_ispoint(a225);
initget(9);
if (pt==nil) pt=ads_getpoint("\nCenter point:");
princ(mg);
while( zerop( car(tmp=ads_grread(t,5,0))))
{ if (zerop(car(tmp)),lst=nil;
else { ads_redraw();
for (k2=1;k2<36;k2=k2+1)
{ rad=ads_distance(pt,cadr(tmp)),
p1=ads_polar(pt,inc,rad),
inc= (inc+ (kpi/18)),
p2=ads_polar(pt,inc,rad),
lst=append(lst,lISt(p1,p2));
};
ads_grdraw(pt,cadr(tmp),7);
ads_grvecs(lst);
};
};
rr=list(pt,rad);
*/
rr)
[/code]