Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
Charliep
Posts: 163
Registered: ‎01-07-2004
Message 1 of 10 (154 Views)

Circumference Dimension

154 Views, 9 Replies
06-04-2004 08:43 AM
Does any one have a routine that will dimension for a Circumference that you would share?

I know that the circumference can be obtained in the properties box, however it would be nice if it were associative.

By the way I use A2K4

Thanks in advanced.
*TCEBob
Message 2 of 10 (154 Views)

Re: Circumference Dimension

06-04-2004 09:20 AM in reply to: Charliep
Well, you probably don't want a circular dimension line all around the circle, so how about a leader with the number attached: (defun C:circu( / circ circrad circumstr) ;dimension circumference (setq circ (entsel "\nSelect a Circle: ")) (setq circrad (cdr(assoc 40(entget(car circ))))) (setq circumstr (strcat "Circumference = " (rtos(* 2 pi circrad)))) (setq p1(getpoint "Arrow point: ")) (setq p2(getpoint p1 "Dimension location: ")) (command "qleader" p1 p2 circumstr "") (princ)) No safeguards. rs --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.698 / Virus Database: 455 - Release Date: 6/3/2004
*TCEBob
Message 3 of 10 (154 Views)

Re: Circumference Dimension

06-04-2004 09:39 AM in reply to: Charliep
Actually, I like this just a bit better: (defun C:circu( / circumstr) ;dimension circumference (setq circumstr (strcat "Circumf. = " (rtos(* 2 pi (cdr(assoc 40 (entget(car(entsel "\nSelect a Circle: ")))))))) ) (command "leader" (getpoint "Arrow point: ") (getpoint (getvar "lastpoint") "Dimension location: ") "" circumstr "") (princ)) rs --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.698 / Virus Database: 455 - Release Date: 6/3/2004
*Doug Broad
Message 4 of 10 (154 Views)

Re: Circumference Dimension

06-05-2004 05:59 AM in reply to: Charliep
Charlie, This should work most of the time. Be sure to set dimassoc = 2. (defun c:circum( / ) ;;D. C. Broad, 6/5/2004 - Circumference dimension (command "dim1" "rad" pause "Circ: <>" "exit") (command "dimoverride" "dimlfac" (* 2 pi) "" "last" "") (Princ)) "Charliep" wrote in message news:13052638.1086363817589.JavaMail.javamailuser@localhost... > Does any one have a routine that will dimension for a Circumference that you would share? > > I know that the circumference can be obtained in the properties box, however it would be nice if it were associative. > > By the way I use A2K4 > > Thanks in advanced.
*Jos� Luis Garcia Gal�n
Message 5 of 10 (154 Views)

Re: Circumference Dimension

06-05-2004 03:29 PM in reply to: Charliep
Excelente Doug.... "Doug Broad" escribió en el mensaje news:40c1c3b3$1_3@newsprd01... > Charlie, > This should work most of the time. Be sure to set dimassoc = 2. > > (defun c:circum( / ) > ;;D. C. Broad, 6/5/2004 - Circumference dimension > (command "dim1" "rad" pause "Circ: <>" "exit") > (command "dimoverride" "dimlfac" (* 2 pi) > "" "last" "") > (Princ)) > > > "Charliep" wrote in message news:13052638.1086363817589.JavaMail.javamailuser@localhost... > > Does any one have a routine that will dimension for a Circumference that you would share? > > > > I know that the circumference can be obtained in the properties box, however it would be nice if it were associative. > > > > By the way I use A2K4 > > > > Thanks in advanced. > >
*Doug Broad
Message 6 of 10 (154 Views)

Re: Circumference Dimension

06-05-2004 05:37 PM in reply to: Charliep
Thank you José. "José Luis Garcia Galán" wrote in message news:40c247bc_1@newsprd01... > Excelente Doug.... >
*Jürg Menzi
Message 7 of 10 (154 Views)

Re: Circumference Dimension

