Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
906b94fc4f | |||
ddc87b8ec7 | |||
27a4cf5626 |
47
build/doc/index.html
Normal file
47
build/doc/index.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"three": "https://unpkg.com/three/build/three.module.js"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- based on three.js example here: <https://jsfiddle.net/2nyxkmco/> -->
|
||||
<script type="module">
|
||||
import * as THREE from 'three';
|
||||
|
||||
const width = window.innerWidth, height = window.innerHeight;
|
||||
|
||||
// init
|
||||
|
||||
const camera = new THREE.PerspectiveCamera( 70, width / height, 0.01, 10 );
|
||||
camera.position.z = 1;
|
||||
|
||||
const scene = new THREE.Scene();
|
||||
|
||||
const geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
|
||||
const material = new THREE.MeshNormalMaterial();
|
||||
|
||||
const mesh = new THREE.Mesh( geometry, material );
|
||||
scene.add( mesh );
|
||||
|
||||
const renderer = new THREE.WebGLRenderer( { antialias: true } );
|
||||
renderer.setSize( width, height );
|
||||
renderer.setAnimationLoop( animation );
|
||||
document.body.appendChild( renderer.domElement );
|
||||
|
||||
// animation
|
||||
|
||||
function animation( time ) {
|
||||
mesh.rotation.x = time / 2000;
|
||||
mesh.rotation.y = time / 1000;
|
||||
|
||||
renderer.render( scene, camera );
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@@ -58,6 +58,7 @@ def main():
|
||||
parser.add_argument("--render-phone", action="store_true", help="include the phone model itself in the stl; useful to confirm fit visually before printing")
|
||||
parser.add_argument("--export-stl")
|
||||
parser.add_argument("--export-svg")
|
||||
parser.add_argument("--export-tjs")
|
||||
parser.add_argument("--editor", action="store_true", help="view in cq-editor")
|
||||
|
||||
args = parser.parse_args()
|
||||
@@ -71,6 +72,7 @@ def main():
|
||||
if args.export_stl:
|
||||
logger.info("exporting stl to %s", args.export_stl)
|
||||
cq.exporters.export(model_, args.export_stl)
|
||||
|
||||
if args.export_svg:
|
||||
view = None
|
||||
if "front" in args.export_svg:
|
||||
@@ -81,6 +83,17 @@ def main():
|
||||
view = "right"
|
||||
logger.info("exporting svg to %s (view: %s)", args.export_svg, str(view))
|
||||
cq.exporters.export(model_, args.export_svg, opt=svg_export_options(view))
|
||||
|
||||
if args.export_tjs:
|
||||
logger.info("exporting three.js to %s", args.export_tjs)
|
||||
cq.exporters.export(
|
||||
model_,
|
||||
args.export_tjs,
|
||||
tolerance=0.01,
|
||||
angularTolerance=0.1,
|
||||
exportType=cq.exporters.ExportTypes.TJS,
|
||||
)
|
||||
|
||||
if args.editor:
|
||||
logger.info("launching cq-editor")
|
||||
subprocess.check_call(["cq-editor", __file__])
|
||||
|
Reference in New Issue
Block a user