From 556cd30d15baf99d5ae0d37576912c56468e66d3 Mon Sep 17 00:00:00 2001 From: davidferlay Date: Thu, 13 Feb 2025 16:52:27 +0000 Subject: [PATCH] deploy: b006f5fcacce87f33fae98420a70723144d9ac93 --- assets/{index-TD1RGriO.js => index-ZXVfxMbv.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-TD1RGriO.js => index-ZXVfxMbv.js} (99%) diff --git a/assets/index-TD1RGriO.js b/assets/index-ZXVfxMbv.js similarity index 99% rename from assets/index-TD1RGriO.js rename to assets/index-ZXVfxMbv.js index cea7ea2..3ddaf7f 100644 --- a/assets/index-TD1RGriO.js +++ b/assets/index-ZXVfxMbv.js @@ -3441,4 +3441,4 @@ ${Bc(t.vertices[i+2])} endloop endfacet`;e.push(s)}}return e.join(` `)};var DF={serializeText:RF};const{geometries:UF,modifiers:IF}=tu,{flatten:NF,toArray:FF}=TF,{serializeBinary:OF}=AF,{serializeText:BF}=DF,zF="application/sla",HF=(t,...e)=>{t=Object.assign({},{binary:!0,statusCallback:null},t),e=NF(e);let i=e.filter(s=>UF.geom3.isA(s));if(i.length===0)throw new Error("only 3D geometries can be serialized to STL");return e.length!==i.length&&console.warn("some objects could not be serialized to STL"),i=FF(IF.generalize({snap:!0,triangulate:!0},i)),t.binary?OF(i,t):BF(i,t)};var VF={mimeType:zF,serialize:HF};const GF={props:["width","length"],data(){return{stlData:null}},created(){this.scene=null,this.camera=null,this.renderer=null,this.controls=null,this.mesh=null},mounted(){this.initScene(),this.regenerateAndLoad()},watch:{width(){this.regenerateAndLoad()},length(){this.regenerateAndLoad()}},methods:{generateSTL(t,e){try{const n=pI({width:t,length:e});return VF.serialize({binary:!1},n).join(` -`)}catch(n){return console.error("Error generating JSCAD geometry or STL:",n),null}},regenerateAndLoad(){this.mesh&&(this.scene.remove(this.mesh),this.mesh.geometry.dispose(),this.mesh=null);const t=this.generateSTL(this.width,this.length);if(!t)return;this.stlData=t;const e=new Blob([t],{type:"text/plain"}),n=URL.createObjectURL(e);new Py().load(n,s=>{this.mesh=new ii(s,new My({color:30719})),this.scene.add(this.mesh)},void 0,s=>{console.error("STLLoader error:",s)})},initScene(){this.scene=new xy,this.camera=new pn(75,500/500,.1,1e3),this.camera.position.set(0,100,200),this.camera.lookAt(0,0,0),this.renderer=new Em({canvas:this.$refs.canvas,antialias:!0}),this.renderer.setSize(500,500),this.renderer.setClearColor(15790320);const t=new Ry(4210752);this.scene.add(t);const e=new Ay(16777215,1);e.position.set(1,1,1).normalize(),this.scene.add(e),this.controls=new Cy(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.05,this.controls.screenSpacePanning=!0,this.controls.minDistance=50,this.controls.maxDistance=1e3,this.animate()},animate(){requestAnimationFrame(this.animate),this.controls.update(),this.renderer.render(this.scene,this.camera)},downloadSTL(){if(!this.stlData)return;const t=new Blob([this.stlData],{type:"application/octet-stream"}),e=document.createElement("a");e.href=URL.createObjectURL(t),e.download="modified_model.stl",e.click()}}},$F={class:"mt-6 flex flex-col items-center"},kF={ref:"canvas",class:"border border-gray-300 rounded-md"};function WF(t,e,n,i,s,r){return Ll(),Dl("div",$F,[Lt("canvas",kF,null,512),Lt("button",{onClick:e[0]||(e[0]=(...o)=>r.downloadSTL&&r.downloadSTL(...o)),class:"mt-4 px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600"}," Download STL ")])}const XF=Il(GF,[["render",WF],["__scopeId","data-v-362f0f6f"]]),qF={name:"App",components:{InputForm:vv,ModelViewer:XF},data(){return{width:51,length:68}},methods:{updateDimensions(t){this.width=t.width,this.length=t.length}}},YF={class:"max-w-2xl mx-auto min-h-screen flex flex-col justify-center items-center p-6"},jF={class:"w-full bg-white rounded shadow p-6"};function KF(t,e,n,i,s,r){const o=uu("InputForm"),a=uu("ModelViewer");return Ll(),Dl("div",YF,[e[0]||(e[0]=Lt("div",{class:"mb-8 text-center"},[Lt("h1",{class:"text-4xl font-bold mb-2"},"SynthArmor"),Lt("p",{class:"text-gray-600"}," Modify the dimensions of a 3D model and download your custom design instantly. ")],-1)),Lt("div",jF,[si(o,{onUpdateDimensions:r.updateDimensions},null,8,["onUpdateDimensions"]),si(a,{width:s.width,length:s.length},null,8,["width","length"])])])}const ZF=Il(qF,[["render",KF],["__scopeId","data-v-53cd1fc0"]]);fv(ZF).mount("#app"); +`)}catch(n){return console.error("Error generating JSCAD geometry or STL:",n),null}},regenerateAndLoad(){this.mesh&&(this.scene.remove(this.mesh),this.mesh.geometry.dispose(),this.mesh=null);const t=this.generateSTL(this.width,this.length);if(!t)return;this.stlData=t;const e=new Blob([t],{type:"text/plain"}),n=URL.createObjectURL(e);new Py().load(n,s=>{this.mesh=new ii(s,new My({color:30719})),this.scene.add(this.mesh)},void 0,s=>{console.error("STLLoader error:",s)})},initScene(){this.scene=new xy,this.camera=new pn(75,500/500,.1,1e3),this.camera.position.set(0,70,50),this.camera.lookAt(0,0,0),this.renderer=new Em({canvas:this.$refs.canvas,antialias:!0}),this.renderer.setSize(500,500),this.renderer.setClearColor(15790320);const t=new Ry(4210752);this.scene.add(t);const e=new Ay(16777215,1);e.position.set(1,1,1).normalize(),this.scene.add(e),this.controls=new Cy(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.05,this.controls.screenSpacePanning=!0,this.controls.minDistance=50,this.controls.maxDistance=1e3,this.animate()},animate(){requestAnimationFrame(this.animate),this.controls.update(),this.renderer.render(this.scene,this.camera)},downloadSTL(){if(!this.stlData)return;const t=new Blob([this.stlData],{type:"application/octet-stream"}),e=document.createElement("a");e.href=URL.createObjectURL(t),e.download="modified_model.stl",e.click()}}},$F={class:"mt-6 flex flex-col items-center"},kF={ref:"canvas",class:"border border-gray-300 rounded-md"};function WF(t,e,n,i,s,r){return Ll(),Dl("div",$F,[Lt("canvas",kF,null,512),Lt("button",{onClick:e[0]||(e[0]=(...o)=>r.downloadSTL&&r.downloadSTL(...o)),class:"mt-4 px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600"}," Download STL ")])}const XF=Il(GF,[["render",WF],["__scopeId","data-v-8576ef4f"]]),qF={name:"App",components:{InputForm:vv,ModelViewer:XF},data(){return{width:51,length:68}},methods:{updateDimensions(t){this.width=t.width,this.length=t.length}}},YF={class:"max-w-2xl mx-auto min-h-screen flex flex-col justify-center items-center p-6"},jF={class:"w-full bg-white rounded shadow p-6"};function KF(t,e,n,i,s,r){const o=uu("InputForm"),a=uu("ModelViewer");return Ll(),Dl("div",YF,[e[0]||(e[0]=Lt("div",{class:"mb-8 text-center"},[Lt("h1",{class:"text-4xl font-bold mb-2"},"SynthArmor"),Lt("p",{class:"text-gray-600"}," Modify the dimensions of a 3D model and download your custom design instantly. ")],-1)),Lt("div",jF,[si(o,{onUpdateDimensions:r.updateDimensions},null,8,["onUpdateDimensions"]),si(a,{width:s.width,length:s.length},null,8,["width","length"])])])}const ZF=Il(qF,[["render",KF],["__scopeId","data-v-53cd1fc0"]]);fv(ZF).mount("#app"); diff --git a/index.html b/index.html index da6fbd5..33b47f5 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet" /> - +