degree calculator
This commit is contained in:
parent
bbd96ea985
commit
45fc776a1e
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,3 +20,4 @@ __pycache__
|
|||||||
*.run.xml
|
*.run.xml
|
||||||
|
|
||||||
env/
|
env/
|
||||||
|
*.pyc
|
||||||
|
@ -15,10 +15,10 @@ useful commands:
|
|||||||
- f8: perpendicular
|
- f8: perpendicular
|
||||||
- f2: console
|
- f2: console
|
||||||
|
|
||||||
questions:
|
- rotate
|
||||||
- what to click to create an xline with the same offset (accept suggestion)?
|
- scale: by reference -- turint palyginimo objektą.
|
||||||
- how to draw a semicircular? construction line: xl, bisect.
|
|
||||||
- how to add a dimension text (kelio ašis)? dt (dtext).
|
- hutch: štrichavimas.
|
||||||
- how to make a legend? line type.
|
- draworder: bring to front/back.
|
||||||
- how to add labels to the coordinate system?
|
- re: Regenerate screen
|
||||||
- how to scale the overlay sheet of paper? stretch.
|
- circle: 2p/3p/ttr. Liestinės.
|
||||||
|
@ -1,7 +1,26 @@
|
|||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
def deg(deg, mm, ss):
|
class Deg:
|
||||||
return (Decimal(deg) +
|
def __str__(self):
|
||||||
Decimal(mm) / Decimal(60) +
|
return "%03d - %02d - %02d" % (self.deg, self.mm, self.ss)
|
||||||
Decimal(ss) / Decimal(3600)).normalize()
|
|
||||||
|
def __init__(self, deg, mm, ss):
|
||||||
|
self.deg = Decimal(deg)
|
||||||
|
self.mm = Decimal(mm)
|
||||||
|
self.ss = Decimal(ss)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_1(deg):
|
||||||
|
assert isinstance(deg, Decimal)
|
||||||
|
|
||||||
|
pdeg, pmm = divmod(deg, 1)
|
||||||
|
pmm = pmm * Decimal(60)
|
||||||
|
pmm, pss = divmod(pmm, 1)
|
||||||
|
pss = pss * Decimal(60)
|
||||||
|
return Deg(pdeg, pmm, pss)
|
||||||
|
|
||||||
|
def frac(self):
|
||||||
|
return (
|
||||||
|
self.deg +
|
||||||
|
self.mm / Decimal(60) +
|
||||||
|
self.ss / Decimal(3600)).normalize()
|
||||||
|
Loading…
Reference in New Issue
Block a user