TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: DEVITG on February 21, 2004, 04:40:07 PM
-
Hi all .
Has I born in a metric country, I allways use decimal as UNIT system.
But seldom I need to let the user to choose the unit system he/she want to use.
How it can be done by LISP :oops:
-
Not sure of the question, but have you tried (setvar 'luprec 4)?
-
Hi daron , luprec hold the decimal after the decimal point
What I'm looking for is to be able to change the way units can be input.
The drawing could be >
Architectural [ 12' 10 1/4"]
Decimal [123.4589]
engeenirring [12' -0.0005"]
Fractional [0 1/8"]
Scientific [ 10 e 2]
It can be set by the UNITS command
How it can be set from a lisp.
-
try (setvar 'lunits 4). I'm only throwing out what comes to mind as I am not currently on a machine with autocad. I realized after I posted that what I wrote wouldn't be the answer, ah well.
-
lunits is the answer ....
-
Hi Daron and Keith that is what I was lookin for.
Thanks again.
:lol: :) :D :wink: :!: :!:
-
(defun c:sdim ()
(initget 7)
(setq ds (getint "\nEnter <1> for Scientfic <2> for Decimal <3> Engineering <4> Architectural"))
(command "dimunit" ds "")
)
(princ)
I know someone else out there can improve on this.....
-
:oops:
As I told you before , I allways use decimal .
If LUNITS is set to 4 how I must input the values
I only can input 12'10
But I can not input 12'10"3/4
How I shal key in the value??? :?: :oops: :oops: :cry:
-
Hi Rude Dog
Nice routine , but I change the LUNITS just to input values , maybe I need to change the DIMUNITS too so the user will be able to DIM in architectural.
Thanks for it
-
I think this will do it...
(defun C:UU ()
(initget 7)
(setq UA (getint "\nEnter <1> for Scientfic <2> for Decimal <3> Engineering <4> Architectural"))
(setvar UA)
)
(princ)
-
If it is wrong it was me RDOG the unknown guest....
Hey DEVITG...this place is the best for any code questions me being a newbie myself I am astounded daily by some of these peoples creativity and knowledge....Enjoy your stay
-
Your distance is 12'-10 3/4" which is equal to 154.75 in decimal or 154 3/4"
To enter a value when LUNITS is set to 4 (architectural) do it this way:
FEET'-INCHES FRACTIONS"
or
INCHES FRACTIONS"
Note the location of the single and double tic marks for the feet and inches designation.
I hope you understand now....
-
Hi keith .
I'm missing something
I can type 12' -10"
but I can not put the fractions
Specify radius of circle or [Diameter] <0'-10">: 0'-10"3/4
Requires numeric radius, point on circumference, or "D".
-
You have to put the inch mark AFTER the fraction and a space between the fraction and full inches as I showed in the above example...
12'-10 3/4"
-
Keith , please apologize me for so insistent.
Set lunits to 4 , when I put the 0'12-10 it is OK , but when I type an space after the 10 to put the fraction it do an enter and send me a error messg.
Specify radius of circle or [Diameter] <1'-0">: 0'-103/4"
Requires numeric radius, point on circumference, or "D".
Specify radius of circle or [Diameter] <1'-0">: 0'-10"3/4
Requires numeric radius, point on circumference, or "D".
Specify radius of circle or [Diameter] <1'-0">: 0'-10
Only the last one is ok but I can not put the fractios , what I'm doing wrong???? :oops: :oops: :cry: :cry:
-
Command: l LINE Specify first point: 0,0,0
Specify next point or [Undo]: 12'10-3/4
Command: l LINE Specify first point:
Specify next point or [Undo]: 10
Command: LINE
Specify first point:
Specify next point or [Undo]: 10-3/8
Command: l LINE Specify first point:
Specify next point or [Undo]: 1'0-7/8
-
If you are using the input in a program using the GETSTRING function you must use it in the following manner....
(getstring T "put prompt here")
Then you can enter it with a space, or you alternatively can enter it as RD has shown above OR you can neter it as a sort of hybridlike so...
12'10.75"
12'-10.75"
-
kind of related to this i would like a way to quickly toggle between architectural and fractional units. i am in fabricational so we use fractional but when i'm doing layout work from architectural i use architectural. what would a button to do this look like?
-
I think RD's example is the answer. You separate the inches from fractions by a hypen "-". You don't need the inch mark at all. It is implied.
-
"fabricational" is that a word? i figured it out guys nevermind
-
Please put it in a button macro .
(if (= (getvar "lunits" ) 4 ) (setvar "lunits" 5 ) (Setvar "lunits" 4))
If you only use fract and archi .
"fabricational" is a word to name the drafter make thing to be fabricated.
:wink: :lol:
-
i was getting ahead of myself. if you look i used fractional shortly after fabrication making it fabricational. dyslexia :roll:
-
Devitg,
If you are as familiar with imperial units as I am [which is pretty much close to nothing], you might have stumbled on a puzzling thing. When you draw a line say 12'10-3/4
Command: LINE Specify first point:
Specify next point or [Undo]: 12'10-3/4
then list the line you will notice a different format of the length is given
Length =12'-10 3/4" , Angle in XY Plane = 308
Delta X =7'-11 15/16", Delta Y = -10'-1 7/16", Delta Z =
This happens when your UNITMODE is set on 0, when set on 1
Length =12'10-3/4" , Angle in XY Plane = 308
Delta X =7'11-15/16", Delta Y = -10'1-7/16", Delta Z =
that might help when debugging.