06-06-2004 04:34 AM in reply to: Charliep
Hi Doug Excellent idea... may be improved a little bit: (defun C:Circum ( / OldCmd OldDas) ;;D. C. Broad, 6/5/2004 - Circumference dimension (setq OldDas (getvar "DIMASSOC") OldCmd (getvar "CMDECHO") ) (setvar "DIMASSOC" 2) ;ensure associative dim (setvar "CMDECHO" 1) ;ensure prompts (command "_.DIM1" "_RAD" pause "" pause ;drag dim to position "_.DIMOVERRIDE" "DIMPOST" "Circ: <>" ;remove 'R' from dim "DIMLFAC" (* 2 pi) "" "_LAST" "" ) (setvar "DIMASSOC" OldDas) (setvar "CMDECHO" OldCmd) (princ) ) Cheers -- Juerg Menzi MENZI ENGINEERING GmbH, Switzerland http://www.menziengineering.ch
*Doug Broad
Message 8 of 10 (154 Views)

Re: Circumference Dimension

06-06-2004 06:46 AM in reply to: Charliep
Excellent changes Juerg. I added some final polishing: Thanks! [code] (defun c:circum( / oce oda *error*) ;;D. C. Broad, 6/5/2004 Circumference of a circle ;;With changes designed by Juerg Menzi on 6/6/2004 ;;Dimassoc should be set to 2 (setq oce (getvar "cmdecho") oda (getvar "dimassoc")) (defun *error* (msg) (setvar "cmdecho" oce) (setvar "dimassoc" oda) (if msg (princ msg)) (princ)) (setvar "cmdecho" 1) (setvar "dimassoc" 2) (command "_.dim1" "_.rad" pause "" pause) (setvar "cmdecho" 0) (command "_.dimoverride" "dimlfac" (* 2 pi) "dimpost" "Circ: <>" "" "_last" "") (*error* nil)) [/code] "Jürg Menzi" wrote in message news:40C30160.EBA53CA@menziengineering.ch... > Hi Doug > > Excellent idea... may be improved a little bit: > > (defun C:Circum ( / OldCmd OldDas) > ;;D. C. Broad, 6/5/2004 - Circumference dimension > (setq OldDas (getvar "DIMASSOC") > OldCmd (getvar "CMDECHO") > ) > (setvar "DIMASSOC" 2) ;ensure associative dim > (setvar "CMDECHO" 1) ;ensure prompts > (command "_.DIM1" "_RAD" pause "" pause ;drag dim to position > "_.DIMOVERRIDE" "DIMPOST" "Circ: <>" ;remove 'R' from dim > "DIMLFAC" (* 2 pi) > "" "_LAST" "" > ) > (setvar "DIMASSOC" OldDas) > (setvar "CMDECHO" OldCmd) > (princ) > ) > > Cheers > -- > Juerg Menzi > MENZI ENGINEERING GmbH, Switzerland > http://www.menziengineering.ch
*Jürg Menzi
Message 9 of 10 (154 Views)

Re: Circumference Dimension

06-07-2004 12:58 AM in reply to: Charliep
Hi Doug Good points... - Normally I never use this kind of error handler because I've one in my common functions: (defun... (MeStartProc '("SYSVAR1"... "SYSVARn")) ;stores sysvars etc... ...Code (MeEndProc) ) For a standalone function you've chosen the correct way. - Suppressing prompts for "_.dimoverride" - as it must be. Cheers -- Juerg Menzi MENZI ENGINEERING GmbH, Switzerland http://www.menziengineering.ch
Distinguished Contributor
Charliep
Posts: 163
Registered: ‎01-07-2004
Message 10 of 10 (154 Views)

Re: Circumference Dimension

06-07-2004 05:50 AM in reply to: Charliep
Many thanks to all who offered solutions. I have not tried all of the options that you gave me, but the ones I have tried have been what I needed.
Again THANKS!!!!

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