Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"Getradius" similar to getcorner?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
iwafb
432 Views, 3 Replies

"Getradius" similar to getcorner?

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

3 REPLIES 3
Message 2 of 4
iwafb
in reply to: iwafb

Spoiler
 

Sorry, silly question (claiming brain fade...).

 

(initget 1)

(setq pnt1 (getpoint "\nPick first point for detail location..."))

(prompt "\nSpecify size for detail area...")

(command "_.circle" pnt1 pause)

 

Then delete circle if you want...

Message 3 of 4
CADaSchtroumpf
in reply to: iwafb

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

Message 4 of 4

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]

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost