Completed initial CAD package guides, tweaked initial code import
This commit is contained in:
17
app/web/src/helpers/cadPackages/cadQuery/initialCode.py
Normal file
17
app/web/src/helpers/cadPackages/cadQuery/initialCode.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# demo shaft coupler
|
||||
|
||||
# ^ first comment is used for download title (i.e. "demo-shaft-coupler.stl")
|
||||
|
||||
# CadQuery docs: https://cadquery.readthedocs.io/
|
||||
|
||||
import cadquery as cq
|
||||
from cadquery import exporters
|
||||
|
||||
diam = 5.0
|
||||
|
||||
result = (cq.Workplane().circle(diam).extrude(20.0)
|
||||
.faces(">Z").workplane(invert=True).circle(1.05).cutBlind(8.0)
|
||||
.faces("<Z").workplane(invert=True).circle(0.8).cutBlind(12.0)
|
||||
.edges("%CIRCLE").chamfer(0.15))
|
||||
|
||||
show_object(result)
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
"Written with": Python
|
||||
"Kernal type": BREP
|
||||
title: CadQuery
|
||||
Written with: Python
|
||||
Kernal type: BREP
|
||||
Maintained by: [The CadQuery Group](https://github.com/CadQuery)
|
||||
Documentation: [cadquery.readthedocs.io](https://cadquery.readthedocs.io)
|
||||
---
|
||||
# CadQuery
|
||||
|
||||
CadQuery is an intuitive, easy-to-use Python library for building parametric 3D CAD models. It has several goals:
|
||||
|
||||
- Build models with scripts that are as close as possible to how you’d describe the object to a human, using a standard, already established programming language
|
||||
|
||||
33
app/web/src/helpers/cadPackages/jsCad/initialCode.jscad
Normal file
33
app/web/src/helpers/cadPackages/jsCad/initialCode.jscad
Normal file
@@ -0,0 +1,33 @@
|
||||
const jscad = require('@jscad/modeling')
|
||||
// https://openjscad.xyz/docs/module-modeling_primitives.html
|
||||
const { cuboid, cylinder } = jscad.primitives
|
||||
|
||||
const { rotate, translate } = jscad.transforms
|
||||
const { degToRad } = jscad.utils // because jscad uses radians for rotations
|
||||
// https://openjscad.xyz/docs/module-modeling_booleans.html
|
||||
const { subtract } = jscad.booleans
|
||||
|
||||
function main({//@jscad-params
|
||||
// Box example
|
||||
width=40, // Width
|
||||
length=20, // Length
|
||||
height=10, // Height
|
||||
hole=3,// Hole for cables diameter (0=no hole)
|
||||
wall=1, // wall {min:0.5, step:0.5}
|
||||
flip=0, // print orientation {type: 'choice', values: [0, 90, 180]}
|
||||
}){
|
||||
|
||||
let wallOffset = wall * 2
|
||||
let model = subtract(
|
||||
cuboid({size:[width, length, height]}),
|
||||
translate([0,0,wall], cuboid({size:[width-wallOffset, length-wallOffset, height+wall]})),
|
||||
)
|
||||
if(hole){
|
||||
model = subtract( model,
|
||||
translate([width/2-wall/2], rotate([0, degToRad(90), 0 ], cylinder({radius:hole/2, height:wall})))
|
||||
)
|
||||
}
|
||||
return rotate([degToRad(flip), 0, degToRad(90)], model)
|
||||
}
|
||||
|
||||
module.exports = {main}
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
"Written with": JavaScript
|
||||
"Kernal type": BREP
|
||||
title: JSCAD
|
||||
Written with: JavaScript
|
||||
Kernal type: BREP
|
||||
Maintained by: [Z3 Development + 39 contributors](https://www.github.com/jscad)
|
||||
Documentation: [openjscad.xyz/docs](https://openjscad.xyz/docs/)
|
||||
---
|
||||
# JSCAD
|
||||
|
||||
JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with Javascript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
|
||||
12
app/web/src/helpers/cadPackages/openScad/initialCode.SCAD
Normal file
12
app/web/src/helpers/cadPackages/openScad/initialCode.SCAD
Normal file
@@ -0,0 +1,12 @@
|
||||
// involute donut
|
||||
|
||||
// ^ first comment is used for download title (i.e "involute-donut.stl")
|
||||
|
||||
// Follow the OpenSCAD tutorial: https://learn.cadhub.xyz/docs/
|
||||
|
||||
radius=3;
|
||||
color(c="DarkGoldenrod")rotate_extrude()translate([20,0])circle(d=30);
|
||||
color(c="hotpink")rotate_extrude()translate([20,0])offset(radius)offset(-radius)difference(){
|
||||
circle(d=34);
|
||||
translate([-200,-500])square([500,500]);
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
"Written with": C+-like
|
||||
"Kernal type": BREP
|
||||
title: OpenSCAD
|
||||
Written with: Custom language
|
||||
Kernal type: BREP
|
||||
Maintained by: [Marius Kintel + 15 members](https://github.com/openscad)
|
||||
Documentation: [openscad.org](https://openscad.org/)
|
||||
---
|
||||
# OpenSCAD
|
||||
|
||||
OpenSCAD is a solid 3D modeler that enables the creation of parametric models using its scripting language. Models are created by utilizing a technique called constructive solid geometry. According to this technique, simple objects can be transformed and combined in order to create almost any complex model.
|
||||
Reference in New Issue
Block a user