animageo 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- animageo/__init__.py +1 -0
- animageo/__main__.py +69 -0
- animageo/animageo.py +1331 -0
- animageo/geo/__init__.py +0 -0
- animageo/geo/construction.py +345 -0
- animageo/geo/lib_commands.py +966 -0
- animageo/geo/lib_elements.py +447 -0
- animageo/geo/lib_vars.py +72 -0
- animageo/parsers/__init__.py +0 -0
- animageo/parsers/ggb_generator.py +445 -0
- animageo/parsers/ggb_parser.py +516 -0
- animageo/parsers/short_parser.py +100 -0
- animageo/parsers/svg_parser.py +116 -0
- animageo-0.1.0.dist-info/METADATA +213 -0
- animageo-0.1.0.dist-info/RECORD +32 -0
- animageo-0.1.0.dist-info/WHEEL +5 -0
- animageo-0.1.0.dist-info/entry_points.txt +2 -0
- animageo-0.1.0.dist-info/licenses/LICENSE.txt +1 -0
- animageo-0.1.0.dist-info/top_level.txt +1 -0
- geodynamic/__init__.py +0 -0
- geodynamic/__main__.py +69 -0
- geodynamic/geo/__init__.py +0 -0
- geodynamic/geo/construction.py +271 -0
- geodynamic/geo/lib_commands.py +907 -0
- geodynamic/geo/lib_elements.py +438 -0
- geodynamic/geo/lib_vars.py +67 -0
- geodynamic/manim_dynamic.py +1173 -0
- geodynamic/parsers/__init__.py +0 -0
- geodynamic/parsers/ggb_generator.py +445 -0
- geodynamic/parsers/ggb_parser.py +458 -0
- geodynamic/parsers/short_parser.py +106 -0
- geodynamic/parsers/svg_parser.py +116 -0
animageo/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .animageo import *
|
animageo/__main__.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
|
|
4
|
+
def main():
|
|
5
|
+
parser = argparse.ArgumentParser(prog='animageo', description='Converting GeoGebra construction file into SVG image.')
|
|
6
|
+
parser.add_argument('ggbfile',
|
|
7
|
+
help='GeoGebra file to convert')
|
|
8
|
+
parser.add_argument('-o', '--output', type=str,
|
|
9
|
+
help="SVG file to export into")
|
|
10
|
+
parser.add_argument('-px', nargs=2,
|
|
11
|
+
help="image width and height in px (values: num or auto)")
|
|
12
|
+
parser.add_argument('-s', '--style', type=str, default='pandora.json',
|
|
13
|
+
help="JSON file with style definitions")
|
|
14
|
+
parser.add_argument('-d', '--debug', action='store_true',
|
|
15
|
+
help="print options")
|
|
16
|
+
|
|
17
|
+
args = parser.parse_args()
|
|
18
|
+
|
|
19
|
+
def create_tempfile_for_manim():
|
|
20
|
+
f = open('temp.py', 'w')
|
|
21
|
+
f.write('''\
|
|
22
|
+
|
|
23
|
+
#this file has been autogenerated by AnimaGeo
|
|
24
|
+
|
|
25
|
+
from animageo import *
|
|
26
|
+
|
|
27
|
+
class Scene(AnimaGeoScene):
|
|
28
|
+
def construct(self):
|
|
29
|
+
self.loadGeoGebra(''' + "'" + args.ggbfile + "'" + ''', style_json_file = ''' + "'" + args.style + "'" + ''', px_size = ''' + str(args.px) + ''', debug = ''' + "'" + str(args.debug) + "'" + ''')
|
|
30
|
+
#print(self.geo)
|
|
31
|
+
self.exportSVG(''' + "'" + args.output + "')"
|
|
32
|
+
|
|
33
|
+
)
|
|
34
|
+
f.close()
|
|
35
|
+
|
|
36
|
+
if 'ggbfile' in args:
|
|
37
|
+
if not os.path.exists(args.ggbfile):
|
|
38
|
+
print('not finded ggb file: ' + args.ggbfile)
|
|
39
|
+
exit(-1)
|
|
40
|
+
|
|
41
|
+
if args.style is None:
|
|
42
|
+
args.__setattr__('style', 'default.json')
|
|
43
|
+
|
|
44
|
+
if not os.path.exists(args.style):
|
|
45
|
+
print('not finded style file: ' + args.style)
|
|
46
|
+
exit(-1)
|
|
47
|
+
|
|
48
|
+
if args.output is None:
|
|
49
|
+
args.__setattr__('output', args.ggbfile.replace('.ggb', '.svg'))
|
|
50
|
+
|
|
51
|
+
if args.px is None:
|
|
52
|
+
args.__setattr__('px', [640, 480])
|
|
53
|
+
|
|
54
|
+
create_tempfile_for_manim()
|
|
55
|
+
|
|
56
|
+
if args.debug:
|
|
57
|
+
print('FROM: ', args.ggbfile)
|
|
58
|
+
print('TO: ', args.output)
|
|
59
|
+
print('SIZE: ', args.px)
|
|
60
|
+
print('STYLE: ', args.style)
|
|
61
|
+
|
|
62
|
+
print('Running manim... [be patient, first run may take a longer time]')
|
|
63
|
+
os.system('manim temp.py Pandora')
|
|
64
|
+
|
|
65
|
+
print('-----------------')
|
|
66
|
+
print("SVG file exported: '" + args.ggbfile.replace('.ggb', '.svg') + "'\n\n")
|
|
67
|
+
|
|
68
|
+
if __name__ == '__main__':
|
|
69
|
+
main()
|