Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
iwafb
Posts: 156
Registered: ‎05-17-2004
Message 1 of 4 (226 Views)
Accepted Solution

"Getradius" similar to getcorner?

226 Views, 3 Replies
06-13-2012 11:13 PM

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

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...

Distinguished Contributor
iwafb
Posts: 156
Registered: ‎05-17-2004
Message 2 of 4 (224 Views)

Re: "Getradius" similar to getcorner?

06-13-2012 11:36 PM 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...

Valued Mentor
CADaStroumph
Posts: 334
Registered: ‎10-15-2008
Message 3 of 4 (208 Views)

Re : "Getradius" similar to getcorner?

06-14-2012 01:26 AM 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: ")
))

Mentor
diagodose2009
Posts: 262
Registered: ‎12-04-2009
Message 4 of 4 (162 Views)

Re : "Getradius" similar to getcorner?

06-17-2012 10:13 PM in reply to: CADaStroumph

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]

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.