Skip to content

Commit 5a9e8ab

Browse files
committed
Added in Doc module
1 parent 9c12fe0 commit 5a9e8ab

File tree

12 files changed

+913
-14
lines changed

12 files changed

+913
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ interpreter.
8484
I don't want to give a false impression that it works from this carefully staged screenshot,
8585
it mostly doesn't.
8686

87-
![](Screenshot_0.png)
87+
![](docs/Screenshot_0.png)
8888

doc_extra.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import multiprocessing
2+
from pathlib import Path
3+
import hashlib
4+
5+
#Need to run this in a subprocess because of https://github.com/pyqtgraph/pyqtgraph/issues/2618
6+
def scad_image_subprocess(path, code_block):
7+
from pysdfscad.main import OpenscadFile
8+
9+
file = OpenscadFile()
10+
file.text=code_block
11+
image = file.as_image()
12+
image.save(str(path))
13+
14+
15+
def define_env(env):
16+
17+
@env.macro
18+
def scad_image(code_block):
19+
manager = multiprocessing.Manager()
20+
digest = hashlib.md5(code_block.encode()).hexdigest()
21+
22+
imageRoot = Path('docs/images/auto')
23+
imageRoot.mkdir(parents=True, exist_ok=True)
24+
imagePath = imageRoot/(digest+".png")
25+
26+
if not imagePath.exists():
27+
p = multiprocessing.Process(target=scad_image_subprocess, args=(imagePath, code_block))
28+
p.start()
29+
p.join()
30+
return '```openscad'+code_block+'```\n\n'+f"![Preview of code block](/images/auto/{digest}.png)\n\n"

docs/3D_objects.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
## Primitive Solids
3+
4+
### Cube
5+
6+
{{scad_image("""
7+
cube([10,10,10]);
8+
""")}}
9+
10+
### Cylinder
11+
12+
{{scad_image(
13+
"""
14+
cylinder(r=5,h=10);
15+
"""
16+
)}}
17+
18+
### Sphere
19+
20+
{{scad_image("""
21+
sphere(r=5);
22+
""")}}
23+
File renamed without changes.

docs/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: pysdfscad.openscad_builtins

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Hephorge
2+
3+
Programmers CAD with advanced features like bevels.
4+
5+
![Main Screenshot](Screenshot_0.png)

docs/transformations.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Transformations
2+
3+
## From Openscad
4+
5+
### Movement operations
6+
7+
#### Translate
8+
9+
{{scad_image(
10+
"""
11+
translate([-10,-10,5])cube([10,10,10]);
12+
"""
13+
)}}
14+
15+
#### rotate
16+
17+
{{scad_image(
18+
"""
19+
rotate([0,0,45])cube([10,10,10]);
20+
"""
21+
)}}
22+
23+
### CSG operations
24+
25+
Under Hephorge most CSG operations support the "smooth" argument.
26+
27+
#### Difference
28+
29+
{{scad_image(
30+
"""
31+
difference(){
32+
cube([10,10,10]);
33+
translate([12,12,-1])cylinder(r=10,h=12);
34+
}
35+
"""
36+
)}}
37+
38+
{{scad_image(
39+
"""
40+
difference(smooth = 1){
41+
cube([10,10,10]);
42+
translate([12,12,-1])cylinder(r=10,h=12);
43+
}
44+
"""
45+
)}}
46+
47+
#### Intersection
48+
49+
{{scad_image(
50+
"""
51+
intersection(){
52+
cube([10,10,10]);
53+
cylinder(r=10,h=12);
54+
}
55+
"""
56+
)}}
57+
58+
{{scad_image(
59+
"""
60+
intersection(smooth=1){
61+
cube([10,10,10]);
62+
cylinder(r=10,h=12);
63+
}
64+
"""
65+
)}}
66+
67+
68+
## Hephorge extentions
69+
70+
### Blend
71+
72+
{{scad_image(
73+
"""
74+
blend(ratio=0.5){
75+
cube([10,10,10]);
76+
translate([5,5,5])sphere(r=10);
77+
}
78+
"""
79+
)}}
80+
81+
### Shell
82+
83+
Very usefull for making things like pipes or moulds.
84+
85+
{{scad_image(
86+
"""
87+
difference(){
88+
shell(thickness=1)cube([10,10,10]);
89+
translate([12,12,-1])cylinder(r=10,h=12);
90+
}
91+
"""
92+
)}}

mkdocs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
site_name: Hephorge
2+
theme:
3+
name: readthedocs
4+
highlightjs: true
5+
hljs_languages:
6+
- python
7+
- openscad
8+
9+
plugins:
10+
- mkdocstrings
11+
- search
12+
- macros:
13+
module_name: doc_extra
14+
15+
nav:
16+
- 3D_objects.md
17+
- transformations.md
18+
- api.md

poetry.lock

Lines changed: 683 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pyqtgraph = {version = "^0.13.1", optional = true}
2525
pyopengl = {version = "^3.1.6", optional=true}
2626
appdirs = "^1.4.4"
2727
astor = "^0.8.1"
28+
mkdocs-macros-plugin = "^0.7.0"
2829

2930
[tool.poetry.extras]
3031
qtgui = ["PyQt5","qscintilla","pysdfscad_qtgui","pyqtgraph","pyopengl"]
@@ -43,6 +44,9 @@ ordered-set = "^4.1.0"
4344
zstandard = "^0.19.0"
4445
pyinstaller = "^5.8.0"
4546
pyinstaller-hooks-contrib = "^2022.15"
47+
mkdocs = "^1.4.2"
48+
mkdocstrings = {extras = ["python"], version = "^0.20.0"}
49+
mkdocs-material = "^9.0.12"
4650

4751
[build-system]
4852
requires = ["poetry-core"]

0 commit comments

Comments
 (0)