Visual LISP, AutoLISP and General Customization

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

"Getradius" similar to getcorner?

220 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

Distinguished Contributor
iwafb
Posts: 156
Registered: ‎05-17-2004
Message 2 of 4 (218 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: 322
Registered: ‎10-15-2008
Message 3 of 4 (202 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: 258
Registered: ‎12-04-2009
Message 4 of 4 (156 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]

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community