designix-uis 0.5.3 → 0.5.4
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.
- package/README.md +8 -0
- package/dist/designix-uis.js +1 -3
- package/dist/public/_app/immutable/chunks/{entry.EqOSi-Pf.js → entry.C3zjkdvH.js} +1 -1
- package/dist/public/_app/immutable/chunks/{index.sDAnq9IB.js → index.BROvJSft.js} +2 -2
- package/dist/public/_app/immutable/chunks/makeList.BtRSVN7R.js +88 -0
- package/dist/public/_app/immutable/chunks/paths.CQQiRxnm.js +1 -0
- package/dist/public/_app/immutable/chunks/{stores.DIH184JS.js → stores.Huum2hKK.js} +1 -1
- package/dist/public/_app/immutable/entry/{app.yRlRJ6sx.js → app.BpxPkBw3.js} +2 -2
- package/dist/public/_app/immutable/entry/start.Bz7pahS0.js +1 -0
- package/dist/public/_app/immutable/nodes/{0.Bp0gFt3a.js → 0.nCmV09r4.js} +1 -1
- package/dist/public/_app/immutable/nodes/{1.ByHqhgYV.js → 1.Cl2Wb2Sv.js} +1 -1
- package/dist/public/_app/immutable/nodes/{2.DIn8QRS-.js → 2.D3m9DKE0.js} +1 -1
- package/dist/public/_app/immutable/nodes/{3.DP7zL9Bg.js → 3.DPcZI3eM.js} +1 -1
- package/dist/public/_app/version.json +1 -1
- package/dist/public/gear/gear_wheel_wheel.html +13 -13
- package/dist/public/gear/simplified_gear_wheel.html +13 -13
- package/dist/public/heliostat/base.html +13 -13
- package/dist/public/heliostat/heliostat.html +13 -13
- package/dist/public/heliostat/heliostat_2.html +13 -13
- package/dist/public/heliostat/pole_rotor.html +13 -13
- package/dist/public/heliostat/pole_static.html +13 -13
- package/dist/public/heliostat/rake.html +13 -13
- package/dist/public/heliostat/rake_stopper.html +13 -13
- package/dist/public/heliostat/rod.html +13 -13
- package/dist/public/heliostat/spider.html +13 -13
- package/dist/public/heliostat/surface.html +13 -13
- package/dist/public/heliostat/swing.html +13 -13
- package/dist/public/heliostat/trapeze.html +13 -13
- package/dist/public/index.html +11 -11
- package/package.json +1 -1
- package/dist/public/_app/immutable/chunks/makeList.DSNiOEjA.js +0 -88
- package/dist/public/_app/immutable/chunks/paths.rg0K1zCL.js +0 -1
- package/dist/public/_app/immutable/entry/start.Ddsjp3el.js +0 -1
package/README.md
CHANGED
package/dist/designix-uis.js
CHANGED
|
@@ -12,7 +12,7 @@ import getport from "get-port";
|
|
|
12
12
|
// package.json
|
|
13
13
|
var package_default = {
|
|
14
14
|
name: "designix-uis",
|
|
15
|
-
version: "0.5.
|
|
15
|
+
version: "0.5.4",
|
|
16
16
|
description: "mini-server for static content of designix-ui",
|
|
17
17
|
type: "module",
|
|
18
18
|
private: false,
|
|
@@ -168,7 +168,5 @@ async function mini_cli(argv) {
|
|
|
168
168
|
}).strict().parseAsync();
|
|
169
169
|
await mini_server(args.directory, args.browser, args.port);
|
|
170
170
|
}
|
|
171
|
-
console.log("designix-uis says Hello!");
|
|
172
171
|
await mini_cli(process.argv);
|
|
173
|
-
console.log("designix-uis says Bye!");
|
|
174
172
|
//# sourceMappingURL=designix-uis.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as it,s as re,x as oe}from"./scheduler.pWaib8rK.js";import{a as se,b as I}from"./paths.rg0K1zCL.js";new URL("sveltekit-internal://");function ie(t,n){return t==="/"||n==="ignore"?t:n==="never"?t.endsWith("/")?t.slice(0,-1):t:n==="always"&&!t.endsWith("/")?t+"/":t}function ce(t){return t.split("%25").map(decodeURI).join("%25")}function le(t){for(const n in t)t[n]=decodeURIComponent(t[n]);return t}function ct({href:t}){return t.split("#")[0]}const fe=["href","pathname","search","toString","toJSON"];function ue(t,n,e){const r=new URL(t);Object.defineProperty(r,"searchParams",{value:new Proxy(r.searchParams,{get(a,o){if(o==="get"||o==="getAll"||o==="has")return s=>(e(s),a[o](s));n();const i=Reflect.get(a,o);return typeof i=="function"?i.bind(a):i}}),enumerable:!0,configurable:!0});for(const a of fe)Object.defineProperty(r,a,{get(){return n(),t[a]},enumerable:!0,configurable:!0});return r}const de="/__data.json",he=".html__data.json";function pe(t){return t.endsWith(".html")?t.replace(/\.html$/,he):t.replace(/\/$/,"")+de}function ge(...t){let n=5381;for(const e of t)if(typeof e=="string"){let r=e.length;for(;r;)n=n*33^e.charCodeAt(--r)}else if(ArrayBuffer.isView(e)){const r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);let a=r.length;for(;a;)n=n*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(n>>>0).toString(36)}function me(t){const n=atob(t),e=new Uint8Array(n.length);for(let r=0;r<n.length;r++)e[r]=n.charCodeAt(r);return e.buffer}const Ot=window.fetch;window.fetch=(t,n)=>((t instanceof Request?t.method:(n==null?void 0:n.method)||"GET")!=="GET"&&F.delete(pt(t)),Ot(t,n));const F=new Map;function _e(t,n){const e=pt(t,n),r=document.querySelector(e);if(r!=null&&r.textContent){let{body:a,...o}=JSON.parse(r.textContent);const i=r.getAttribute("data-ttl");return i&&F.set(e,{body:a,init:o,ttl:1e3*Number(i)}),r.getAttribute("data-b64")!==null&&(a=me(a)),Promise.resolve(new Response(a,o))}return window.fetch(t,n)}function ye(t,n,e){if(F.size>0){const r=pt(t,e),a=F.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(e==null?void 0:e.cache))return new Response(a.body,a.init);F.delete(r)}}return window.fetch(n,e)}function pt(t,n){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(t instanceof Request?t.url:t)}]`;if(n!=null&&n.headers||n!=null&&n.body){const a=[];n.headers&&a.push([...new Headers(n.headers)].join(",")),n.body&&(typeof n.body=="string"||ArrayBuffer.isView(n.body))&&a.push(n.body),r+=`[data-hash="${ge(...a)}"]`}return r}const we=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function ve(t){const n=[];return{pattern:t==="/"?/^\/$/:new RegExp(`^${Ee(t).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return n.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(o)return n.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const i=r.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return lt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return lt(String.fromCharCode(...c.slice(2).split("-").map(f=>parseInt(f,16))));const u=we.exec(c),[,h,g,d,m]=u;return n.push({name:d,matcher:m,optional:!!h,rest:!!g,chained:g?l===1&&i[0]==="":!1}),g?"(.*?)":h?"([^/]*)?":"([^/]+?)"}return lt(c)}).join("")}).join("")}/?$`),params:n}}function be(t){return!/^\([^)]+\)$/.test(t)}function Ee(t){return t.slice(1).split("/").filter(be)}function ke(t,n,e){const r={},a=t.slice(1),o=a.filter(s=>s!==void 0);let i=0;for(let s=0;s<n.length;s+=1){const c=n[s];let l=a[s-i];if(c.chained&&c.rest&&i&&(l=a.slice(s-i,s+1).filter(u=>u).join("/"),i=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||e[c.matcher](l)){r[c.name]=l;const u=n[s+1],h=a[s+1];u&&!u.rest&&u.optional&&h&&c.chained&&(i=0),!u&&!h&&Object.keys(r).length===o.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return r}function lt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Se({nodes:t,server_loads:n,dictionary:e,matchers:r}){const a=new Set(n);return Object.entries(e).map(([s,[c,l,u]])=>{const{pattern:h,params:g}=ve(s),d={id:s,exec:m=>{const f=h.exec(m);if(f)return ke(f,g,r)},errors:[1,...u||[]].map(m=>t[m]),layouts:[0,...l||[]].map(i),leaf:o(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function o(s){const c=s<0;return c&&(s=~s),[c,t[s]]}function i(s){return s===void 0?s:[a.has(s),t[s]]}}function jt(t,n=JSON.parse){try{return n(sessionStorage[t])}catch{}}function It(t,n,e=JSON.stringify){const r=e(n);try{sessionStorage[t]=r}catch{}}const N=[];function gt(t,n=it){let e;const r=new Set;function a(s){if(re(t,s)&&(t=s,e)){const c=!N.length;for(const l of r)l[1](),N.push(l,t);if(c){for(let l=0;l<N.length;l+=2)N[l][0](N[l+1]);N.length=0}}}function o(s){a(s(t))}function i(s,c=it){const l=[s,c];return r.add(l),r.size===1&&(e=n(a,o)||it),s(t),()=>{r.delete(l),r.size===0&&e&&(e(),e=null)}}return{set:a,update:o,subscribe:i}}const Ae="1708636410657",$t="sveltekit:snapshot",Dt="sveltekit:scroll",Ct="sveltekit:states",Re="sveltekit:pageurl",$="sveltekit:history",q="sveltekit:navigation",z={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},B=location.origin;function Vt(t){if(t instanceof URL)return t;let n=document.baseURI;if(!n){const e=document.getElementsByTagName("base");n=e.length?e[0].href:document.URL}return new URL(t,n)}function mt(){return{x:pageXOffset,y:pageYOffset}}function O(t,n){return t.getAttribute(`data-sveltekit-${n}`)}const Lt={...z,"":z.hover};function Ft(t){let n=t.assignedSlot??t.parentNode;return(n==null?void 0:n.nodeType)===11&&(n=n.host),n}function qt(t,n){for(;t&&t!==n;){if(t.nodeName.toUpperCase()==="A"&&t.hasAttribute("href"))return t;t=Ft(t)}}function ut(t,n){let e;try{e=new URL(t instanceof SVGAElement?t.href.baseVal:t.href,document.baseURI)}catch{}const r=t instanceof SVGAElement?t.target.baseVal:t.target,a=!e||!!r||et(e,n)||(t.getAttribute("rel")||"").split(/\s+/).includes("external"),o=(e==null?void 0:e.origin)===B&&t.hasAttribute("download");return{url:e,external:a,target:r,download:o}}function Y(t){let n=null,e=null,r=null,a=null,o=null,i=null,s=t;for(;s&&s!==document.documentElement;)r===null&&(r=O(s,"preload-code")),a===null&&(a=O(s,"preload-data")),n===null&&(n=O(s,"keepfocus")),e===null&&(e=O(s,"noscroll")),o===null&&(o=O(s,"reload")),i===null&&(i=O(s,"replacestate")),s=Ft(s);function c(l){switch(l){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Lt[r??"off"],preload_data:Lt[a??"off"],keepfocus:c(n),noscroll:c(e),reload:c(o),replace_state:c(i)}}function Pt(t){const n=gt(t);let e=!0;function r(){e=!0,n.update(i=>i)}function a(i){e=!1,n.set(i)}function o(i){let s;return n.subscribe(c=>{(s===void 0||e&&c!==s)&&i(s=c)})}return{notify:r,set:a,subscribe:o}}function Ie(){const{set:t,subscribe:n}=gt(!1);let e;async function r(){clearTimeout(e);try{const a=await fetch(`${se}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==Ae;return i&&(t(!0),clearTimeout(e)),i}catch{return!1}}return{subscribe:n,check:r}}function et(t,n){return t.origin!==B||!t.pathname.startsWith(n)}const Le=-1,Pe=-2,xe=-3,Ue=-4,Te=-5,Ne=-6;function Oe(t,n){if(typeof t=="number")return a(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const e=t,r=Array(e.length);function a(o,i=!1){if(o===Le)return;if(o===xe)return NaN;if(o===Ue)return 1/0;if(o===Te)return-1/0;if(o===Ne)return-0;if(i)throw new Error("Invalid input");if(o in r)return r[o];const s=e[o];if(!s||typeof s!="object")r[o]=s;else if(Array.isArray(s))if(typeof s[0]=="string"){const c=s[0],l=n==null?void 0:n[c];if(l)return r[o]=l(a(s[1]));switch(c){case"Date":r[o]=new Date(s[1]);break;case"Set":const u=new Set;r[o]=u;for(let d=1;d<s.length;d+=1)u.add(a(s[d]));break;case"Map":const h=new Map;r[o]=h;for(let d=1;d<s.length;d+=2)h.set(a(s[d]),a(s[d+1]));break;case"RegExp":r[o]=new RegExp(s[1],s[2]);break;case"Object":r[o]=Object(s[1]);break;case"BigInt":r[o]=BigInt(s[1]);break;case"null":const g=Object.create(null);r[o]=g;for(let d=1;d<s.length;d+=2)g[s[d]]=a(s[d+1]);break;default:throw new Error(`Unknown type ${c}`)}}else{const c=new Array(s.length);r[o]=c;for(let l=0;l<s.length;l+=1){const u=s[l];u!==Pe&&(c[l]=a(u))}}else{const c={};r[o]=c;for(const l in s){const u=s[l];c[l]=a(u)}}return r[o]}return a(0)}const Gt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Gt];const je=new Set([...Gt]);[...je];function $e(t){return t.filter(n=>n!=null)}class nt{constructor(n,e){this.status=n,typeof e=="string"?this.body={message:e}:e?this.body=e:this.body={message:`Error: ${n}`}}toString(){return JSON.stringify(this.body)}}class Ht{constructor(n,e){this.status=n,this.location=e}}class _t extends Error{constructor(n,e,r){super(r),this.status=n,this.text=e}}const De="x-sveltekit-invalidated",Ce="x-sveltekit-trailing-slash";function J(t){return t instanceof nt||t instanceof _t?t.status:500}function Ve(t){return t instanceof _t?t.text:"Internal Error"}const T=jt(Dt)??{},G=jt($t)??{},x={url:Pt({}),page:Pt({}),navigating:gt(null),updated:Ie()};function yt(t){T[t]=mt()}function Fe(t,n){let e=t+1;for(;T[e];)delete T[e],e+=1;for(e=n+1;G[e];)delete G[e],e+=1}function D(t){return location.href=t.href,new Promise(()=>{})}function xt(){}let at,dt,W,L,ht,C;const Mt=[],X=[];let P=null;const Bt=[],qe=[];let j=[],w={branch:[],error:null,url:null},wt=!1,Z=!1,Ut=!0,H=!1,V=!1,Kt=!1,vt=!1,bt,k,A,R,Q;async function Qe(t,n,e){var a,o;document.URL!==location.href&&(location.href=location.href),C=t,at=Se(t),L=document.documentElement,ht=n,dt=t.nodes[0],W=t.nodes[1],dt(),W(),k=(a=history.state)==null?void 0:a[$],A=(o=history.state)==null?void 0:o[q],k||(k=A=Date.now(),history.replaceState({...history.state,[$]:k,[q]:A},""));const r=T[k];r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y)),e?await Je(ht,e):ze(location.href,{replaceState:!0}),Ye()}function Ge(){Mt.length=0,vt=!1}function zt(t){X.some(n=>n==null?void 0:n.snapshot)&&(G[t]=X.map(n=>{var e;return(e=n==null?void 0:n.snapshot)==null?void 0:e.capture()}))}function Yt(t){var n;(n=G[t])==null||n.forEach((e,r)=>{var a,o;(o=(a=X[r])==null?void 0:a.snapshot)==null||o.restore(e)})}function Tt(){yt(k),It(Dt,T),zt(A),It($t,G)}async function Jt(t,n,e,r){return K({type:"goto",url:Vt(t),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:e,nav_token:r,accept:()=>{n.invalidateAll&&(vt=!0)}})}async function He(t){return P={id:t.id,promise:Xt(t).then(n=>(n.type==="loaded"&&n.state.error&&(P=null),n))},P.promise}async function ft(t){const n=at.find(e=>e.exec(Zt(t)));n&&await Promise.all([...n.layouts,n.leaf].map(e=>e==null?void 0:e[1]()))}function Wt(t,n){var a;w=t.state;const e=document.querySelector("style[data-sveltekit]");e&&e.remove(),R=t.props.page,bt=new C.root({target:n,props:{...t.props,stores:x,components:X},hydrate:!0}),Yt(A);const r={from:null,to:{params:w.params,route:{id:((a=w.route)==null?void 0:a.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};j.forEach(o=>o(r)),Z=!0}async function tt({url:t,params:n,branch:e,status:r,error:a,route:o,form:i}){let s="never";if(I&&(t.pathname===I||t.pathname===I+"/"))s="always";else for(const d of e)(d==null?void 0:d.slash)!==void 0&&(s=d.slash);t.pathname=ie(t.pathname,s),t.search=t.search;const c={type:"loaded",state:{url:t,params:n,branch:e,error:a,route:o},props:{constructors:$e(e).map(d=>d.node.component),page:R}};i!==void 0&&(c.props.form=i);let l={},u=!R,h=0;for(let d=0;d<Math.max(e.length,w.branch.length);d+=1){const m=e[d],f=w.branch[d];(m==null?void 0:m.data)!==(f==null?void 0:f.data)&&(u=!0),m&&(l={...l,...m.data},u&&(c.props[`data_${h}`]=l),h+=1)}return(!w.url||t.href!==w.url.href||w.error!==a||i!==void 0&&i!==R.form||u)&&(c.props.page={error:a,params:n,route:{id:(o==null?void 0:o.id)??null},state:{},status:r,url:new URL(t),form:i??null,data:u?l:R.data}),c}async function Et({loader:t,parent:n,url:e,params:r,route:a,server_data_node:o}){var u,h,g;let i=null,s=!0;const c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await t();if((u=l.universal)!=null&&u.load){let d=function(...f){for(const _ of f){const{href:v}=new URL(_,e);c.dependencies.add(v)}};const m={route:new Proxy(a,{get:(f,_)=>(s&&(c.route=!0),f[_])}),params:new Proxy(r,{get:(f,_)=>(s&&c.params.add(_),f[_])}),data:(o==null?void 0:o.data)??null,url:ue(e,()=>{s&&(c.url=!0)},f=>{s&&c.search_params.add(f)}),async fetch(f,_){let v;f instanceof Request?(v=f.url,_={body:f.method==="GET"||f.method==="HEAD"?void 0:await f.blob(),cache:f.cache,credentials:f.credentials,headers:f.headers,integrity:f.integrity,keepalive:f.keepalive,method:f.method,mode:f.mode,redirect:f.redirect,referrer:f.referrer,referrerPolicy:f.referrerPolicy,signal:f.signal,..._}):v=f;const S=new URL(v,e);return s&&d(S.href),S.origin===e.origin&&(v=S.href.slice(e.origin.length)),Z?ye(v,S.href,_):_e(v,_)},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),n()},untrack(f){s=!1;try{return f()}finally{s=!0}}};i=await l.universal.load.call(null,m)??null}return{node:l,loader:t,server:o,universal:(h=l.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(o==null?void 0:o.data)??null,slash:((g=l.universal)==null?void 0:g.trailingSlash)??(o==null?void 0:o.slash)}}function Nt(t,n,e,r,a,o){if(vt)return!0;if(!a)return!1;if(a.parent&&t||a.route&&n||a.url&&e)return!0;for(const i of a.search_params)if(r.has(i))return!0;for(const i of a.params)if(o[i]!==w.params[i])return!0;for(const i of a.dependencies)if(Mt.some(s=>s(new URL(i))))return!0;return!1}function kt(t,n){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?n??null:null}function Me(t,n){if(!t)return new Set(n.searchParams.keys());const e=new Set([...t.searchParams.keys(),...n.searchParams.keys()]);for(const r of e){const a=t.searchParams.getAll(r),o=n.searchParams.getAll(r);a.every(i=>o.includes(i))&&o.every(i=>a.includes(i))&&e.delete(r)}return e}async function Xt({id:t,invalidating:n,url:e,params:r,route:a}){if((P==null?void 0:P.id)===t)return P.promise;const{errors:o,layouts:i,leaf:s}=a,c=[...i,s];o.forEach(p=>p==null?void 0:p().catch(()=>{})),c.forEach(p=>p==null?void 0:p[1]().catch(()=>{}));let l=null;const u=w.url?t!==w.url.pathname+w.url.search:!1,h=w.route?a.id!==w.route.id:!1,g=Me(w.url,e);let d=!1;const m=c.map((p,y)=>{var U;const b=w.branch[y],E=!!(p!=null&&p[0])&&((b==null?void 0:b.loader)!==p[1]||Nt(d,h,u,g,(U=b.server)==null?void 0:U.uses,r));return E&&(d=!0),E});if(m.some(Boolean)){try{l=await ee(e,m)}catch(p){return rt({status:J(p),error:await M(p,{url:e,params:r,route:{id:a.id}}),url:e,route:a})}if(l.type==="redirect")return l}const f=l==null?void 0:l.nodes;let _=!1;const v=c.map(async(p,y)=>{var ot;if(!p)return;const b=w.branch[y],E=f==null?void 0:f[y];if((!E||E.type==="skip")&&p[1]===(b==null?void 0:b.loader)&&!Nt(_,h,u,g,(ot=b.universal)==null?void 0:ot.uses,r))return b;if(_=!0,(E==null?void 0:E.type)==="error")throw E;return Et({loader:p[1],url:e,params:r,route:a,parent:async()=>{var Rt;const At={};for(let st=0;st<y;st+=1)Object.assign(At,(Rt=await v[st])==null?void 0:Rt.data);return At},server_data_node:kt(E===void 0&&p[0]?{type:"skip"}:E??null,p[0]?b==null?void 0:b.server:void 0)})});for(const p of v)p.catch(()=>{});const S=[];for(let p=0;p<c.length;p+=1)if(c[p])try{S.push(await v[p])}catch(y){if(y instanceof Ht)return{type:"redirect",location:y.location};let b=J(y),E;if(f!=null&&f.includes(y))b=y.status??b,E=y.error;else if(y instanceof nt)E=y.body;else{if(await x.updated.check())return await D(e);E=await M(y,{params:r,url:e,route:{id:a.id}})}const U=await Be(p,S,o);return U?await tt({url:e,params:r,branch:S.slice(0,U.idx).concat(U.node),status:b,error:E,route:a}):await te(e,{id:a.id},E,b)}else S.push(void 0);return await tt({url:e,params:r,branch:S,status:200,error:null,route:a,form:n?void 0:null})}async function Be(t,n,e){for(;t--;)if(e[t]){let r=t;for(;!n[r];)r-=1;try{return{idx:r+1,node:{node:await e[t](),loader:e[t],data:{},server:null,universal:null}}}catch{continue}}}async function rt({status:t,error:n,url:e,route:r}){const a={};let o=null;if(C.server_loads[0]===0)try{const l=await ee(e,[!0]);if(l.type!=="data"||l.nodes[0]&&l.nodes[0].type!=="data")throw 0;o=l.nodes[0]??null}catch{(e.origin!==B||e.pathname!==location.pathname||wt)&&await D(e)}const s=await Et({loader:dt,url:e,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:kt(o)}),c={node:await W(),loader:W,universal:null,server:null,data:null};return await tt({url:e,params:a,branch:[s,c],status:t,error:n,route:null})}function St(t,n){if(!t||et(t,I))return;let e;try{e=C.hooks.reroute({url:new URL(t)})??t.pathname}catch{return}const r=Zt(e);for(const a of at){const o=a.exec(r);if(o)return{id:t.pathname+t.search,invalidating:n,route:a,params:le(o),url:t}}}function Zt(t){return ce(t.slice(I.length)||"/")}function Qt({url:t,type:n,intent:e,delta:r}){let a=!1;const o=ae(w,e,t,n);r!==void 0&&(o.navigation.delta=r);const i={...o.navigation,cancel:()=>{a=!0,o.reject(new Error("navigation cancelled"))}};return H||Bt.forEach(s=>s(i)),a?null:o}async function K({type:t,url:n,popped:e,keepfocus:r,noscroll:a,replace_state:o,state:i={},redirect_count:s=0,nav_token:c={},accept:l=xt,block:u=xt}){const h=St(n,!1),g=Qt({url:n,type:t,delta:e==null?void 0:e.delta,intent:h});if(!g){u();return}const d=k,m=A;l(),H=!0,Z&&x.navigating.set(g.navigation),Q=c;let f=h&&await Xt(h);if(!f){if(et(n,I))return await D(n);f=await te(n,{id:null},await M(new _t(404,"Not Found",`Not found: ${n.pathname}`),{url:n,params:{},route:{id:null}}),404)}if(n=(h==null?void 0:h.url)||n,Q!==c)return g.reject(new Error("navigation aborted")),!1;if(f.type==="redirect")if(s>=20)f=await rt({status:500,error:await M(new Error("Redirect loop"),{url:n,params:{},route:{id:null}}),url:n,route:{id:null}});else return Jt(new URL(f.location,n).href,{},s+1,c),!1;else f.props.page.status>=400&&await x.updated.check()&&await D(n);if(Ge(),yt(d),zt(m),f.props.page.url.pathname!==n.pathname&&(n.pathname=f.props.page.url.pathname),i=e?e.state:i,!e){const p=o?0:1,y={[$]:k+=p,[q]:A+=p,[Ct]:i};(o?history.replaceState:history.pushState).call(history,y,"",n),o||Fe(k,A)}if(P=null,f.props.page.state=i,Z){w=f.state,f.props.page&&(f.props.page.url=n);const p=(await Promise.all(qe.map(y=>y(g.navigation)))).filter(y=>typeof y=="function");if(p.length>0){let y=function(){j=j.filter(b=>!p.includes(b))};p.push(y),j.push(...p)}bt.$set(f.props),Kt=!0}else Wt(f,ht);const{activeElement:_}=document;await oe();const v=e?e.scroll:a?mt():null;if(Ut){const p=n.hash&&document.getElementById(decodeURIComponent(n.hash.slice(1)));v?scrollTo(v.x,v.y):p?p.scrollIntoView():scrollTo(0,0)}const S=document.activeElement!==_&&document.activeElement!==document.body;!r&&!S&&We(),Ut=!0,f.props.page&&(R=f.props.page),H=!1,t==="popstate"&&Yt(A),g.fulfil(void 0),j.forEach(p=>p(g.navigation)),x.navigating.set(null)}async function te(t,n,e,r){return t.origin===B&&t.pathname===location.pathname&&!wt?await rt({status:r,error:e,url:t,route:n}):await D(t)}function Ke(){let t;L.addEventListener("mousemove",o=>{const i=o.target;clearTimeout(t),t=setTimeout(()=>{r(i,2)},20)});function n(o){r(o.composedPath()[0],1)}L.addEventListener("mousedown",n),L.addEventListener("touchstart",n,{passive:!0});const e=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&(ft(i.target.href),e.unobserve(i.target))},{threshold:0});function r(o,i){const s=qt(o,L);if(!s)return;const{url:c,external:l,download:u}=ut(s,I);if(l||u)return;const h=Y(s);if(!h.reload)if(i<=h.preload_data){const g=St(c,!1);g&&He(g)}else i<=h.preload_code&&ft(c.pathname)}function a(){e.disconnect();for(const o of L.querySelectorAll("a")){const{url:i,external:s,download:c}=ut(o,I);if(s||c)continue;const l=Y(o);l.reload||(l.preload_code===z.viewport&&e.observe(o),l.preload_code===z.eager&&ft(i.pathname))}}j.push(a),a()}function M(t,n){if(t instanceof nt)return t.body;const e=J(t),r=Ve(t);return C.hooks.handleError({error:t,event:n,status:e,message:r})??{message:r}}function ze(t,n={}){return t=Vt(t),t.origin!==B?Promise.reject(new Error("goto: invalid URL")):Jt(t,n,0)}function Ye(){var n;history.scrollRestoration="manual",addEventListener("beforeunload",e=>{let r=!1;if(Tt(),!H){const a=ae(w,void 0,null,"leave"),o={...a.navigation,cancel:()=>{r=!0,a.reject(new Error("navigation cancelled"))}};Bt.forEach(i=>i(o))}r?(e.preventDefault(),e.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Tt()}),(n=navigator.connection)!=null&&n.saveData||Ke(),L.addEventListener("click",e=>{var g;if(e.button||e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;const r=qt(e.composedPath()[0],L);if(!r)return;const{url:a,external:o,target:i,download:s}=ut(r,I);if(!a)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=Y(r);if(!(r instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||s)return;if(o||c.reload){Qt({url:a,type:"link"})?H=!0:e.preventDefault();return}const[u,h]=a.href.split("#");if(h!==void 0&&u===ct(location)){const[,d]=w.url.href.split("#");if(d===h){e.preventDefault(),h===""||h==="top"&&r.ownerDocument.getElementById("top")===null?window.scrollTo({top:0}):(g=r.ownerDocument.getElementById(h))==null||g.scrollIntoView();return}if(V=!0,yt(k),t(a),!c.replace_state)return;V=!1}e.preventDefault(),K({type:"link",url:a,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??a.href===location.href})}),L.addEventListener("submit",e=>{if(e.defaultPrevented)return;const r=HTMLFormElement.prototype.cloneNode.call(e.target),a=e.submitter;if(((a==null?void 0:a.formMethod)||r.method)!=="get")return;const i=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||r.action);if(et(i,I))return;const s=e.target,c=Y(s);if(c.reload)return;e.preventDefault(),e.stopPropagation();const l=new FormData(s),u=a==null?void 0:a.getAttribute("name");u&&l.append(u,(a==null?void 0:a.getAttribute("value"))??""),i.search=new URLSearchParams(l).toString(),K({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href})}),addEventListener("popstate",async e=>{var r;if((r=e.state)!=null&&r[$]){const a=e.state[$];if(Q={},a===k)return;const o=T[a],i=e.state[Ct]??{},s=new URL(e.state[Re]??location.href),c=e.state[q],l=ct(location)===ct(w.url);if(c===A&&(Kt||l)){t(s),T[k]=mt(),o&&scrollTo(o.x,o.y),i!==R.state&&(R={...R,state:i},bt.$set({page:R})),k=a;return}const h=a-k;await K({type:"popstate",url:s,popped:{state:i,scroll:o,delta:h},accept:()=>{k=a,A=c},block:()=>{history.go(-h)},nav_token:Q})}else if(!V){const a=new URL(location.href);t(a)}}),addEventListener("hashchange",()=>{V&&(V=!1,history.replaceState({...history.state,[$]:++k,[q]:A},"",location.href))});for(const e of document.querySelectorAll("link"))e.rel==="icon"&&(e.href=e.href);addEventListener("pageshow",e=>{e.persisted&&x.navigating.set(null)});function t(e){w.url=e,x.page.set({...R,url:e}),x.page.notify()}}async function Je(t,{status:n=200,error:e,node_ids:r,params:a,route:o,data:i,form:s}){wt=!0;const c=new URL(location.href);({params:a={},route:o={id:null}}=St(c,!1)||{});let l;try{const u=r.map(async(d,m)=>{const f=i[m];return f!=null&&f.uses&&(f.uses=ne(f.uses)),Et({loader:C.nodes[d],url:c,params:a,route:o,parent:async()=>{const _={};for(let v=0;v<m;v+=1)Object.assign(_,(await u[v]).data);return _},server_data_node:kt(f)})}),h=await Promise.all(u),g=at.find(({id:d})=>d===o.id);if(g){const d=g.layouts;for(let m=0;m<d.length;m++)d[m]||h.splice(m,0,void 0)}l=await tt({url:c,params:a,branch:h,status:n,error:e,form:s,route:g??null})}catch(u){if(u instanceof Ht){await D(new URL(u.location,location.href));return}l=await rt({status:J(u),error:await M(u,{url:c,params:a,route:o}),url:c,route:o})}l.props.page&&(l.props.page.state={}),Wt(l,t)}async function ee(t,n){var a;const e=new URL(t);e.pathname=pe(t.pathname),t.pathname.endsWith("/")&&e.searchParams.append(Ce,"1"),e.searchParams.append(De,n.map(o=>o?"1":"0").join(""));const r=await Ot(e.href);if(!r.ok){let o;throw(a=r.headers.get("content-type"))!=null&&a.includes("application/json")?o=await r.json():r.status===404?o="Not Found":r.status===500&&(o="Internal Error"),new nt(r.status,o)}return new Promise(async o=>{var h;const i=new Map,s=r.body.getReader(),c=new TextDecoder;function l(g){return Oe(g,{Promise:d=>new Promise((m,f)=>{i.set(d,{fulfil:m,reject:f})})})}let u="";for(;;){const{done:g,value:d}=await s.read();if(g&&!u)break;for(u+=!d&&u?`
|
|
1
|
+
import{n as it,s as re,x as oe}from"./scheduler.pWaib8rK.js";import{a as se,b as I}from"./paths.CQQiRxnm.js";new URL("sveltekit-internal://");function ie(t,n){return t==="/"||n==="ignore"?t:n==="never"?t.endsWith("/")?t.slice(0,-1):t:n==="always"&&!t.endsWith("/")?t+"/":t}function ce(t){return t.split("%25").map(decodeURI).join("%25")}function le(t){for(const n in t)t[n]=decodeURIComponent(t[n]);return t}function ct({href:t}){return t.split("#")[0]}const fe=["href","pathname","search","toString","toJSON"];function ue(t,n,e){const r=new URL(t);Object.defineProperty(r,"searchParams",{value:new Proxy(r.searchParams,{get(a,o){if(o==="get"||o==="getAll"||o==="has")return s=>(e(s),a[o](s));n();const i=Reflect.get(a,o);return typeof i=="function"?i.bind(a):i}}),enumerable:!0,configurable:!0});for(const a of fe)Object.defineProperty(r,a,{get(){return n(),t[a]},enumerable:!0,configurable:!0});return r}const de="/__data.json",he=".html__data.json";function pe(t){return t.endsWith(".html")?t.replace(/\.html$/,he):t.replace(/\/$/,"")+de}function ge(...t){let n=5381;for(const e of t)if(typeof e=="string"){let r=e.length;for(;r;)n=n*33^e.charCodeAt(--r)}else if(ArrayBuffer.isView(e)){const r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);let a=r.length;for(;a;)n=n*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(n>>>0).toString(36)}function me(t){const n=atob(t),e=new Uint8Array(n.length);for(let r=0;r<n.length;r++)e[r]=n.charCodeAt(r);return e.buffer}const Ot=window.fetch;window.fetch=(t,n)=>((t instanceof Request?t.method:(n==null?void 0:n.method)||"GET")!=="GET"&&F.delete(pt(t)),Ot(t,n));const F=new Map;function _e(t,n){const e=pt(t,n),r=document.querySelector(e);if(r!=null&&r.textContent){let{body:a,...o}=JSON.parse(r.textContent);const i=r.getAttribute("data-ttl");return i&&F.set(e,{body:a,init:o,ttl:1e3*Number(i)}),r.getAttribute("data-b64")!==null&&(a=me(a)),Promise.resolve(new Response(a,o))}return window.fetch(t,n)}function ye(t,n,e){if(F.size>0){const r=pt(t,e),a=F.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(e==null?void 0:e.cache))return new Response(a.body,a.init);F.delete(r)}}return window.fetch(n,e)}function pt(t,n){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(t instanceof Request?t.url:t)}]`;if(n!=null&&n.headers||n!=null&&n.body){const a=[];n.headers&&a.push([...new Headers(n.headers)].join(",")),n.body&&(typeof n.body=="string"||ArrayBuffer.isView(n.body))&&a.push(n.body),r+=`[data-hash="${ge(...a)}"]`}return r}const we=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function ve(t){const n=[];return{pattern:t==="/"?/^\/$/:new RegExp(`^${Ee(t).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return n.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(o)return n.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const i=r.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return lt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return lt(String.fromCharCode(...c.slice(2).split("-").map(f=>parseInt(f,16))));const u=we.exec(c),[,h,g,d,m]=u;return n.push({name:d,matcher:m,optional:!!h,rest:!!g,chained:g?l===1&&i[0]==="":!1}),g?"(.*?)":h?"([^/]*)?":"([^/]+?)"}return lt(c)}).join("")}).join("")}/?$`),params:n}}function be(t){return!/^\([^)]+\)$/.test(t)}function Ee(t){return t.slice(1).split("/").filter(be)}function ke(t,n,e){const r={},a=t.slice(1),o=a.filter(s=>s!==void 0);let i=0;for(let s=0;s<n.length;s+=1){const c=n[s];let l=a[s-i];if(c.chained&&c.rest&&i&&(l=a.slice(s-i,s+1).filter(u=>u).join("/"),i=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||e[c.matcher](l)){r[c.name]=l;const u=n[s+1],h=a[s+1];u&&!u.rest&&u.optional&&h&&c.chained&&(i=0),!u&&!h&&Object.keys(r).length===o.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return r}function lt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Se({nodes:t,server_loads:n,dictionary:e,matchers:r}){const a=new Set(n);return Object.entries(e).map(([s,[c,l,u]])=>{const{pattern:h,params:g}=ve(s),d={id:s,exec:m=>{const f=h.exec(m);if(f)return ke(f,g,r)},errors:[1,...u||[]].map(m=>t[m]),layouts:[0,...l||[]].map(i),leaf:o(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function o(s){const c=s<0;return c&&(s=~s),[c,t[s]]}function i(s){return s===void 0?s:[a.has(s),t[s]]}}function jt(t,n=JSON.parse){try{return n(sessionStorage[t])}catch{}}function It(t,n,e=JSON.stringify){const r=e(n);try{sessionStorage[t]=r}catch{}}const N=[];function gt(t,n=it){let e;const r=new Set;function a(s){if(re(t,s)&&(t=s,e)){const c=!N.length;for(const l of r)l[1](),N.push(l,t);if(c){for(let l=0;l<N.length;l+=2)N[l][0](N[l+1]);N.length=0}}}function o(s){a(s(t))}function i(s,c=it){const l=[s,c];return r.add(l),r.size===1&&(e=n(a,o)||it),s(t),()=>{r.delete(l),r.size===0&&e&&(e(),e=null)}}return{set:a,update:o,subscribe:i}}const Ae="1708725034251",$t="sveltekit:snapshot",Dt="sveltekit:scroll",Ct="sveltekit:states",Re="sveltekit:pageurl",$="sveltekit:history",q="sveltekit:navigation",z={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},B=location.origin;function Vt(t){if(t instanceof URL)return t;let n=document.baseURI;if(!n){const e=document.getElementsByTagName("base");n=e.length?e[0].href:document.URL}return new URL(t,n)}function mt(){return{x:pageXOffset,y:pageYOffset}}function O(t,n){return t.getAttribute(`data-sveltekit-${n}`)}const Lt={...z,"":z.hover};function Ft(t){let n=t.assignedSlot??t.parentNode;return(n==null?void 0:n.nodeType)===11&&(n=n.host),n}function qt(t,n){for(;t&&t!==n;){if(t.nodeName.toUpperCase()==="A"&&t.hasAttribute("href"))return t;t=Ft(t)}}function ut(t,n){let e;try{e=new URL(t instanceof SVGAElement?t.href.baseVal:t.href,document.baseURI)}catch{}const r=t instanceof SVGAElement?t.target.baseVal:t.target,a=!e||!!r||et(e,n)||(t.getAttribute("rel")||"").split(/\s+/).includes("external"),o=(e==null?void 0:e.origin)===B&&t.hasAttribute("download");return{url:e,external:a,target:r,download:o}}function Y(t){let n=null,e=null,r=null,a=null,o=null,i=null,s=t;for(;s&&s!==document.documentElement;)r===null&&(r=O(s,"preload-code")),a===null&&(a=O(s,"preload-data")),n===null&&(n=O(s,"keepfocus")),e===null&&(e=O(s,"noscroll")),o===null&&(o=O(s,"reload")),i===null&&(i=O(s,"replacestate")),s=Ft(s);function c(l){switch(l){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Lt[r??"off"],preload_data:Lt[a??"off"],keepfocus:c(n),noscroll:c(e),reload:c(o),replace_state:c(i)}}function Pt(t){const n=gt(t);let e=!0;function r(){e=!0,n.update(i=>i)}function a(i){e=!1,n.set(i)}function o(i){let s;return n.subscribe(c=>{(s===void 0||e&&c!==s)&&i(s=c)})}return{notify:r,set:a,subscribe:o}}function Ie(){const{set:t,subscribe:n}=gt(!1);let e;async function r(){clearTimeout(e);try{const a=await fetch(`${se}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==Ae;return i&&(t(!0),clearTimeout(e)),i}catch{return!1}}return{subscribe:n,check:r}}function et(t,n){return t.origin!==B||!t.pathname.startsWith(n)}const Le=-1,Pe=-2,xe=-3,Ue=-4,Te=-5,Ne=-6;function Oe(t,n){if(typeof t=="number")return a(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const e=t,r=Array(e.length);function a(o,i=!1){if(o===Le)return;if(o===xe)return NaN;if(o===Ue)return 1/0;if(o===Te)return-1/0;if(o===Ne)return-0;if(i)throw new Error("Invalid input");if(o in r)return r[o];const s=e[o];if(!s||typeof s!="object")r[o]=s;else if(Array.isArray(s))if(typeof s[0]=="string"){const c=s[0],l=n==null?void 0:n[c];if(l)return r[o]=l(a(s[1]));switch(c){case"Date":r[o]=new Date(s[1]);break;case"Set":const u=new Set;r[o]=u;for(let d=1;d<s.length;d+=1)u.add(a(s[d]));break;case"Map":const h=new Map;r[o]=h;for(let d=1;d<s.length;d+=2)h.set(a(s[d]),a(s[d+1]));break;case"RegExp":r[o]=new RegExp(s[1],s[2]);break;case"Object":r[o]=Object(s[1]);break;case"BigInt":r[o]=BigInt(s[1]);break;case"null":const g=Object.create(null);r[o]=g;for(let d=1;d<s.length;d+=2)g[s[d]]=a(s[d+1]);break;default:throw new Error(`Unknown type ${c}`)}}else{const c=new Array(s.length);r[o]=c;for(let l=0;l<s.length;l+=1){const u=s[l];u!==Pe&&(c[l]=a(u))}}else{const c={};r[o]=c;for(const l in s){const u=s[l];c[l]=a(u)}}return r[o]}return a(0)}const Gt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Gt];const je=new Set([...Gt]);[...je];function $e(t){return t.filter(n=>n!=null)}class nt{constructor(n,e){this.status=n,typeof e=="string"?this.body={message:e}:e?this.body=e:this.body={message:`Error: ${n}`}}toString(){return JSON.stringify(this.body)}}class Ht{constructor(n,e){this.status=n,this.location=e}}class _t extends Error{constructor(n,e,r){super(r),this.status=n,this.text=e}}const De="x-sveltekit-invalidated",Ce="x-sveltekit-trailing-slash";function J(t){return t instanceof nt||t instanceof _t?t.status:500}function Ve(t){return t instanceof _t?t.text:"Internal Error"}const T=jt(Dt)??{},G=jt($t)??{},x={url:Pt({}),page:Pt({}),navigating:gt(null),updated:Ie()};function yt(t){T[t]=mt()}function Fe(t,n){let e=t+1;for(;T[e];)delete T[e],e+=1;for(e=n+1;G[e];)delete G[e],e+=1}function D(t){return location.href=t.href,new Promise(()=>{})}function xt(){}let at,dt,W,L,ht,C;const Mt=[],X=[];let P=null;const Bt=[],qe=[];let j=[],w={branch:[],error:null,url:null},wt=!1,Z=!1,Ut=!0,H=!1,V=!1,Kt=!1,vt=!1,bt,k,A,R,Q;async function Qe(t,n,e){var a,o;document.URL!==location.href&&(location.href=location.href),C=t,at=Se(t),L=document.documentElement,ht=n,dt=t.nodes[0],W=t.nodes[1],dt(),W(),k=(a=history.state)==null?void 0:a[$],A=(o=history.state)==null?void 0:o[q],k||(k=A=Date.now(),history.replaceState({...history.state,[$]:k,[q]:A},""));const r=T[k];r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y)),e?await Je(ht,e):ze(location.href,{replaceState:!0}),Ye()}function Ge(){Mt.length=0,vt=!1}function zt(t){X.some(n=>n==null?void 0:n.snapshot)&&(G[t]=X.map(n=>{var e;return(e=n==null?void 0:n.snapshot)==null?void 0:e.capture()}))}function Yt(t){var n;(n=G[t])==null||n.forEach((e,r)=>{var a,o;(o=(a=X[r])==null?void 0:a.snapshot)==null||o.restore(e)})}function Tt(){yt(k),It(Dt,T),zt(A),It($t,G)}async function Jt(t,n,e,r){return K({type:"goto",url:Vt(t),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:e,nav_token:r,accept:()=>{n.invalidateAll&&(vt=!0)}})}async function He(t){return P={id:t.id,promise:Xt(t).then(n=>(n.type==="loaded"&&n.state.error&&(P=null),n))},P.promise}async function ft(t){const n=at.find(e=>e.exec(Zt(t)));n&&await Promise.all([...n.layouts,n.leaf].map(e=>e==null?void 0:e[1]()))}function Wt(t,n){var a;w=t.state;const e=document.querySelector("style[data-sveltekit]");e&&e.remove(),R=t.props.page,bt=new C.root({target:n,props:{...t.props,stores:x,components:X},hydrate:!0}),Yt(A);const r={from:null,to:{params:w.params,route:{id:((a=w.route)==null?void 0:a.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};j.forEach(o=>o(r)),Z=!0}async function tt({url:t,params:n,branch:e,status:r,error:a,route:o,form:i}){let s="never";if(I&&(t.pathname===I||t.pathname===I+"/"))s="always";else for(const d of e)(d==null?void 0:d.slash)!==void 0&&(s=d.slash);t.pathname=ie(t.pathname,s),t.search=t.search;const c={type:"loaded",state:{url:t,params:n,branch:e,error:a,route:o},props:{constructors:$e(e).map(d=>d.node.component),page:R}};i!==void 0&&(c.props.form=i);let l={},u=!R,h=0;for(let d=0;d<Math.max(e.length,w.branch.length);d+=1){const m=e[d],f=w.branch[d];(m==null?void 0:m.data)!==(f==null?void 0:f.data)&&(u=!0),m&&(l={...l,...m.data},u&&(c.props[`data_${h}`]=l),h+=1)}return(!w.url||t.href!==w.url.href||w.error!==a||i!==void 0&&i!==R.form||u)&&(c.props.page={error:a,params:n,route:{id:(o==null?void 0:o.id)??null},state:{},status:r,url:new URL(t),form:i??null,data:u?l:R.data}),c}async function Et({loader:t,parent:n,url:e,params:r,route:a,server_data_node:o}){var u,h,g;let i=null,s=!0;const c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await t();if((u=l.universal)!=null&&u.load){let d=function(...f){for(const _ of f){const{href:v}=new URL(_,e);c.dependencies.add(v)}};const m={route:new Proxy(a,{get:(f,_)=>(s&&(c.route=!0),f[_])}),params:new Proxy(r,{get:(f,_)=>(s&&c.params.add(_),f[_])}),data:(o==null?void 0:o.data)??null,url:ue(e,()=>{s&&(c.url=!0)},f=>{s&&c.search_params.add(f)}),async fetch(f,_){let v;f instanceof Request?(v=f.url,_={body:f.method==="GET"||f.method==="HEAD"?void 0:await f.blob(),cache:f.cache,credentials:f.credentials,headers:f.headers,integrity:f.integrity,keepalive:f.keepalive,method:f.method,mode:f.mode,redirect:f.redirect,referrer:f.referrer,referrerPolicy:f.referrerPolicy,signal:f.signal,..._}):v=f;const S=new URL(v,e);return s&&d(S.href),S.origin===e.origin&&(v=S.href.slice(e.origin.length)),Z?ye(v,S.href,_):_e(v,_)},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),n()},untrack(f){s=!1;try{return f()}finally{s=!0}}};i=await l.universal.load.call(null,m)??null}return{node:l,loader:t,server:o,universal:(h=l.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(o==null?void 0:o.data)??null,slash:((g=l.universal)==null?void 0:g.trailingSlash)??(o==null?void 0:o.slash)}}function Nt(t,n,e,r,a,o){if(vt)return!0;if(!a)return!1;if(a.parent&&t||a.route&&n||a.url&&e)return!0;for(const i of a.search_params)if(r.has(i))return!0;for(const i of a.params)if(o[i]!==w.params[i])return!0;for(const i of a.dependencies)if(Mt.some(s=>s(new URL(i))))return!0;return!1}function kt(t,n){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?n??null:null}function Me(t,n){if(!t)return new Set(n.searchParams.keys());const e=new Set([...t.searchParams.keys(),...n.searchParams.keys()]);for(const r of e){const a=t.searchParams.getAll(r),o=n.searchParams.getAll(r);a.every(i=>o.includes(i))&&o.every(i=>a.includes(i))&&e.delete(r)}return e}async function Xt({id:t,invalidating:n,url:e,params:r,route:a}){if((P==null?void 0:P.id)===t)return P.promise;const{errors:o,layouts:i,leaf:s}=a,c=[...i,s];o.forEach(p=>p==null?void 0:p().catch(()=>{})),c.forEach(p=>p==null?void 0:p[1]().catch(()=>{}));let l=null;const u=w.url?t!==w.url.pathname+w.url.search:!1,h=w.route?a.id!==w.route.id:!1,g=Me(w.url,e);let d=!1;const m=c.map((p,y)=>{var U;const b=w.branch[y],E=!!(p!=null&&p[0])&&((b==null?void 0:b.loader)!==p[1]||Nt(d,h,u,g,(U=b.server)==null?void 0:U.uses,r));return E&&(d=!0),E});if(m.some(Boolean)){try{l=await ee(e,m)}catch(p){return rt({status:J(p),error:await M(p,{url:e,params:r,route:{id:a.id}}),url:e,route:a})}if(l.type==="redirect")return l}const f=l==null?void 0:l.nodes;let _=!1;const v=c.map(async(p,y)=>{var ot;if(!p)return;const b=w.branch[y],E=f==null?void 0:f[y];if((!E||E.type==="skip")&&p[1]===(b==null?void 0:b.loader)&&!Nt(_,h,u,g,(ot=b.universal)==null?void 0:ot.uses,r))return b;if(_=!0,(E==null?void 0:E.type)==="error")throw E;return Et({loader:p[1],url:e,params:r,route:a,parent:async()=>{var Rt;const At={};for(let st=0;st<y;st+=1)Object.assign(At,(Rt=await v[st])==null?void 0:Rt.data);return At},server_data_node:kt(E===void 0&&p[0]?{type:"skip"}:E??null,p[0]?b==null?void 0:b.server:void 0)})});for(const p of v)p.catch(()=>{});const S=[];for(let p=0;p<c.length;p+=1)if(c[p])try{S.push(await v[p])}catch(y){if(y instanceof Ht)return{type:"redirect",location:y.location};let b=J(y),E;if(f!=null&&f.includes(y))b=y.status??b,E=y.error;else if(y instanceof nt)E=y.body;else{if(await x.updated.check())return await D(e);E=await M(y,{params:r,url:e,route:{id:a.id}})}const U=await Be(p,S,o);return U?await tt({url:e,params:r,branch:S.slice(0,U.idx).concat(U.node),status:b,error:E,route:a}):await te(e,{id:a.id},E,b)}else S.push(void 0);return await tt({url:e,params:r,branch:S,status:200,error:null,route:a,form:n?void 0:null})}async function Be(t,n,e){for(;t--;)if(e[t]){let r=t;for(;!n[r];)r-=1;try{return{idx:r+1,node:{node:await e[t](),loader:e[t],data:{},server:null,universal:null}}}catch{continue}}}async function rt({status:t,error:n,url:e,route:r}){const a={};let o=null;if(C.server_loads[0]===0)try{const l=await ee(e,[!0]);if(l.type!=="data"||l.nodes[0]&&l.nodes[0].type!=="data")throw 0;o=l.nodes[0]??null}catch{(e.origin!==B||e.pathname!==location.pathname||wt)&&await D(e)}const s=await Et({loader:dt,url:e,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:kt(o)}),c={node:await W(),loader:W,universal:null,server:null,data:null};return await tt({url:e,params:a,branch:[s,c],status:t,error:n,route:null})}function St(t,n){if(!t||et(t,I))return;let e;try{e=C.hooks.reroute({url:new URL(t)})??t.pathname}catch{return}const r=Zt(e);for(const a of at){const o=a.exec(r);if(o)return{id:t.pathname+t.search,invalidating:n,route:a,params:le(o),url:t}}}function Zt(t){return ce(t.slice(I.length)||"/")}function Qt({url:t,type:n,intent:e,delta:r}){let a=!1;const o=ae(w,e,t,n);r!==void 0&&(o.navigation.delta=r);const i={...o.navigation,cancel:()=>{a=!0,o.reject(new Error("navigation cancelled"))}};return H||Bt.forEach(s=>s(i)),a?null:o}async function K({type:t,url:n,popped:e,keepfocus:r,noscroll:a,replace_state:o,state:i={},redirect_count:s=0,nav_token:c={},accept:l=xt,block:u=xt}){const h=St(n,!1),g=Qt({url:n,type:t,delta:e==null?void 0:e.delta,intent:h});if(!g){u();return}const d=k,m=A;l(),H=!0,Z&&x.navigating.set(g.navigation),Q=c;let f=h&&await Xt(h);if(!f){if(et(n,I))return await D(n);f=await te(n,{id:null},await M(new _t(404,"Not Found",`Not found: ${n.pathname}`),{url:n,params:{},route:{id:null}}),404)}if(n=(h==null?void 0:h.url)||n,Q!==c)return g.reject(new Error("navigation aborted")),!1;if(f.type==="redirect")if(s>=20)f=await rt({status:500,error:await M(new Error("Redirect loop"),{url:n,params:{},route:{id:null}}),url:n,route:{id:null}});else return Jt(new URL(f.location,n).href,{},s+1,c),!1;else f.props.page.status>=400&&await x.updated.check()&&await D(n);if(Ge(),yt(d),zt(m),f.props.page.url.pathname!==n.pathname&&(n.pathname=f.props.page.url.pathname),i=e?e.state:i,!e){const p=o?0:1,y={[$]:k+=p,[q]:A+=p,[Ct]:i};(o?history.replaceState:history.pushState).call(history,y,"",n),o||Fe(k,A)}if(P=null,f.props.page.state=i,Z){w=f.state,f.props.page&&(f.props.page.url=n);const p=(await Promise.all(qe.map(y=>y(g.navigation)))).filter(y=>typeof y=="function");if(p.length>0){let y=function(){j=j.filter(b=>!p.includes(b))};p.push(y),j.push(...p)}bt.$set(f.props),Kt=!0}else Wt(f,ht);const{activeElement:_}=document;await oe();const v=e?e.scroll:a?mt():null;if(Ut){const p=n.hash&&document.getElementById(decodeURIComponent(n.hash.slice(1)));v?scrollTo(v.x,v.y):p?p.scrollIntoView():scrollTo(0,0)}const S=document.activeElement!==_&&document.activeElement!==document.body;!r&&!S&&We(),Ut=!0,f.props.page&&(R=f.props.page),H=!1,t==="popstate"&&Yt(A),g.fulfil(void 0),j.forEach(p=>p(g.navigation)),x.navigating.set(null)}async function te(t,n,e,r){return t.origin===B&&t.pathname===location.pathname&&!wt?await rt({status:r,error:e,url:t,route:n}):await D(t)}function Ke(){let t;L.addEventListener("mousemove",o=>{const i=o.target;clearTimeout(t),t=setTimeout(()=>{r(i,2)},20)});function n(o){r(o.composedPath()[0],1)}L.addEventListener("mousedown",n),L.addEventListener("touchstart",n,{passive:!0});const e=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&(ft(i.target.href),e.unobserve(i.target))},{threshold:0});function r(o,i){const s=qt(o,L);if(!s)return;const{url:c,external:l,download:u}=ut(s,I);if(l||u)return;const h=Y(s);if(!h.reload)if(i<=h.preload_data){const g=St(c,!1);g&&He(g)}else i<=h.preload_code&&ft(c.pathname)}function a(){e.disconnect();for(const o of L.querySelectorAll("a")){const{url:i,external:s,download:c}=ut(o,I);if(s||c)continue;const l=Y(o);l.reload||(l.preload_code===z.viewport&&e.observe(o),l.preload_code===z.eager&&ft(i.pathname))}}j.push(a),a()}function M(t,n){if(t instanceof nt)return t.body;const e=J(t),r=Ve(t);return C.hooks.handleError({error:t,event:n,status:e,message:r})??{message:r}}function ze(t,n={}){return t=Vt(t),t.origin!==B?Promise.reject(new Error("goto: invalid URL")):Jt(t,n,0)}function Ye(){var n;history.scrollRestoration="manual",addEventListener("beforeunload",e=>{let r=!1;if(Tt(),!H){const a=ae(w,void 0,null,"leave"),o={...a.navigation,cancel:()=>{r=!0,a.reject(new Error("navigation cancelled"))}};Bt.forEach(i=>i(o))}r?(e.preventDefault(),e.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Tt()}),(n=navigator.connection)!=null&&n.saveData||Ke(),L.addEventListener("click",e=>{var g;if(e.button||e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;const r=qt(e.composedPath()[0],L);if(!r)return;const{url:a,external:o,target:i,download:s}=ut(r,I);if(!a)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=Y(r);if(!(r instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||s)return;if(o||c.reload){Qt({url:a,type:"link"})?H=!0:e.preventDefault();return}const[u,h]=a.href.split("#");if(h!==void 0&&u===ct(location)){const[,d]=w.url.href.split("#");if(d===h){e.preventDefault(),h===""||h==="top"&&r.ownerDocument.getElementById("top")===null?window.scrollTo({top:0}):(g=r.ownerDocument.getElementById(h))==null||g.scrollIntoView();return}if(V=!0,yt(k),t(a),!c.replace_state)return;V=!1}e.preventDefault(),K({type:"link",url:a,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??a.href===location.href})}),L.addEventListener("submit",e=>{if(e.defaultPrevented)return;const r=HTMLFormElement.prototype.cloneNode.call(e.target),a=e.submitter;if(((a==null?void 0:a.formMethod)||r.method)!=="get")return;const i=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||r.action);if(et(i,I))return;const s=e.target,c=Y(s);if(c.reload)return;e.preventDefault(),e.stopPropagation();const l=new FormData(s),u=a==null?void 0:a.getAttribute("name");u&&l.append(u,(a==null?void 0:a.getAttribute("value"))??""),i.search=new URLSearchParams(l).toString(),K({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href})}),addEventListener("popstate",async e=>{var r;if((r=e.state)!=null&&r[$]){const a=e.state[$];if(Q={},a===k)return;const o=T[a],i=e.state[Ct]??{},s=new URL(e.state[Re]??location.href),c=e.state[q],l=ct(location)===ct(w.url);if(c===A&&(Kt||l)){t(s),T[k]=mt(),o&&scrollTo(o.x,o.y),i!==R.state&&(R={...R,state:i},bt.$set({page:R})),k=a;return}const h=a-k;await K({type:"popstate",url:s,popped:{state:i,scroll:o,delta:h},accept:()=>{k=a,A=c},block:()=>{history.go(-h)},nav_token:Q})}else if(!V){const a=new URL(location.href);t(a)}}),addEventListener("hashchange",()=>{V&&(V=!1,history.replaceState({...history.state,[$]:++k,[q]:A},"",location.href))});for(const e of document.querySelectorAll("link"))e.rel==="icon"&&(e.href=e.href);addEventListener("pageshow",e=>{e.persisted&&x.navigating.set(null)});function t(e){w.url=e,x.page.set({...R,url:e}),x.page.notify()}}async function Je(t,{status:n=200,error:e,node_ids:r,params:a,route:o,data:i,form:s}){wt=!0;const c=new URL(location.href);({params:a={},route:o={id:null}}=St(c,!1)||{});let l;try{const u=r.map(async(d,m)=>{const f=i[m];return f!=null&&f.uses&&(f.uses=ne(f.uses)),Et({loader:C.nodes[d],url:c,params:a,route:o,parent:async()=>{const _={};for(let v=0;v<m;v+=1)Object.assign(_,(await u[v]).data);return _},server_data_node:kt(f)})}),h=await Promise.all(u),g=at.find(({id:d})=>d===o.id);if(g){const d=g.layouts;for(let m=0;m<d.length;m++)d[m]||h.splice(m,0,void 0)}l=await tt({url:c,params:a,branch:h,status:n,error:e,form:s,route:g??null})}catch(u){if(u instanceof Ht){await D(new URL(u.location,location.href));return}l=await rt({status:J(u),error:await M(u,{url:c,params:a,route:o}),url:c,route:o})}l.props.page&&(l.props.page.state={}),Wt(l,t)}async function ee(t,n){var a;const e=new URL(t);e.pathname=pe(t.pathname),t.pathname.endsWith("/")&&e.searchParams.append(Ce,"1"),e.searchParams.append(De,n.map(o=>o?"1":"0").join(""));const r=await Ot(e.href);if(!r.ok){let o;throw(a=r.headers.get("content-type"))!=null&&a.includes("application/json")?o=await r.json():r.status===404?o="Not Found":r.status===500&&(o="Internal Error"),new nt(r.status,o)}return new Promise(async o=>{var h;const i=new Map,s=r.body.getReader(),c=new TextDecoder;function l(g){return Oe(g,{Promise:d=>new Promise((m,f)=>{i.set(d,{fulfil:m,reject:f})})})}let u="";for(;;){const{done:g,value:d}=await s.read();if(g&&!u)break;for(u+=!d&&u?`
|
|
2
2
|
`:c.decode(d,{stream:!0});;){const m=u.indexOf(`
|
|
3
3
|
`);if(m===-1)break;const f=JSON.parse(u.slice(0,m));if(u=u.slice(m+1),f.type==="redirect")return o(f);if(f.type==="data")(h=f.nodes)==null||h.forEach(_=>{(_==null?void 0:_.type)==="data"&&(_.uses=ne(_.uses),_.data=l(_.data))}),o(f);else if(f.type==="chunk"){const{id:_,data:v,error:S}=f,p=i.get(_);i.delete(_),S?p.reject(l(S)):p.fulfil(l(v))}}}})}function ne(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url),search_params:new Set((t==null?void 0:t.search_params)??[])}}function We(){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const n=document.body,e=n.getAttribute("tabindex");n.tabIndex=-1,n.focus({preventScroll:!0,focusVisible:!1}),e!==null?n.setAttribute("tabindex",e):n.removeAttribute("tabindex");const r=getSelection();if(r&&r.type!=="None"){const a=[];for(let o=0;o<r.rangeCount;o+=1)a.push(r.getRangeAt(o));setTimeout(()=>{if(r.rangeCount===a.length){for(let o=0;o<r.rangeCount;o+=1){const i=a[o],s=r.getRangeAt(o);if(i.commonAncestorContainer!==s.commonAncestorContainer||i.startContainer!==s.startContainer||i.endContainer!==s.endContainer||i.startOffset!==s.startOffset||i.endOffset!==s.endOffset)return}r.removeAllRanges()}})}}}function ae(t,n,e,r){var c,l;let a,o;const i=new Promise((u,h)=>{a=u,o=h});return i.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((c=t.route)==null?void 0:c.id)??null},url:t.url},to:e&&{params:(n==null?void 0:n.params)??null,route:{id:((l=n==null?void 0:n.route)==null?void 0:l.id)??null},url:e},willUnload:!n,type:r,complete:i},fulfil:a,reject:o}}export{nt as H,Qe as a,ze as g,x as s,gt as w};
|
|
@@ -45,8 +45,8 @@ ${Le(r)}
|
|
|
45
45
|
ENDSEC
|
|
46
46
|
0
|
|
47
47
|
EOF
|
|
48
|
-
`}stringify(){return this.close(),this.dxfStr}};function $c(){return new Dc}function Oc(e,n,t){return{circle:!0,cx:e,cy:n,radius:t}}var Rc=class{constructor(){I(this,"seg");this.seg=[]}addStart(e,n){this.seg=[];const t={typ:0,px:e,py:n};this.seg.push(t)}addStroke(e,n){const t={typ:1,px:e,py:n};this.seg.push(t)}addArc(e,n,t,s,r){const i={typ:2,px:e,py:n,radius:t,large:s,ccw:r};this.seg.push(i)}toJson(){return{circle:!1,seg:this.seg}}};function Nc(){return new Rc}var wi=class{},Fc=class ht extends wi{constructor(t,s,r=""){super();I(this,"circle",!1);I(this,"segments");I(this,"points");I(this,"debugPoints");I(this,"debugLines");I(this,"lastPoint");I(this,"imposedColor");this.segments=[new Be(6,t,s,0)],this.points=[],this.debugPoints=[],this.debugLines=[],this.lastPoint=V(t,s),this.imposedColor=r}setLastPoint(t,s){this.lastPoint=V(t,s)}getLastPoint(){return this.lastPoint}addPointA(t,s){if(this.points.length>2)throw`err311: contour add too much point ${t} ${s}`;return this.points.push(V(t,s)),this}addPointAP(t,s){const r=V(0,0).translatePolar(t,s);return this.addPointA(r.cx,r.cy),this}addPointR(t,s){const i=this.getLastPoint().translate(t,s);return this.addPointA(i.cx,i.cy),this}addPointRP(t,s){const i=this.getLastPoint().translatePolar(t,s);return this.addPointA(i.cx,i.cy),this}addSeg(t){return this.segments.push(t),this}addSegStroke(){if(this.points.length!==1)throw`err554: contour addSegStroke with unexpected points.length ${this.points.length}`;const t=this.points.pop();if(t!==void 0){const s=new Be(0,t.cx,t.cy,0);t.isEqual(this.getLastPoint())||(this.addSeg(s),this.setLastPoint(t.cx,t.cy))}else throw"err284: contour p1 is undefined";return this}addSegStrokeA(t,s){return this.addPointA(t,s).addSegStroke(),this}addSegStrokeAP(t,s){return this.addPointAP(t,s).addSegStroke(),this}addSegStrokeR(t,s){return this.addPointR(t,s).addSegStroke(),this}addSegStrokeRP(t,s){return this.addPointRP(t,s).addSegStroke(),this}addSegArc(t,s,r){if(this.points.length!==1)throw`err954: contour addSegArc with unexpected points.length ${this.points.length}`;const i=this.points.pop();if(i!==void 0){const o=new Be(1,i.cx,i.cy,t,s,r);i.isEqual(this.getLastPoint())?console.log(`warn144: addSegArc last and new point identical ${Ge(i.cx)} ${Ge(i.cy)}`):(this.addSeg(o),this.setLastPoint(i.cx,i.cy))}else throw"err482: contour p1 is undefined";return this}addSegArc2(){if(this.points.length!==2)throw`err958: contour addSegArc2 with unexpected points.length ${this.points.length}`;const t=this.points.pop(),s=this.points.pop();if(s!==void 0&&t!==void 0){const r=this.getLastPoint(),i=xc(r,s,t),o=i.distanceToPoint(r),c=r.middlePoint(t),a=c.angleToPoint(r),f=c.angleToPoint(s),l=c.angleToPoint(i),p=ne(f-a),m=ne(l-a);let x=!1,_=!1;Math.sign(m)*Math.sign(p)>0&&(x=!0),Math.sign(p)>0&&(_=!0),this.addPointA(t.cx,t.cy).addSegArc(o,x,_),this.debugPoints.push(s)}else throw"err488: contour p1 or p2 or seg is undefined";return this}addSegArc3(t,s){if(this.points.length!==1)throw`err914: contour addSegArc3 with unexpected points.length ${this.points.length}`;const r=this.points.pop();if(r!==void 0){const i=this.getLastPoint(),o=ns(i,r);let c=r;s&&(c=i);const a=vn(c.cx,c.cy,t+Math.PI/2),f=o.intersection(a),l=f.distanceToPoint(i),p=i.middlePoint(r),m=c.angleToPoint(p),x=ne(t-m);let _=!1;Math.abs(x)>Math.PI/2&&(_=!0);let d=!1;x<0&&(d=!0),s||(d=!d),this.addPointA(r.cx,r.cy).addSegArc(l,_,d),this.debugPoints.push(p),this.debugPoints.push(f)}else throw"err282: contour p1 is undefined";return this}addSeg2Arcs(t,s){if(this.points.length!==1)throw`err214: contour addSeg2Arcs with unexpected points.length ${this.points.length}`;const r=this.points.pop();if(r!==void 0){const i=this.getLastPoint(),o=i.distanceToPoint(r),c=i.angleToPoint(r),a=r.angleToPoint(i),f=ne(t-c),l=-1*ne(s-a);if(Math.abs(f)>=Math.PI/2)throw`err545: addSeg2Arcs with too large au ${f}`;if(Math.abs(l)>=Math.PI/2)throw`err546: addSeg2Arcs with too large av ${l}`;if(J(f)===0)throw`err765: addSeg2Arcs with almost zero au ${f}`;if(J(l)===0)throw`err766: addSeg2Arcs with almost zero av ${l}`;if(Math.sign(f)*Math.sign(l)<1)throw`err767: addSeg2Arcs with au/av bad orientation ${f} ${l}`;const p=Math.tan(f/2),m=Math.tan(l/2),x=o*m/(m+p),_=Math.abs(x/Math.sin(f)),d=x/Math.cos(f/2),u=o*p/(m+p),h=Math.abs(u/Math.sin(l)),g=i.translatePolar(c+f/2,d);let w=!1;Math.sign(f)<0&&(w=!0),this.addPointA(g.cx,g.cy).addSegArc(_,!1,w),this.addPointA(r.cx,r.cy).addSegArc(h,!1,w),this.debugPoints.push(i.translatePolar(c,x)),this.debugPoints.push(i.translatePolar(c+f-Math.sign(f)*Math.PI/2,_)),this.debugPoints.push(r.translatePolar(a-l+Math.sign(f)*Math.PI/2,h))}else throw"err182: contour p1 is undefined";return this}addCornerPointed(){const t=new Be(2,0,0,0);return this.addSeg(t),this}addCornerRounded(t){const s=new Be(3,0,0,t);return this.addSeg(s),this}addCornerWidened(t){const s=new Be(4,0,0,t);return this.addSeg(s),this}addCornerWideAcc(t){const s=new Be(5,0,0,t);return this.addSeg(s),this}closeSegStroke(){const t=this.segments[0].px,s=this.segments[0].py;return this.addSegStrokeA(t,s),this}closeSegArc(t,s,r){const i=this.segments[0].px,o=this.segments[0].py;return this.addPointA(i,o).addSegArc(t,s,r),this}clone(){const t=new ht(this.segments[0].px,this.segments[0].py);for(const s of this.segments){const r=s.clone();r.sType!==6&&(t.addSeg(r),Fe(r.sType)&&t.setLastPoint(r.px,r.py))}return t}translate(t,s){const r=this.segments[0].px+t,i=this.segments[0].py+s,o=new ht(r,i);for(const c of this.segments){const a=c.clone();Fe(c.sType)&&(a.px+=t,a.py+=s),a.sType!==6&&(o.addSeg(a),Fe(a.sType)&&o.setLastPoint(a.px,a.py))}return o}translatePolar(t,s){return this.translate(s*Math.cos(t),s*Math.sin(t))}rotate(t,s,r){const i=V(t,s),c=V(this.segments[0].px,this.segments[0].py).rotate(i,r),a=new ht(c.cx,c.cy);for(const f of this.segments){const l=f.clone();if(Fe(f.sType)){const m=V(l.px,l.py).rotate(i,r);l.px=m.cx,l.py=m.cy}l.sType!==6&&(a.addSeg(l),Fe(l.sType)&&a.setLastPoint(l.px,l.py))}return a}scale(t,s,r,i=!1){const o=V(t,s),a=V(this.segments[0].px,this.segments[0].py).scale(o,r),f=new ht(a.cx,a.cy);for(const l of this.segments){const p=l.clone();if(Fe(l.sType)){const x=V(p.px,p.py).scale(o,r);p.px=x.cx,p.py=x.cy}l.sType===1&&(p.radius*=r),fn(l.sType)&&i&&(p.radius*=r),p.sType!==6&&(f.addSeg(p),Fe(p.sType)&&f.setLastPoint(p.px,p.py))}return f}addPartial(t){if(this.points.length>0)throw`err911: addPartial, points should be used ${this.points.length}`;let s=t;if(t.segments.length>0){const r=t.segments[0],i=this.getLastPoint(),o=r.px-i.cx,c=r.py-i.cy;r.sType===6&&(s=t.translate(-o,-c))}for(const r of s.segments)r.sType!==6&&(this.addSeg(r),Fe(r.sType)&&this.setLastPoint(r.px,r.py));return this}draw(t,s,r=ie.contour){const i=this.imposedColor===""?r:this.imposedColor;let o=0,c=0;for(const a of this.segments){if(a.sType===0){const[f,l]=gt(o,c,s),[p,m]=gt(a.px,a.py,s);t.beginPath(),t.moveTo(f,l),t.lineTo(p,m),t.strokeStyle=i,t.stroke()}if(a.sType===1)try{const f=xt(o,c,a),[l,p]=gt(f.pc.cx,f.pc.cy,s),m=hi(a.radius,s);t.beginPath(),t.arc(l,p,m,-f.a1,-f.a2,a.arcCcw),t.strokeStyle=i,t.stroke()}catch(f){console.log("err413: "+f)}Rt(a.sType)&&(o=a.px,c=a.py)}}extractSkeleton(){const t=this.segments[0],s=new ht(t.px,t.py);for(const r of this.segments)Fe(r.sType)&&s.addSeg(r);return s}generateContour(){lt.clearPoints(),lt.clearLines();const t=[],s=[];let r=0,i=0,o=0;for(const l of this.segments){if(l.sType===0){const x=V(i,o),_=V(l.px,l.py),d=V(0,0);t.push(new $e(l.sType,x,_,d,0,0,0,!1)),r=1}if(l.sType===1){const x=xt(i,o,l);t.push(x),r=1}const p=t.at(-1),m=t.at(-2);if(p!==void 0&&m!==void 0&&Fe(p.sType)&&Bn(m.sType)){const x=t.pop(),_=t.pop(),d=t.pop();if(d!==void 0&&_!==void 0&&x!==void 0){const u=gr(d,_,x);t.push(...u)}else throw"err603: contour generateContour internal error"}if(Bn(l.sType)){if(r===2)throw`err419: generateContour with two consecutive corners ${l.sType}`;if(r===0&&fn(l.sType)&&l.radius>0){const x=V(0,0);s.push(new $e(l.sType,x,x,x,l.radius,0,0,!1))}if(r===1&&fn(l.sType)&&l.radius>0){const x=V(0,0);t.push(new $e(l.sType,x,x,x,l.radius,0,0,!1))}r=2}Rt(l.sType)&&(i=l.px,o=l.py)}if(s.length>0)if(r===1)t.push(...s);else throw"err397: contour generateContour Corners defined at end and begining";const c=t.at(-1);if(c!==void 0&&Bn(c.sType)){const l=t[0],p=t.pop(),m=t.pop();if(m!==void 0&&p!==void 0&&l!==void 0){const x=gr(m,p,l);t.push(...x.slice(0,-1));const _=x.at(-1);if(_!==void 0)t[0]=_;else throw"err606: contour generateContour internal error"}else throw"err602: contour generateContour internal error"}const a=t[0],f=new ht(a.p1.cx,a.p1.cy,this.imposedColor);f.debugPoints.push(...lt.getPoints()),f.debugLines.push(...lt.getLines());for(const l of t)if(l.sType===0)f.addSegStrokeA(l.p2.cx,l.p2.cy);else if(l.sType===1){const p=wc(l);f.addPointA(l.p2.cx,l.p2.cy).addSegArc(p.radius,p.arcLarge,p.arcCcw)}else throw`err986: contour generateContour unexpected in seg2 Enum ${l.sType}`;return f}generatePoints(){const t=[];t.push(...this.debugPoints);const s=this.segments[0];t.push(V(s.px,s.py));let r=0,i=0;for(const o of this.segments){if(o.sType===1)try{const c=xt(r,i,o),a=V(c.pc.cx,c.pc.cy),f=ne((c.a2-c.a1)/2);let l=c.a1+f;(Math.sign(f)>0&&!o.arcCcw||Math.sign(f)<0&&o.arcCcw)&&(l+=Math.PI);const p=a.translatePolar(l,o.radius);t.push(p)}catch(c){console.log("err453: "+c)}Rt(o.sType)&&(r=o.px,i=o.py,t.push(V(r,i)))}return t}generateLines(){const t=[];return t.push(...this.debugLines),t}checkContour(t){if(t.segments[0].sType!==6)throw`err412: contour check first seg is not eStart ${t.segments[0].sType}`;let s=0,r=0;for(const c of t.segments){if(c.sType===1)try{xt(s,r,c)}catch(a){throw`err778: ${a}`}Rt(c.sType)&&(s=c.px,r=c.py)}const i=t.segments[0].px,o=t.segments[0].py;if(J(s-i)!==0||J(r-o)!==0)throw`err414: contour check, contour is not closed px ${i} ${s} py ${i} ${o}`}check(){lt.clearMsg(),this.checkContour(this);const t=this.generateContour();return this.checkContour(t),lt.getMsg()}toSvg(t,s=""){const r=Pc();for(const o of this.segments)o.sType===6?r.addStart(o.px,t-o.py):o.sType===0?r.addStroke(o.px,t-o.py):o.sType===1?r.addArc(o.px,t-o.py,o.radius,o.arcLarge,!o.arcCcw):console.log(`err631: contour.toSvg has unknown segment type ${o.sType}`);return r.stringify(s)}toDxfSeg(){const t=[];let s=0,r=0;for(const i of this.segments){if(i.sType===0)t.push(Mc(s,r,i.px,i.py));else if(i.sType===1)try{const o=xt(s,r,i);t.push(Lc(o.pc.cx,o.pc.cy,i.radius,o.a1,o.a2,o.arcCcw))}catch(o){console.log("err413: "+o)}Rt(i.sType)&&(s=i.px,r=i.py)}return t}toPax(){const t=Nc();for(const r of this.segments)r.sType===6?t.addStart(r.px,r.py):r.sType===0?t.addStroke(r.px,r.py):r.sType===1?t.addArc(r.px,r.py,r.radius,r.arcLarge,r.arcCcw):console.log(`err709: contour.toPax has unknown segment type ${r.sType}`);return t.toJson()}},Uc=class Tt extends wi{constructor(t,s,r,i=""){super();I(this,"circle",!0);I(this,"px");I(this,"py");I(this,"radius");I(this,"imposedColor");this.px=t,this.py=s,this.radius=r,this.imposedColor=i}clone(){return new Tt(this.px,this.py,this.radius,this.imposedColor)}translate(t,s){return new Tt(this.px+t,this.py+s,this.radius,this.imposedColor)}translatePolar(t,s){return this.translate(s*Math.cos(t),s*Math.sin(t))}rotate(t,s,r){const i=V(t,s),o=V(this.px,this.py).rotate(i,r);return new Tt(o.cx,o.cy,this.radius,this.imposedColor)}draw(t,s,r=ie.contour){const[i,o]=gt(this.px,this.py,s),c=hi(this.radius,s),a=this.imposedColor===""?r:this.imposedColor;t.beginPath(),t.arc(i,o,c,0,2*Math.PI,!0),t.strokeStyle=a,t.stroke()}extractSkeleton(){return new Tt(this.px,this.py,this.radius)}generateContour(){return new Tt(this.px,this.py,this.radius,this.imposedColor)}generatePoints(){const t=[],s=V(this.px,this.py);t.push(s);for(let r=0;r<4;r++){const i=s.translatePolar(r*Math.PI/2,this.radius);t.push(i)}return t}generateLines(){return[]}check(){return""}toSvg(t,s=""){return Tc(this.px,t-this.py,this.radius,s)}toDxfSeg(){const t=[];return t.push(Ic(this.px,this.py,this.radius)),t}toPax(){return Oc(this.px,this.py,this.radius)}};function vl(e,n,t=""){return new Fc(e,n,t)}function Sl(e,n,t,s=""){return new Uc(e,n,t,s)}var qc=class ss{constructor(){I(this,"pointList");I(this,"lineList");I(this,"vectorList");I(this,"mainList");I(this,"mainBList");I(this,"secondList");I(this,"secondBList");I(this,"dynamicsList");I(this,"xMin");I(this,"xMax");I(this,"yMin");I(this,"yMax");this.pointList=[],this.lineList=[],this.vectorList=[],this.mainList=[],this.mainBList=[],this.secondList=[],this.secondBList=[],this.dynamicsList=[],this.xMin=0,this.xMax=0,this.yMin=0,this.yMax=0}addPoint(n){this.pointList.push(n)}addPoints(n){this.pointList.push(...n)}addLine(n){this.lineList.push(n)}addLines(n){for(const t of n)this.lineList.push(t)}addVector(n){this.vectorList.push(n)}addMain(n){const t=n.generateContour();this.addPoints(t.generatePoints()),this.addLines(t.generateLines()),this.mainList.push(t),this.mainBList.push(n.extractSkeleton())}addSecond(n){const t=n.generateContour();this.addPoints(t.generatePoints()),this.addLines(t.generateLines()),this.secondList.push(t),this.secondBList.push(n.extractSkeleton())}addDynamics(n){this.addPoints(n.generatePoints()),this.addLines(n.generateLines()),this.dynamicsList.push(n)}translate(n,t){const s=new ss;for(const r of this.pointList)s.addPoint(r.translate(n,t));for(const r of this.lineList)s.addLine(r.translate(n,t));for(const r of this.vectorList)s.addVector(r.translate(n,t));for(const r of this.mainList)s.addMain(r.translate(n,t));for(const r of this.secondList)s.addSecond(r.translate(n,t));for(const r of this.dynamicsList)s.addDynamics(r.translate(n,t));return s}translatePolar(n,t){return this.translate(t*Math.cos(n),t*Math.sin(n))}rotate(n,t,s){const r=new ss,i=V(n,t);for(const o of this.pointList)r.addPoint(o.rotate(i,s));for(const o of this.lineList)r.addLine(o.rotate(i,s));for(const o of this.vectorList)r.addVector(o.rotate(i,s));for(const o of this.mainList)r.addMain(o.rotate(n,t,s));for(const o of this.secondList)r.addSecond(o.rotate(n,t,s));for(const o of this.dynamicsList)r.addDynamics(o.rotate(n,t,s));return r}mergeFigure(n,t=!1){for(const s of n.pointList)this.addPoint(s.clone());for(const s of n.lineList)this.addLine(s.clone());for(const s of n.vectorList)this.addVector(s.clone());for(const s of n.mainList)t?this.addSecond(s.clone()):this.addMain(s.clone());for(const s of n.secondList)this.addSecond(s.clone());for(const s of n.dynamicsList)this.addDynamics(s.clone())}clear(){this.pointList=[],this.lineList=[],this.vectorList=[],this.mainList=[],this.mainBList=[],this.secondList=[],this.secondBList=[],this.dynamicsList=[]}getMinMax(){[this.xMin,this.xMax,this.yMin,this.yMax]=mi(this.pointList)}getAdjustFull(n,t){let s=es();return this.pointList.length>0&&(this.getMinMax(),s=ts(this.xMin,this.xMax,this.yMin,this.yMax,n,t)),s}getAdjustZoom(n,t){let s=es();if(this.pointList.length>0){this.getMinMax();const r=(this.xMin+this.xMax)/2,i=(this.yMin+this.yMax)/2;s=ts(r,this.xMax,i,this.yMax,n,t)}return s}quantifyRuler(n,t){const r=n/10/t.scaleX;let i=1e-4;for(;i<r;)i*=10;i/5>r?i/=5:i/2>r&&(i/=2);const o=i*t.scaleX;return[i,o]}drawRuler(n,t,s){const[r,i]=this.quantifyRuler(n.canvas.width,t),o=n.canvas.width-10-i;n.font="15px Arial",n.fillStyle=s,n.fillText(`${r.toFixed(4)}`,o,20),n.beginPath(),n.moveTo(o,25),n.lineTo(o+i,25),n.lineTo(o+i,25+i),n.strokeStyle=s,n.stroke()}draw(n,t,s){if(s.points)for(const r of this.pointList)r.draw(n,t);if(s.lines)for(const r of this.lineList)r.draw(n,t);if(s.vectors)for(const r of this.vectorList)r.draw(n,t);if(s.main)for(const r of this.mainList)r.draw(n,t,ie.main);if(s.mainB)for(const r of this.mainBList)r.draw(n,t,ie.mainB);if(s.second)for(const r of this.secondList)r.draw(n,t,ie.second);if(s.secondB)for(const r of this.secondBList)r.draw(n,t,ie.secondB);if(s.dynamics)for(const r of this.dynamicsList)r.draw(n,t,ie.dynamics);if(s.ruler&&this.drawRuler(n,t,ie.ruler),s.refframe){for(const r of[10,100,200])V(r,0).draw(n,t,ie.reference,2),V(-r,0).draw(n,t,ie.reference,2),V(0,r).draw(n,t,ie.reference,2),V(0,-r).draw(n,t,ie.reference,2);V(0,0).draw(n,t,ie.origin,2)}}};function jc(){return new qc}function rs(e){const n=jc();for(const t in e){const s=e[t];for(const r of s.pointList)n.pointList.push(r);for(const r of s.lineList)n.lineList.push(r);for(const r of s.vectorList)n.vectorList.push(r);for(const r of s.mainList)n.mainList.push(r);for(const r of s.mainBList)n.mainBList.push(r);for(const r of s.secondList)n.secondList.push(r);for(const r of s.secondBList)n.secondBList.push(r);for(const r of s.dynamicsList)n.dynamicsList.push(r)}return n}function kl(){return{points:!1,lines:!1,vectors:!1,main:!0,mainB:!1,second:!0,secondB:!1,dynamics:!1,ruler:!0,refframe:!1}}function Tl(e){return{points:e.points,lines:e.lines,vectors:e.vectors,main:e.main,mainB:e.mainB,second:e.second,secondB:e.secondB,dynamics:e.dynamics,ruler:e.ruler,refframe:e.refframe}}var Wc=(e=>(e[e.eNumber=0]="eNumber",e[e.eCheckbox=1]="eCheckbox",e[e.eDropdown=2]="eDropdown",e))(Wc||{});function Bc(e,n,t){return{val:e,init:n,chg:t}}function Vc(e){const n={};for(const t of Object.keys(e))n[t]=e[t].val;return n}var Hc=class{constructor(e){I(this,"paramVal",{});I(this,"paramInit",{});I(this,"paramChanged",{});I(this,"partName");I(this,"paramNames");for(const n of e.params)this.paramVal[n.name]=n.init,this.paramInit[n.name]=n.init,this.paramChanged[n.name]=!1;this.partName=e.partName,this.paramNames=this.getParamName()}getParamName(){const e=[];for(const n of Object.keys(this.paramVal))e.push(n);return e}getPartName(){return this.partName}getParamVal(){return this.paramVal}getVal(e){if(this.paramNames.includes(e))return this.paramVal[e];throw`err140: parameter ${e} does not exist in design ${this.partName}`}getInit(e){if(this.paramNames.includes(e))return this.paramInit[e];throw`err149: parameter ${e} does not exist in design ${this.partName}`}getChanged(e){if(this.paramNames.includes(e))return this.paramChanged[e];throw`err156: parameter ${e} does not exist in design ${this.partName}`}setVal(e,n){if(this.paramNames.includes(e))this.paramVal[e]=n,this.paramChanged[e]=!0;else throw`err163: parameter ${e} does not exist in design ${this.partName}`}applyParamVal(e){let n="";for(const t of Object.keys(e))this.setVal(t,e[t]);return n+=`info104: apply ${Object.keys(e).length} parameters on ${this.partName}
|
|
49
|
-
`,n}applyParamList(e){return this.applyParamVal(Vc(e))}getDesignParamList(){const e={};for(const n of this.paramNames)e[n]=Bc(this.getVal(n),this.getInit(n),this.getChanged(n));return e}};function Al(e){return new Hc(e)}function Pl(e,n,t,s=0,r=100,i=1){return{name:e,unit:n,init:t,min:s,max:r,step:i,dropdown:[],pType:0}}function El(e,n){return{name:e,unit:"checkbox",init:n?1:0,min:0,max:1,step:1,dropdown:[],pType:1}}function Cl(e,n){return{name:e,unit:"dropdown",init:0,min:0,max:n.length-1,step:1,dropdown:n,pType:2}}var Zc=(e=>(e[e.eLinearOrtho=0]="eLinearOrtho",e[e.eRotate=1]="eRotate",e))(Zc||{}),Gc=(e=>(e[e.eIdentity=0]="eIdentity",e[e.eIntersection=1]="eIntersection",e[e.eUnion=2]="eUnion",e[e.eSubstraction=3]="eSubstraction",e))(Gc||{});function Ml(e){return{partName:e,calcErr:!0,logstr:"",fig:{},vol:{extrudes:[],volumes:[]},sub:{}}}function Ll(e){if(e.calcErr){let n=`err182: Error in sub-design ${e.partName}
|
|
48
|
+
`}stringify(){return this.close(),this.dxfStr}};function $c(){return new Dc}function Oc(e,n,t){return{circle:!0,cx:e,cy:n,radius:t}}var Rc=class{constructor(){I(this,"seg");this.seg=[]}addStart(e,n){this.seg=[];const t={typ:0,px:e,py:n};this.seg.push(t)}addStroke(e,n){const t={typ:1,px:e,py:n};this.seg.push(t)}addArc(e,n,t,s,r){const i={typ:2,px:e,py:n,radius:t,large:s,ccw:r};this.seg.push(i)}toJson(){return{circle:!1,seg:this.seg}}};function Nc(){return new Rc}var wi=class{},Fc=class ht extends wi{constructor(t,s,r=""){super();I(this,"circle",!1);I(this,"segments");I(this,"points");I(this,"debugPoints");I(this,"debugLines");I(this,"lastPoint");I(this,"imposedColor");this.segments=[new Be(6,t,s,0)],this.points=[],this.debugPoints=[],this.debugLines=[],this.lastPoint=V(t,s),this.imposedColor=r}setLastPoint(t,s){this.lastPoint=V(t,s)}getLastPoint(){return this.lastPoint}addPointA(t,s){if(this.points.length>2)throw`err311: contour add too much point ${t} ${s}`;return this.points.push(V(t,s)),this}addPointAP(t,s){const r=V(0,0).translatePolar(t,s);return this.addPointA(r.cx,r.cy),this}addPointR(t,s){const i=this.getLastPoint().translate(t,s);return this.addPointA(i.cx,i.cy),this}addPointRP(t,s){const i=this.getLastPoint().translatePolar(t,s);return this.addPointA(i.cx,i.cy),this}addSeg(t){return this.segments.push(t),this}addSegStroke(){if(this.points.length!==1)throw`err554: contour addSegStroke with unexpected points.length ${this.points.length}`;const t=this.points.pop();if(t!==void 0){const s=new Be(0,t.cx,t.cy,0);t.isEqual(this.getLastPoint())||(this.addSeg(s),this.setLastPoint(t.cx,t.cy))}else throw"err284: contour p1 is undefined";return this}addSegStrokeA(t,s){return this.addPointA(t,s).addSegStroke(),this}addSegStrokeAP(t,s){return this.addPointAP(t,s).addSegStroke(),this}addSegStrokeR(t,s){return this.addPointR(t,s).addSegStroke(),this}addSegStrokeRP(t,s){return this.addPointRP(t,s).addSegStroke(),this}addSegArc(t,s,r){if(this.points.length!==1)throw`err954: contour addSegArc with unexpected points.length ${this.points.length}`;const i=this.points.pop();if(i!==void 0){const o=new Be(1,i.cx,i.cy,t,s,r);i.isEqual(this.getLastPoint())?console.log(`warn144: addSegArc last and new point identical ${Ge(i.cx)} ${Ge(i.cy)}`):(this.addSeg(o),this.setLastPoint(i.cx,i.cy))}else throw"err482: contour p1 is undefined";return this}addSegArc2(){if(this.points.length!==2)throw`err958: contour addSegArc2 with unexpected points.length ${this.points.length}`;const t=this.points.pop(),s=this.points.pop();if(s!==void 0&&t!==void 0){const r=this.getLastPoint(),i=xc(r,s,t),o=i.distanceToPoint(r),c=r.middlePoint(t),a=c.angleToPoint(r),f=c.angleToPoint(s),l=c.angleToPoint(i),p=ne(f-a),m=ne(l-a);let x=!1,_=!1;Math.sign(m)*Math.sign(p)>0&&(x=!0),Math.sign(p)>0&&(_=!0),this.addPointA(t.cx,t.cy).addSegArc(o,x,_),this.debugPoints.push(s)}else throw"err488: contour p1 or p2 or seg is undefined";return this}addSegArc3(t,s){if(this.points.length!==1)throw`err914: contour addSegArc3 with unexpected points.length ${this.points.length}`;const r=this.points.pop();if(r!==void 0){const i=this.getLastPoint(),o=ns(i,r);let c=r;s&&(c=i);const a=vn(c.cx,c.cy,t+Math.PI/2),f=o.intersection(a),l=f.distanceToPoint(i),p=i.middlePoint(r),m=c.angleToPoint(p),x=ne(t-m);let _=!1;Math.abs(x)>Math.PI/2&&(_=!0);let d=!1;x<0&&(d=!0),s||(d=!d),this.addPointA(r.cx,r.cy).addSegArc(l,_,d),this.debugPoints.push(p),this.debugPoints.push(f)}else throw"err282: contour p1 is undefined";return this}addSeg2Arcs(t,s){if(this.points.length!==1)throw`err214: contour addSeg2Arcs with unexpected points.length ${this.points.length}`;const r=this.points.pop();if(r!==void 0){const i=this.getLastPoint(),o=i.distanceToPoint(r),c=i.angleToPoint(r),a=r.angleToPoint(i),f=ne(t-c),l=-1*ne(s-a);if(Math.abs(f)>=Math.PI/2)throw`err545: addSeg2Arcs with too large au ${f}`;if(Math.abs(l)>=Math.PI/2)throw`err546: addSeg2Arcs with too large av ${l}`;if(J(f)===0)throw`err765: addSeg2Arcs with almost zero au ${f}`;if(J(l)===0)throw`err766: addSeg2Arcs with almost zero av ${l}`;if(Math.sign(f)*Math.sign(l)<1)throw`err767: addSeg2Arcs with au/av bad orientation ${f} ${l}`;const p=Math.tan(f/2),m=Math.tan(l/2),x=o*m/(m+p),_=Math.abs(x/Math.sin(f)),d=x/Math.cos(f/2),u=o*p/(m+p),h=Math.abs(u/Math.sin(l)),g=i.translatePolar(c+f/2,d);let w=!1;Math.sign(f)<0&&(w=!0),this.addPointA(g.cx,g.cy).addSegArc(_,!1,w),this.addPointA(r.cx,r.cy).addSegArc(h,!1,w),this.debugPoints.push(i.translatePolar(c,x)),this.debugPoints.push(i.translatePolar(c+f-Math.sign(f)*Math.PI/2,_)),this.debugPoints.push(r.translatePolar(a-l+Math.sign(f)*Math.PI/2,h))}else throw"err182: contour p1 is undefined";return this}addCornerPointed(){const t=new Be(2,0,0,0);return this.addSeg(t),this}addCornerRounded(t){const s=new Be(3,0,0,t);return this.addSeg(s),this}addCornerWidened(t){const s=new Be(4,0,0,t);return this.addSeg(s),this}addCornerWideAcc(t){const s=new Be(5,0,0,t);return this.addSeg(s),this}closeSegStroke(){const t=this.segments[0].px,s=this.segments[0].py;return this.addSegStrokeA(t,s),this}closeSegArc(t,s,r){const i=this.segments[0].px,o=this.segments[0].py;return this.addPointA(i,o).addSegArc(t,s,r),this}clone(){const t=new ht(this.segments[0].px,this.segments[0].py);for(const s of this.segments){const r=s.clone();r.sType!==6&&(t.addSeg(r),Fe(r.sType)&&t.setLastPoint(r.px,r.py))}return t}translate(t,s){const r=this.segments[0].px+t,i=this.segments[0].py+s,o=new ht(r,i);for(const c of this.segments){const a=c.clone();Fe(c.sType)&&(a.px+=t,a.py+=s),a.sType!==6&&(o.addSeg(a),Fe(a.sType)&&o.setLastPoint(a.px,a.py))}return o}translatePolar(t,s){return this.translate(s*Math.cos(t),s*Math.sin(t))}rotate(t,s,r){const i=V(t,s),c=V(this.segments[0].px,this.segments[0].py).rotate(i,r),a=new ht(c.cx,c.cy);for(const f of this.segments){const l=f.clone();if(Fe(f.sType)){const m=V(l.px,l.py).rotate(i,r);l.px=m.cx,l.py=m.cy}l.sType!==6&&(a.addSeg(l),Fe(l.sType)&&a.setLastPoint(l.px,l.py))}return a}scale(t,s,r,i=!1){const o=V(t,s),a=V(this.segments[0].px,this.segments[0].py).scale(o,r),f=new ht(a.cx,a.cy);for(const l of this.segments){const p=l.clone();if(Fe(l.sType)){const x=V(p.px,p.py).scale(o,r);p.px=x.cx,p.py=x.cy}l.sType===1&&(p.radius*=r),fn(l.sType)&&i&&(p.radius*=r),p.sType!==6&&(f.addSeg(p),Fe(p.sType)&&f.setLastPoint(p.px,p.py))}return f}addPartial(t){if(this.points.length>0)throw`err911: addPartial, points should be used ${this.points.length}`;let s=t;if(t.segments.length>0){const r=t.segments[0],i=this.getLastPoint(),o=r.px-i.cx,c=r.py-i.cy;r.sType===6&&(s=t.translate(-o,-c))}for(const r of s.segments)r.sType!==6&&(this.addSeg(r),Fe(r.sType)&&this.setLastPoint(r.px,r.py));return this}draw(t,s,r=ie.contour){const i=this.imposedColor===""?r:this.imposedColor;let o=0,c=0;for(const a of this.segments){if(a.sType===0){const[f,l]=gt(o,c,s),[p,m]=gt(a.px,a.py,s);t.beginPath(),t.moveTo(f,l),t.lineTo(p,m),t.strokeStyle=i,t.stroke()}if(a.sType===1)try{const f=xt(o,c,a),[l,p]=gt(f.pc.cx,f.pc.cy,s),m=hi(a.radius,s);t.beginPath(),t.arc(l,p,m,-f.a1,-f.a2,a.arcCcw),t.strokeStyle=i,t.stroke()}catch(f){console.log("err413: "+f)}Rt(a.sType)&&(o=a.px,c=a.py)}}extractSkeleton(){const t=this.segments[0],s=new ht(t.px,t.py);for(const r of this.segments)Fe(r.sType)&&s.addSeg(r);return s}generateContour(){lt.clearPoints(),lt.clearLines();const t=[],s=[];let r=0,i=0,o=0;for(const l of this.segments){if(l.sType===0){const x=V(i,o),_=V(l.px,l.py),d=V(0,0);t.push(new $e(l.sType,x,_,d,0,0,0,!1)),r=1}if(l.sType===1){const x=xt(i,o,l);t.push(x),r=1}const p=t.at(-1),m=t.at(-2);if(p!==void 0&&m!==void 0&&Fe(p.sType)&&Bn(m.sType)){const x=t.pop(),_=t.pop(),d=t.pop();if(d!==void 0&&_!==void 0&&x!==void 0){const u=gr(d,_,x);t.push(...u)}else throw"err603: contour generateContour internal error"}if(Bn(l.sType)){if(r===2)throw`err419: generateContour with two consecutive corners ${l.sType}`;if(r===0&&fn(l.sType)&&l.radius>0){const x=V(0,0);s.push(new $e(l.sType,x,x,x,l.radius,0,0,!1))}if(r===1&&fn(l.sType)&&l.radius>0){const x=V(0,0);t.push(new $e(l.sType,x,x,x,l.radius,0,0,!1))}r=2}Rt(l.sType)&&(i=l.px,o=l.py)}if(s.length>0)if(r===1)t.push(...s);else throw"err397: contour generateContour Corners defined at end and begining";const c=t.at(-1);if(c!==void 0&&Bn(c.sType)){const l=t[0],p=t.pop(),m=t.pop();if(m!==void 0&&p!==void 0&&l!==void 0){const x=gr(m,p,l);t.push(...x.slice(0,-1));const _=x.at(-1);if(_!==void 0)t[0]=_;else throw"err606: contour generateContour internal error"}else throw"err602: contour generateContour internal error"}const a=t[0],f=new ht(a.p1.cx,a.p1.cy,this.imposedColor);f.debugPoints.push(...lt.getPoints()),f.debugLines.push(...lt.getLines());for(const l of t)if(l.sType===0)f.addSegStrokeA(l.p2.cx,l.p2.cy);else if(l.sType===1){const p=wc(l);f.addPointA(l.p2.cx,l.p2.cy).addSegArc(p.radius,p.arcLarge,p.arcCcw)}else throw`err986: contour generateContour unexpected in seg2 Enum ${l.sType}`;return f}generatePoints(){const t=[];t.push(...this.debugPoints);const s=this.segments[0];t.push(V(s.px,s.py));let r=0,i=0;for(const o of this.segments){if(o.sType===1)try{const c=xt(r,i,o),a=V(c.pc.cx,c.pc.cy),f=ne((c.a2-c.a1)/2);let l=c.a1+f;(Math.sign(f)>0&&!o.arcCcw||Math.sign(f)<0&&o.arcCcw)&&(l+=Math.PI);const p=a.translatePolar(l,o.radius);t.push(p)}catch(c){console.log("err453: "+c)}Rt(o.sType)&&(r=o.px,i=o.py,t.push(V(r,i)))}return t}generateLines(){const t=[];return t.push(...this.debugLines),t}checkContour(t){if(t.segments[0].sType!==6)throw`err412: contour check first seg is not eStart ${t.segments[0].sType}`;let s=0,r=0;for(const c of t.segments){if(c.sType===1)try{xt(s,r,c)}catch(a){throw`err778: ${a}`}Rt(c.sType)&&(s=c.px,r=c.py)}const i=t.segments[0].px,o=t.segments[0].py;if(J(s-i)!==0||J(r-o)!==0)throw`err414: contour check, contour is not closed px ${i} ${s} py ${i} ${o}`}check(){lt.clearMsg(),this.checkContour(this);const t=this.generateContour();return this.checkContour(t),lt.getMsg()}toSvg(t,s=""){const r=Pc();for(const o of this.segments)o.sType===6?r.addStart(o.px,t-o.py):o.sType===0?r.addStroke(o.px,t-o.py):o.sType===1?r.addArc(o.px,t-o.py,o.radius,o.arcLarge,!o.arcCcw):console.log(`err631: contour.toSvg has unknown segment type ${o.sType}`);return r.stringify(s)}toDxfSeg(){const t=[];let s=0,r=0;for(const i of this.segments){if(i.sType===0)t.push(Mc(s,r,i.px,i.py));else if(i.sType===1)try{const o=xt(s,r,i);t.push(Lc(o.pc.cx,o.pc.cy,i.radius,o.a1,o.a2,o.arcCcw))}catch(o){console.log("err413: "+o)}Rt(i.sType)&&(s=i.px,r=i.py)}return t}toPax(){const t=Nc();for(const r of this.segments)r.sType===6?t.addStart(r.px,r.py):r.sType===0?t.addStroke(r.px,r.py):r.sType===1?t.addArc(r.px,r.py,r.radius,r.arcLarge,r.arcCcw):console.log(`err709: contour.toPax has unknown segment type ${r.sType}`);return t.toJson()}},Uc=class Tt extends wi{constructor(t,s,r,i=""){super();I(this,"circle",!0);I(this,"px");I(this,"py");I(this,"radius");I(this,"imposedColor");this.px=t,this.py=s,this.radius=r,this.imposedColor=i}clone(){return new Tt(this.px,this.py,this.radius,this.imposedColor)}translate(t,s){return new Tt(this.px+t,this.py+s,this.radius,this.imposedColor)}translatePolar(t,s){return this.translate(s*Math.cos(t),s*Math.sin(t))}rotate(t,s,r){const i=V(t,s),o=V(this.px,this.py).rotate(i,r);return new Tt(o.cx,o.cy,this.radius,this.imposedColor)}draw(t,s,r=ie.contour){const[i,o]=gt(this.px,this.py,s),c=hi(this.radius,s),a=this.imposedColor===""?r:this.imposedColor;t.beginPath(),t.arc(i,o,c,0,2*Math.PI,!0),t.strokeStyle=a,t.stroke()}extractSkeleton(){return new Tt(this.px,this.py,this.radius)}generateContour(){return new Tt(this.px,this.py,this.radius,this.imposedColor)}generatePoints(){const t=[],s=V(this.px,this.py);t.push(s);for(let r=0;r<4;r++){const i=s.translatePolar(r*Math.PI/2,this.radius);t.push(i)}return t}generateLines(){return[]}check(){return""}toSvg(t,s=""){return Tc(this.px,t-this.py,this.radius,s)}toDxfSeg(){const t=[];return t.push(Ic(this.px,this.py,this.radius)),t}toPax(){return Oc(this.px,this.py,this.radius)}};function vl(e,n,t=""){return new Fc(e,n,t)}function Sl(e,n,t,s=""){return new Uc(e,n,t,s)}var qc=class ss{constructor(){I(this,"pointList");I(this,"lineList");I(this,"vectorList");I(this,"mainList");I(this,"mainBList");I(this,"secondList");I(this,"secondBList");I(this,"dynamicsList");I(this,"xMin");I(this,"xMax");I(this,"yMin");I(this,"yMax");this.pointList=[],this.lineList=[],this.vectorList=[],this.mainList=[],this.mainBList=[],this.secondList=[],this.secondBList=[],this.dynamicsList=[],this.xMin=0,this.xMax=0,this.yMin=0,this.yMax=0}addPoint(n){this.pointList.push(n)}addPoints(n){this.pointList.push(...n)}addLine(n){this.lineList.push(n)}addLines(n){for(const t of n)this.lineList.push(t)}addVector(n){this.vectorList.push(n)}addMain(n){const t=n.generateContour();this.addPoints(t.generatePoints()),this.addLines(t.generateLines()),this.mainList.push(t),this.mainBList.push(n.extractSkeleton())}addSecond(n){const t=n.generateContour();this.addPoints(t.generatePoints()),this.addLines(t.generateLines()),this.secondList.push(t),this.secondBList.push(n.extractSkeleton())}addDynamics(n){this.addPoints(n.generatePoints()),this.addLines(n.generateLines()),this.dynamicsList.push(n)}translate(n,t){const s=new ss;for(const r of this.pointList)s.addPoint(r.translate(n,t));for(const r of this.lineList)s.addLine(r.translate(n,t));for(const r of this.vectorList)s.addVector(r.translate(n,t));for(const r of this.mainList)s.addMain(r.translate(n,t));for(const r of this.secondList)s.addSecond(r.translate(n,t));for(const r of this.dynamicsList)s.addDynamics(r.translate(n,t));return s}translatePolar(n,t){return this.translate(t*Math.cos(n),t*Math.sin(n))}rotate(n,t,s){const r=new ss,i=V(n,t);for(const o of this.pointList)r.addPoint(o.rotate(i,s));for(const o of this.lineList)r.addLine(o.rotate(i,s));for(const o of this.vectorList)r.addVector(o.rotate(i,s));for(const o of this.mainList)r.addMain(o.rotate(n,t,s));for(const o of this.secondList)r.addSecond(o.rotate(n,t,s));for(const o of this.dynamicsList)r.addDynamics(o.rotate(n,t,s));return r}mergeFigure(n,t=!1){for(const s of n.pointList)this.addPoint(s.clone());for(const s of n.lineList)this.addLine(s.clone());for(const s of n.vectorList)this.addVector(s.clone());for(const s of n.mainList)t?this.addSecond(s.clone()):this.addMain(s.clone());for(const s of n.secondList)this.addSecond(s.clone());for(const s of n.dynamicsList)this.addDynamics(s.clone())}clear(){this.pointList=[],this.lineList=[],this.vectorList=[],this.mainList=[],this.mainBList=[],this.secondList=[],this.secondBList=[],this.dynamicsList=[]}getMinMax(){[this.xMin,this.xMax,this.yMin,this.yMax]=mi(this.pointList)}getAdjustFull(n,t){let s=es();return this.pointList.length>0&&(this.getMinMax(),s=ts(this.xMin,this.xMax,this.yMin,this.yMax,n,t)),s}getAdjustZoom(n,t){let s=es();if(this.pointList.length>0){this.getMinMax();const r=(this.xMin+this.xMax)/2,i=(this.yMin+this.yMax)/2;s=ts(r,this.xMax,i,this.yMax,n,t)}return s}quantifyRuler(n,t){const r=n/10/t.scaleX;let i=1e-4;for(;i<r;)i*=10;i/5>r?i/=5:i/2>r&&(i/=2);const o=i*t.scaleX;return[i,o]}drawRuler(n,t,s){const[r,i]=this.quantifyRuler(n.canvas.width,t),o=n.canvas.width-10-i;n.font="15px Arial",n.fillStyle=s,n.fillText(`${r.toFixed(4)}`,o,20),n.beginPath(),n.moveTo(o,25),n.lineTo(o+i,25),n.lineTo(o+i,25+i),n.strokeStyle=s,n.stroke()}draw(n,t,s){if(s.points)for(const r of this.pointList)r.draw(n,t);if(s.lines)for(const r of this.lineList)r.draw(n,t);if(s.vectors)for(const r of this.vectorList)r.draw(n,t);if(s.main)for(const r of this.mainList)r.draw(n,t,ie.main);if(s.mainB)for(const r of this.mainBList)r.draw(n,t,ie.mainB);if(s.second)for(const r of this.secondList)r.draw(n,t,ie.second);if(s.secondB)for(const r of this.secondBList)r.draw(n,t,ie.secondB);if(s.dynamics)for(const r of this.dynamicsList)r.draw(n,t,ie.dynamics);if(s.ruler&&this.drawRuler(n,t,ie.ruler),s.refframe){for(const r of[10,100,200])V(r,0).draw(n,t,ie.reference,2),V(-r,0).draw(n,t,ie.reference,2),V(0,r).draw(n,t,ie.reference,2),V(0,-r).draw(n,t,ie.reference,2);V(0,0).draw(n,t,ie.origin,2)}}};function jc(){return new qc}function rs(e){const n=jc();for(const t in e){const s=e[t];for(const r of s.pointList)n.pointList.push(r);for(const r of s.lineList)n.lineList.push(r);for(const r of s.vectorList)n.vectorList.push(r);for(const r of s.mainList)n.mainList.push(r);for(const r of s.mainBList)n.mainBList.push(r);for(const r of s.secondList)n.secondList.push(r);for(const r of s.secondBList)n.secondBList.push(r);for(const r of s.dynamicsList)n.dynamicsList.push(r)}return n}function kl(){return{points:!1,lines:!1,vectors:!1,main:!0,mainB:!1,second:!0,secondB:!1,dynamics:!1,ruler:!0,refframe:!1}}function Tl(e){return{points:e.points,lines:e.lines,vectors:e.vectors,main:e.main,mainB:e.mainB,second:e.second,secondB:e.secondB,dynamics:e.dynamics,ruler:e.ruler,refframe:e.refframe}}var Wc=(e=>(e[e.eNumber=0]="eNumber",e[e.eCheckbox=1]="eCheckbox",e[e.eDropdown=2]="eDropdown",e))(Wc||{});function Bc(e,n,t){return{val:e,init:n,chg:t}}function Vc(e){const n={};for(const t of Object.keys(e))n[t]=e[t].val;return n}var Hc=class{constructor(e,n=""){I(this,"paramVal",{});I(this,"paramInit",{});I(this,"paramChanged",{});I(this,"partName");I(this,"paramNames");for(const t of e.params)this.paramVal[t.name]=t.init,this.paramInit[t.name]=t.init,this.paramChanged[t.name]=!1;this.partName=e.partName+n,this.paramNames=this.getParamName()}getParamName(){const e=[];for(const n of Object.keys(this.paramVal))e.push(n);return e}getPartName(){return this.partName}getParamVal(){return this.paramVal}getVal(e){if(this.paramNames.includes(e))return this.paramVal[e];throw`err140: parameter ${e} does not exist in design ${this.partName}`}getInit(e){if(this.paramNames.includes(e))return this.paramInit[e];throw`err149: parameter ${e} does not exist in design ${this.partName}`}getChanged(e){if(this.paramNames.includes(e))return this.paramChanged[e];throw`err156: parameter ${e} does not exist in design ${this.partName}`}setVal(e,n){if(this.paramNames.includes(e))this.paramVal[e]=n,this.paramChanged[e]=!0;else throw`err163: parameter ${e} does not exist in design ${this.partName}`}applyParamVal(e){let n="";for(const t of Object.keys(e))this.setVal(t,e[t]);return n+=`info104: apply ${Object.keys(e).length} parameters on ${this.partName}
|
|
49
|
+
`,n}applyParamList(e){return this.applyParamVal(Vc(e))}getDesignParamList(){const e={};for(const n of this.paramNames)e[n]=Bc(this.getVal(n),this.getInit(n),this.getChanged(n));return e}};function Al(e,n=""){return new Hc(e,n)}function Pl(e,n,t,s=0,r=100,i=1){return{name:e,unit:n,init:t,min:s,max:r,step:i,dropdown:[],pType:0}}function El(e,n){return{name:e,unit:"checkbox",init:n?1:0,min:0,max:1,step:1,dropdown:[],pType:1}}function Cl(e,n){return{name:e,unit:"dropdown",init:0,min:0,max:n.length-1,step:1,dropdown:n,pType:2}}var Zc=(e=>(e[e.eLinearOrtho=0]="eLinearOrtho",e[e.eRotate=1]="eRotate",e))(Zc||{}),Gc=(e=>(e[e.eIdentity=0]="eIdentity",e[e.eIntersection=1]="eIntersection",e[e.eUnion=2]="eUnion",e[e.eSubstraction=3]="eSubstraction",e))(Gc||{});function Ml(e){return{partName:e,calcErr:!0,logstr:"",fig:{},vol:{extrudes:[],volumes:[]},sub:{}}}function Ll(e){if(e.calcErr){let n=`err182: Error in sub-design ${e.partName}
|
|
50
50
|
`;throw n+=Yc(e.logstr,e.partName),n}}function Yc(e,n){let t="";for(const s of e.split(`
|
|
51
51
|
`))s!==""&&(t+=`[${n}]: ${s}
|
|
52
52
|
`);return t}var Xc=class{figureToPaxF(e){const n=[];for(const t of e)n.push(t.toPax());return n}getFigures(e){const n={};for(const t in e){const s=this.figureToPaxF(e[t].mainList);n[t]=s}return n}getPaxJson(e,n){return{partName:n.partName,params:e,faces:this.getFigures(n.fig),volume:n.vol,subs:n.sub,log:n.logstr}}getPaxStr(e,n){const t=this.getPaxJson(e,n);return JSON.stringify(t,null,2)}};function Zt(){return new Xc}function yi(e){let n=6;return e===1?n=0:e===2&&(n=1),n}function bi(e,n,t,s){let r=Math.PI/2;n<2*t&&(r=2*Math.asin(n/(2*t)));const i=Math.min(e,r),o=Math.ceil(s/i),c=s/o;return[o,c]}function _i(e,n,t,s=Math.PI/6,r=2){const[i,o]=bi(s,r,t,2*Math.PI),c=[];for(let l=0;l<i;l++){const p=e+t*Math.cos(l*o),m=n+t*Math.sin(l*o);c.push([p,m])}const a=c[0][0],f=c[0][1];return c.push([a,f]),c}function vi(e,n,t,s,r,i,o=Math.PI/6,c=2){const a=Qn(s,r,i),[f,l]=bi(o,c,t,Math.abs(a)),p=i?l:-l,m=f+1,x=[];for(let _=1;_<m;_++){const d=s+_*p,u=e+t*Math.cos(d),h=n+t*Math.sin(d);x.push([u,h])}return x}var Si=Math.PI/8,ki=20;function wr(e,n){return[[e,n]]}function Kc(e,n,t,s,r,i){return vi(e,n,t,s,r,i,Si,ki)}function Jc(e,n,t){return _i(e,n,t,Si,ki)}function zc(e){const n=[];let t=0,s=0;for(const r of e){if(r.typ===0)n.push(...wr(r.px,r.py));else if(r.typ===1)n.push(...wr(r.px,r.py));else if(r.typ===2)try{const i=r,o=new Be(yi(i.typ),i.px,i.py,i.radius,i.large,i.ccw),c=xt(t,s,o);n.push(...Kc(c.pc.cx,c.pc.cy,o.radius,c.a1,c.a2,c.arcCcw))}catch(i){console.log("err730: "+i)}t=r.px,s=r.py}return n}function yr(e){return e.toFixed(4)}var Qc=class{constructor(){I(this,"pts");I(this,"ptIdx");I(this,"idx");this.pts=[],this.ptIdx=[],this.idx=0}addContour(e){const n=[],t=[];for(const i of e){const[o,c]=i;n.push(`[ ${yr(o)}, ${yr(c)} ]`),t.push(` ${this.idx}`),this.idx+=1}const s=`[ ${n.join(",")} ]`,r=`[ ${t.join(",")} ]`;this.pts.push(s),this.ptIdx.push(r)}getFigure(e){let n="";const t=[],s=[];for(const o of this.pts.keys()){const c=`ca_${e}_${o}`,a=`cb_${e}_${o}`;n+=`${c} = ${this.pts[o]};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var le=Object.defineProperty;var re=(l,t,s)=>t in l?le(l,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):l[t]=s;var V=(l,t,s)=>(re(l,typeof t!="symbol"?t+"":t,s),s);import{p as e,a as rt,b as wt,i as nt,d as Et,f as L,c as z,E as O,g as Z,h as dt,j as ct,k as ht,r as st,l as v,m as C,n as et,o as tt,q as xt,s as kt,w as Nt,S as St,t as de}from"./index.BROvJSft.js";var ce=class{constructor(l,t,s,n,o){V(this,"base_center_x");V(this,"base_center_y");V(this,"base_radius");V(this,"initial_angle");V(this,"right_nleft");this.base_center_x=l,this.base_center_y=t,this.base_radius=s,this.initial_angle=n,this.right_nleft=o}angleSign(){return this.right_nleft?1:-1}lFromU(l){return this.base_radius*Math.sqrt(1+l**2)}wFromU(l){if(l<0)throw`err729: involute parameter au ${l} is negative`;if(Math.abs(l)>Math.PI/2)throw`err730: involute parameter au ${l} is larger than PI/2`;return this.angleSign()*(l-Math.atan(l))}w2FromU(l){return this.initial_angle+this.wFromU(l)}ptc(l){const t=this.lFromU(l),s=this.w2FromU(l),n=this.base_center_x+Math.cos(s)*t,o=this.base_center_y+Math.sin(s)*t;return[n,o]}ptcta(l){return this.initial_angle+this.angleSign()*l}uFromL(l){return Math.sqrt(l**2/this.base_radius**2-1)}uFromWslow(l){let s=Math.PI/3,n=s/2,o=this.wFromU(s),i=0;for(;Math.abs(o-l)>1e-4;)o<l?s+=n:s-=n,o=this.wFromU(s),n=n/2,i+=1;return console.log(`dbg072: uFromWslow itcnt ${i}`),s}laptc(l,t,s,n){if(Math.sign(t)*this.angleSign()<0)throw`err904: Invole.laptc angle-of-pressure ${t} not compatible with right_nleft ${this.right_nleft}`;const o=l+t,i=this.base_center_x+Math.cos(o)*this.base_radius,d=this.base_center_y+Math.sin(o)*this.base_radius,w=o-this.angleSign()*Math.PI/2,_=s*this.base_radius,a=i+Math.cos(w)*_,h=d+Math.sin(w)*_,r=this.lFromU(s)*n,c=s,f=Math.cos(c)*r,N=Math.sin(c)*r;return[a,h,f,N]}};function gt(l,t,s,n,o){return new ce(l,t,s,n,o)}var he=class{constructor(){V(this,"mod",1);V(this,"TN",23);V(this,"as",1);V(this,"cx",0);V(this,"cy",0);V(this,"brr",50);V(this,"blr",50);V(this,"ar",54);V(this,"pr",53);V(this,"dr",52);V(this,"br",51);V(this,"bRound",1);V(this,"adt",.5);V(this,"initAngle",0);V(this,"axisAngle",0);V(this,"involArcPairs",1);V(this,"skinThickness",0);V(this,"involuteR",gt(0,0,50,0,!0));V(this,"involuteL",gt(0,0,50,0,!1));V(this,"rud",0);V(this,"rup",0);V(this,"rua",0);V(this,"rwd",0);V(this,"rwp",0);V(this,"rwa",0);V(this,"lud",0);V(this,"lup",0);V(this,"lua",0);V(this,"lwd",0);V(this,"lwp",0);V(this,"lwa",0);V(this,"msg");V(this,"initStep",0);this.mod=1,this.msg="",this.initStep=0}incInitStep(l){if(this.initStep+1!==l)throw`err834: incInitStep initStep ${this.initStep} and target ${l} are not compatible`;this.initStep=l}checkInitStep(l,t){if(this.initStep<l)throw`err835: checkInitStep for ${t} initStep ${this.initStep} is too small compare to targetMin ${l}`}set1ModuleToothNumber(l,t){this.incInitStep(1),this.mod=l,this.TN=t,this.pr=this.mod*this.TN/2,this.as=2*Math.PI/this.TN}set2CenterPosition(l,t){this.incInitStep(2),this.cx=l,this.cy=t}set3CircleRadius(l,t,s,n){this.incInitStep(3),this.ar=this.pr+this.mod*l,this.dr=this.pr-this.mod*t,this.br=this.dr-this.mod*s,this.bRound=n}set4BaseCircles(l,t){this.incInitStep(4),this.brr=l,this.blr=t}set5AddendumThickness(l){this.incInitStep(5),this.adt=l/100}set6Angles(l,t){this.incInitStep(6),this.initAngle=l,this.axisAngle=t}set7InvoluteDetails(l,t){this.incInitStep(7),this.involArcPairs=l,this.skinThickness=t}getRefCircles(){return this.checkInitStep(4,"getRefCircles"),[v(this.cx,this.cy,this.ar,"Azure"),v(this.cx,this.cy,this.pr,"Azure"),v(this.cx,this.cy,this.dr,"Azure"),v(this.cx,this.cy,this.br,"Azure"),v(this.cx,this.cy,this.brr,"CornFlowerBlue"),v(this.cx,this.cy,this.blr,"Crimson")]}calcInvoluteAngles(){this.checkInitStep(4,"calcInvoluteAngles"),this.involuteR=gt(this.cx,this.cy,this.brr,0,!0),this.dr>this.brr?this.rud=this.involuteR.uFromL(this.dr):this.rud=0,this.rup=this.involuteR.uFromL(this.pr),this.rua=this.involuteR.uFromL(this.ar),this.rwd=this.involuteR.wFromU(this.rud),this.rwp=this.involuteR.wFromU(this.rup),this.rwa=this.involuteR.wFromU(this.rua),this.involuteL=gt(this.cx,this.cy,this.blr,0,!1),this.dr>this.blr?this.lud=this.involuteL.uFromL(this.dr):this.rud=0,this.lup=this.involuteL.uFromL(this.pr),this.lua=this.involuteL.uFromL(this.ar),this.lwd=this.involuteL.wFromU(this.lud),this.lwp=this.involuteL.wFromU(this.lup),this.lwa=this.involuteL.wFromU(this.lua)}checkProfileConditions(){const l=this.as*this.adt,t=this.rwa-this.rwp,s=Math.abs(this.lwa-this.lwp),n=l-t-s;if(n<0)throw`err554: No remaining Addendum reserve ${L(n)}
|
|
2
|
+
`;const o=this.as*(1-this.adt),i=this.rwp-this.rwd,d=Math.abs(this.lwp-this.lwd),w=o-i-d;if(w<2*Math.atan2(this.bRound,this.br))throw`err555: No remaining Dedendum reserve ${L(w)} compare to bRound ${L(this.bRound)}
|
|
3
|
+
`}getToothRef(){const l=6*this.involArcPairs,t=0;this.checkInitStep(7,"getProfile"),this.calcInvoluteAngles();const s=(this.rua-this.rud)/l,n=(this.lua-this.lud)/l,o=this.initAngle+t*this.as,i=gt(this.cx,this.cy,this.brr,o-this.rwp,!0),[d,w]=i.ptc(this.rud+0*s),_=z(d,w,"Gold");for(let g=0;g<l;g++){const[r,c]=i.ptc(this.rud+(g+1)*s);_.addSegStrokeA(r,c)}const a=o+this.as*this.adt,h=gt(this.cx,this.cy,this.blr,a-this.lwp,!1);for(let g=0;g<l+1;g++){const[r,c]=h.ptc(this.lud+(l-g)*n);_.addSegStrokeA(r,c)}return _.closeSegStroke(),_}getProfile(){this.checkInitStep(7,"getProfile"),this.calcInvoluteAngles(),this.checkProfileConditions();const l=this.rwd-this.rwp,t=this.lwd-this.lwp,s=this.dr>this.brr?this.dr:this.brr,n=this.dr>this.blr?this.dr:this.blr;if(this.bRound>s-this.br)throw`err409: getProfile bRound ${L(this.bRound)} too large for erdr ${L(s)} and br ${L(this.br)}`;if(this.bRound>n-this.br)throw`err408: getProfile bRound ${L(this.bRound)} too large for eldr ${L(n)} and br ${L(this.br)}`;const o=(this.rua-this.rud)/this.involArcPairs,i=(this.lua-this.lud)/this.involArcPairs,d=et(this.cx,this.cy),w=d.translatePolar(this.initAngle+l,this.br),_=z(w.cx,w.cy);for(let a=0;a<this.TN;a++){const h=this.initAngle+a*this.as,g=d.translatePolar(h+l,this.br);_.addSegStrokeA(g.cx,g.cy).addCornerRounded(this.bRound);const r=gt(this.cx,this.cy,this.brr,h-this.rwp,!0),[c,f]=r.ptc(this.rud),N=r.ptcta(this.rud),y=et(c,f).translatePolar(N-Math.PI/2,this.skinThickness);_.addSegStrokeA(y.cx,y.cy);for(let u=0;u<this.involArcPairs;u++){const H=this.rud+u*o,[I,M]=r.ptc(H+o),B=r.ptcta(H),T=r.ptcta(H+o)+Math.PI,F=et(I,M).translatePolar(B-Math.PI/2,this.skinThickness);_.addPointA(F.cx,F.cy).addSeg2Arcs(B,T)}const x=h+this.as*this.adt,A=gt(this.cx,this.cy,this.blr,x-this.lwp,!1),S=this.lud+this.involArcPairs*i,[R,D]=A.ptc(S),k=A.ptcta(S)+Math.PI,$=et(R,D).translatePolar(k-Math.PI/2,this.skinThickness);_.addSegStrokeA($.cx,$.cy);for(let u=0;u<this.involArcPairs;u++){const H=this.lud+(this.involArcPairs-u)*i,[I,M]=A.ptc(H-i),B=A.ptcta(H)+Math.PI,T=A.ptcta(H-i),F=et(I,M).translatePolar(B-Math.PI/2,this.skinThickness);_.addPointA(F.cx,F.cy).addSeg2Arcs(B,T)}const b=d.translatePolar(x+t,this.br);_.addSegStrokeA(b.cx,b.cy).addCornerRounded(this.bRound)}return _.closeSegStroke(),_}getMsg(){return this.msg}};function Wt(){return new he}function ae(l,t,s,n){l.checkInitStep(1,"helper.gw2center-1"),t.checkInitStep(1,"helper.gw2center-2");const o=l.pr+t.pr+n,i=l.cx+o*Math.cos(s),d=l.cy+o*Math.sin(s);return[i,d,o]}function ge(l,t,s,n,o,i,d,w,_){l.checkInitStep(3,"helper.baseCircles-1"),t.checkInitStep(3,"helper.baseCircles-2");let a=s,h=o,g=n,r=i;const c=w,f=_;return c===0&&(t.TN>l.TN?(a=l.dr,h=a*t.TN/l.TN):(h=t.dr,a=h*l.TN/t.TN)),f===0&&(t.TN>l.TN?(g=l.dr,r=g*t.TN/l.TN):(r=t.dr,g=r*l.TN/t.TN)),d===1&&(g=a,r=h),[a,g,h,r]}var ue=class{constructor(l,t,s,n,o,i){V(this,"gw1");V(this,"gw2");V(this,"initAngle1");V(this,"angleCenterCenter");V(this,"interAxis");V(this,"rightLeftCenter2");V(this,"msg");V(this,"apr");V(this,"apl");V(this,"lBDr",0);V(this,"lBDl",0);V(this,"laStartRr1",0);V(this,"laStartRr2",0);V(this,"laStartRl1",0);V(this,"laStartRl2",0);V(this,"aFODr1",0);V(this,"aFODr2",0);V(this,"aFODl1",0);V(this,"aFODl2",0);V(this,"lasr1",0);V(this,"lasr2",0);V(this,"lasl1",0);V(this,"lasl2",0);V(this,"firstToothUr1",0);V(this,"firstToothUl1",0);V(this,"ftdr1",0);V(this,"ftdl1",0);this.gw1=l,this.gw2=t,this.initAngle1=s,this.angleCenterCenter=n,this.interAxis=o,this.rightLeftCenter2=i,this.msg="",this.apr=0,this.apl=0}check1(){this.gw1.checkInitStep(4,"ActionLine.check1-1"),this.gw2.checkInitStep(4,"ActionLine.check1-2"),this.interAxis>this.gw1.ar+this.gw2.ar&&(this.msg+=`warn333: initAngle2 interAxis ${L(this.interAxis)} is too large compare to gw1.ar ${L(this.gw1.ar)} and gw2.ar ${L(this.gw2.ar)}
|
|
4
|
+
`),tt(this.gw1.brr*this.gw2.TN-this.gw2.brr*this.gw1.TN)!==0&&(this.msg+=`warn407: right ratios differ N1/N2 = ${this.gw1.TN} / ${this.gw2.TN} = ${L(this.gw1.TN/this.gw2.TN)} and brr1/brr2 = ${L(this.gw1.brr)}/${L(this.gw2.brr)} = ${L(this.gw1.brr/this.gw2.brr)}
|
|
5
|
+
`),tt(this.gw1.blr*this.gw2.TN-this.gw2.blr*this.gw1.TN)!==0&&(this.msg+=`warn408: left ratios differ N1/N2 = ${this.gw1.TN} / ${this.gw2.TN} = ${L(this.gw1.TN/this.gw2.TN)} and blr1/blr2 = ${L(this.gw1.blr)}/${L(this.gw2.blr)} = ${L(this.gw1.blr/this.gw2.blr)}
|
|
6
|
+
`)}check2(){this.gw1.checkInitStep(5,"ActionLine.check2-1"),this.gw2.checkInitStep(5,"ActionLine.check2-2"),tt(this.gw1.adt+this.gw2.adt-1)>0&&(this.msg+=`warn281: addendum thickness too large: adt1 ${L(this.gw1.adt)} adt2 ${L(this.gw2.adt)}
|
|
7
|
+
`);const l=this.gw1.ar-this.gw1.pr,t=this.gw1.pr-this.gw1.dr,s=this.gw2.ar-this.gw2.pr,n=this.gw2.pr-this.gw2.dr;tt(n-l)<0&&(this.msg+=`warn282: addendum-1 ${L(l)} larger than dedendum-2 ${L(n)}
|
|
8
|
+
`),tt(t-s)<0&&(this.msg+=`warn283: addendum-2 ${L(s)} larger than dedendum-1 ${L(t)}
|
|
9
|
+
`)}calcActionLine(){this.gw1.checkInitStep(4,"ActionLine.calcActionLine-1"),this.gw2.checkInitStep(4,"ActionLine.calcActionLine-2"),this.gw1.calcInvoluteAngles(),this.gw2.calcInvoluteAngles();const l=this.interAxis*this.gw1.brr/(this.gw1.brr+this.gw2.brr),t=this.interAxis*this.gw1.blr/(this.gw1.blr+this.gw2.blr),s=this.interAxis-l,n=this.interAxis-t;this.apr=Math.acos((this.gw1.brr+this.gw2.brr)/this.interAxis),this.apl=Math.acos((this.gw1.blr+this.gw2.blr)/this.interAxis),this.msg+=`Pressure angular: right: ${L(st(this.apr))} left: ${L(st(this.apl))} degree
|
|
10
|
+
`,this.lBDr=this.interAxis*Math.sin(this.apr),this.lBDl=this.interAxis*Math.sin(this.apl),this.msg+=`Line of Action Maximum length: right: ${L(this.lBDr)} left: ${L(this.lBDl)} mm
|
|
11
|
+
`;const o=Math.PI/2+this.apr,i=xt(this.gw1.ar,l,o);this.aFODr1=Math.PI-o-i;const d=this.gw1.rua-this.apr-this.gw1.rwa;if(tt(this.aFODr1-d)!==0)throw`dbg378: aFODr1 ${this.aFODr1} and aFODr1Alt ${d} differ`;const w=kt(l,this.gw1.ar,this.aFODr1),_=o,a=xt(this.gw2.ar,s,_);this.aFODr2=Math.PI-_-a;const h=this.gw2.rua-this.apr-this.gw2.rwa;if(tt(this.aFODr2-h)!==0)throw`dbg379: aFODr2 ${this.aFODr2} and aFODr2Alt ${h} differ`;const g=kt(s,this.gw2.ar,this.aFODr2),r=w+g,c=r/this.gw1.brr,f=r/this.gw2.brr,N=this.gw1.rua-c,y=this.gw2.rua-f;this.laStartRr1=this.gw1.involuteR.lFromU(N),this.laStartRr2=this.gw2.involuteR.lFromU(y);const x=Math.PI/2+this.apl,A=xt(this.gw1.ar,t,x);this.aFODl1=Math.PI-x-A;const S=this.gw1.lua-this.apl+this.gw1.lwa;if(tt(this.aFODl1-S)!==0)throw`dbg388: aFODl1 ${this.aFODl1} and aFODl1Alt ${S} differ`;const R=kt(t,this.gw1.ar,this.aFODl1),D=o,k=xt(this.gw2.ar,n,D);this.aFODl2=Math.PI-D-k;const $=this.gw2.lua-this.apl+this.gw2.lwa;if(tt(this.aFODl2-$)!==0)throw`dbg389: aFODl2 ${this.aFODl2} and aFODl2Alt ${$} differ`;const b=kt(n,this.gw2.ar,this.aFODl2),u=R+b,H=u/this.gw1.blr,I=u/this.gw2.blr,M=this.gw1.lua-H,B=this.gw2.lua-I;this.laStartRl1=this.gw1.involuteL.lFromU(M),this.laStartRl2=this.gw2.involuteL.lFromU(B),this.msg+=`Line of Action Effective length: right: ${L(r)} left: ${L(u)} mm
|
|
12
|
+
`,this.msg+=`Line of Action Effective rotation angle: right-1: ${L(st(c))} right-2: ${L(st(f))} left-1: ${L(st(H))} left-2: ${L(st(I))} degree
|
|
13
|
+
`,this.msg+=`Line of Action Effective height: right-1: ${L(this.gw1.ar-this.laStartRr1)} right-2: ${L(this.gw2.ar-this.laStartRr2)} left-1: ${L(this.gw1.ar-this.laStartRl1)} left-2: ${L(this.gw2.ar-this.laStartRl2)} mm
|
|
14
|
+
`,this.lasr1=2*Math.PI/this.gw1.TN*this.gw1.brr,this.lasr2=2*Math.PI/this.gw2.TN*this.gw2.brr,this.msg+=`Line of Action right: step length: 1: ${L(this.lasr1)} 2: ${L(this.lasr2)} mm
|
|
15
|
+
`,this.msg+=`Line of Action right: nb of contact point: 1: ${L(r/this.lasr1)} 2: ${L(r/this.lasr2)}
|
|
16
|
+
`,this.lasl1=2*Math.PI/this.gw1.TN*this.gw1.blr,this.lasl2=2*Math.PI/this.gw2.TN*this.gw2.blr,this.msg+=`Line of Action left: step length: 1: ${L(this.lasl1)} 2: ${L(this.lasl2)} mm
|
|
17
|
+
`,this.msg+=`Line of Action left: nb of contact point: 1: ${L(u/this.lasl1)} 2: ${L(u/this.lasl2)}
|
|
18
|
+
`}calcContactPoint1(){for(this.gw1.checkInitStep(5,"ActionLine.calcContactPoint1"),this.firstToothUr1=Nt(this.apr-(this.initAngle1-this.angleCenterCenter)+this.gw1.rwp);tt(this.firstToothUr1-this.gw1.as)>=0;)this.firstToothUr1=tt(this.firstToothUr1-this.gw1.as);for(this.firstToothUl1=Nt(this.apl+(this.initAngle1-this.angleCenterCenter)+this.gw1.as*this.gw1.adt-this.gw1.lwp);tt(this.firstToothUl1-this.gw1.as)>=0;)this.firstToothUl1=tt(this.firstToothUl1-this.gw1.as);this.ftdr1=this.gw1.brr*this.firstToothUr1,this.ftdl1=this.gw1.blr*this.firstToothUl1}prepare(){this.check1(),this.check2(),this.calcActionLine(),this.calcContactPoint1()}oneContactSpeed(l,t,s,n,o,i,d,w,_,a){const g=Math.floor(t/(2*s)),r=(n+g*s)/o,c=l?1:-1,[f,N,y,x]=i.laptc(d,c*w,r,.4);this.msg+=`speed ${_}: vx ${L(y)} vy: ${L(x)} m/s
|
|
19
|
+
`;const A=et(f,N),S=d+c*w,R=z(f,N,a),D=A.translatePolar(S,-x);R.addSegStrokeA(D.cx,D.cy);const k=D.translatePolar(S-c*Math.PI/2,y);return R.addSegStrokeA(k.cx,k.cy),R.closeSegStroke(),R}getContactSpeed(){const l=this.oneContactSpeed(!0,this.lBDr,this.lasr1,this.ftdr1,this.gw1.brr,this.gw1.involuteR,this.angleCenterCenter,this.apr,"R1","Black"),t=this.oneContactSpeed(!1,this.lBDl,this.lasl1,this.ftdl1,this.gw1.blr,this.gw1.involuteL,this.angleCenterCenter,this.apl,"L1","Black"),s=[];return s.push(l),s.push(t),s}getContours(){const l=[];l.push(v(this.gw1.cx,this.gw1.cy,this.laStartRr1,"SkyBlue")),l.push(v(this.gw1.cx,this.gw1.cy,this.laStartRl1,"SlateBlue")),l.push(v(this.gw2.cx,this.gw2.cy,this.laStartRr2,"SkyBlue")),l.push(v(this.gw2.cx,this.gw2.cy,this.laStartRl2,"SlateBlue"));const t=et(this.gw1.cx,this.gw1.cy),s=et(this.gw2.cx,this.gw2.cy),n=t.translatePolar(this.angleCenterCenter+this.apr,this.gw1.brr),o=s.translatePolar(this.angleCenterCenter+Math.PI+this.apr,this.gw2.brr),i=z(n.cx,n.cy,"YellowGreen");i.addSegStrokeA(o.cx,o.cy),i.closeSegStroke(),l.push(i);const d=t.translatePolar(this.angleCenterCenter-this.aFODr1,this.gw1.ar),w=s.translatePolar(this.angleCenterCenter+Math.PI-this.aFODr2,this.gw2.ar),_=z(d.cx,d.cy,"Yellow");_.addSegStrokeA(w.cx,w.cy),_.closeSegStroke(),l.push(_);const a=t.translatePolar(this.angleCenterCenter-this.apl,this.gw1.blr),h=s.translatePolar(this.angleCenterCenter+Math.PI-this.apl,this.gw2.blr),g=z(a.cx,a.cy,"YellowGreen");g.addSegStrokeA(h.cx,h.cy),g.closeSegStroke(),l.push(g);const r=t.translatePolar(this.angleCenterCenter+this.aFODl1,this.gw1.ar),c=s.translatePolar(this.angleCenterCenter+Math.PI+this.aFODl2,this.gw2.ar),f=z(r.cx,r.cy,"Yellow");return f.addSegStrokeA(c.cx,c.cy),f.closeSegStroke(),l.push(f),l.push(...this.getContactSpeed()),l}getContactPoint(){const l=[],t=et(this.gw1.cx,this.gw1.cy),s=t.translatePolar(this.angleCenterCenter+this.apr,this.gw1.brr),n=t.translatePolar(this.angleCenterCenter-this.apl,this.gw1.blr);l.push(et(s.cx,s.cy,St.eBigSquare)),l.push(et(n.cx,n.cy,St.eBigSquare));const o=this.angleCenterCenter+this.apr-Math.PI/2,i=this.angleCenterCenter-this.apl+Math.PI/2,d=s.translatePolar(o,this.ftdr1),w=n.translatePolar(i,this.ftdl1);l.push(et(d.cx,d.cy,St.eBigSquare)),l.push(et(w.cx,w.cy,St.eBigSquare));let _=this.ftdr1;for(;_+this.lasr1<this.lBDr;){_+=this.lasr1;const h=s.translatePolar(o,_);l.push(et(h.cx,h.cy,St.eBigSquare))}let a=this.ftdl1;for(;a+this.lasl1<this.lBDl;){a+=this.lasl1;const h=n.translatePolar(i,a);l.push(et(h.cx,h.cy,St.eBigSquare))}return l}getMsg(){return this.msg}getInitAngle2(){let l=this.lBDr-this.ftdr1;for(;tt(l-this.lasr2)>=0;)l=tt(l-this.lasr2);let t=this.lBDl-this.ftdl1;for(;tt(t-this.lasl2)>=0;)t=tt(t-this.lasl2);const s=l/this.gw2.brr,n=t/this.gw2.blr,o=this.angleCenterCenter+Math.PI+this.apr-s+this.gw2.rwp,d=this.angleCenterCenter+Math.PI-this.apl+n+this.gw2.lwp-this.gw2.as*this.gw2.adt;let w=2*Math.PI+Nt(d);for(;tt(w-this.gw2.as-o)>=0;)w=tt(w-this.gw2.as);const _=w-o,a=_*this.gw2.brr/this.gw1.brr,h=_*this.gw2.brr,g=_*this.gw2.blr;this.msg+=`slack angle: 1: ${L(st(a))} 2: ${L(st(_))} degree
|
|
20
|
+
`,this.msg+=`slack on action line: right-2: ${L(h)} left-2: ${L(g)} mm
|
|
21
|
+
`;let r=0;if(this.rightLeftCenter2===0)r=o;else if(this.rightLeftCenter2===1)r=d;else if(this.rightLeftCenter2===2)r=o+_/2;else throw`err221: initAngle2 rightLeftCenter2 ${this.rightLeftCenter2} has an unkown value`;return de(r)}};function _e(l,t,s,n,o,i){return new ue(l,t,s,n,o,i)}function fe(l,t,s,n,o,i,d,w,_){let a=v(l,t,s);if(n>0){if(o>2*s)throw`err383: axisTorque ribWidth ${L(o)} larger than 2x axisRadius ${L(s)}`;const h=Math.asin(o/(2*s)),g=2*Math.PI/n;if(g-2.5*h<0)throw`err384: axisTorque ribWidth ${L(o)} or ribNb ${n} are too large`;if(d>o/2)throw`err385: axisTorque ribRound1 ${L(d)} too large compare to ribWidth ${L(o)}`;if(d+w>i)throw`err386: axisTorque ribRound12 ${L(d)} ${L(w)} too large compare to ribHeight ${L(o)}`;const r=g-2*h>Math.PI,c=et(l,t),N=c.translatePolar(_,s+i).translatePolar(_+Math.PI/2,o/2);a=z(N.cx,N.cy);for(let y=0;y<n;y++){const x=_+y*g,A=x+g,S=c.translatePolar(x+h,s),R=c.translatePolar(A-h,s),k=c.translatePolar(x,s+i).translatePolar(x+Math.PI/2,o/2),b=c.translatePolar(A,s+i).translatePolar(A-Math.PI/2,o/2);a.addSegStrokeA(k.cx,k.cy).addCornerRounded(d),a.addSegStrokeA(S.cx,S.cy).addCornerRounded(w),a.addPointA(R.cx,R.cy).addSegArc(s,r,!0).addCornerRounded(w),a.addSegStrokeA(b.cx,b.cy).addCornerRounded(d)}a.closeSegStroke()}return a}function Le(l,t,s,n,o,i,d,w){const _=2*Math.PI/o,a=Math.asin(i/(2*n)),h=Math.asin(i/(2*s));if(i>2*n)throw`err905: hollowStraight spokeWidth ${L(i)} too large for hollowInt ${L(n)}`;if(s-n<2.1*d)throw`err906: hollowStraight hollowExt ${L(s)}, hollowInt ${L(n)} and spokeRound ${L(d)} do not fit`;if(_-2*h<2.5*Math.asin(d/s))throw`err907: hollowStraight spokeNb ${o}, spokeWidth ${L(i)} or spokeRound ${L(d)} are too large`;const g=i/(2*Math.sin(_/2)),r=_-2*a<2.1*Math.asin(d/n),c=_-2*h>Math.PI,f=et(l,t),N=[];for(let y=0;y<o;y++){const x=w+y*_,A=x+_,S=x+_/2,R=f.translatePolar(x+h,s),D=f.translatePolar(A-h,s),k=f.translatePolar(A-a,n),$=f.translatePolar(x+a,n),b=f.translatePolar(S,g),u=z(R.cx,R.cy);u.addCornerRounded(d),u.addPointA(D.cx,D.cy).addSegArc(s,c,!0).addCornerRounded(d),r?u.addSegStrokeA(b.cx,b.cy).addCornerRounded(d):(u.addSegStrokeA(k.cx,k.cy).addCornerRounded(d),u.addPointA($.cx,$.cy).addSegArc(n,c,!1).addCornerRounded(d)),u.closeSegStroke(),N.push(u)}return N}function qt(l,t,s,n,o,i,d,w,_,a){const h=a?1:-1,g=l/2,r=g+t,c=r+s,f=z(0,-c);return f.addSegStrokeA(h*n,-c).addCornerRounded(d).addSegStrokeA(h*n,-r).addCornerRounded(w).addSegStrokeA(h*o,-r).addSegStrokeA(h*i,-g).addCornerRounded(_).addSegStrokeA(h*i,g).addCornerRounded(_).addSegStrokeA(h*o,r).addSegStrokeA(h*n,r).addCornerRounded(w).addSegStrokeA(h*n,c).addCornerRounded(d).addSegStrokeA(0,c).closeSegStroke(),f}var Yt={partName:"gear_wheel_wheel",params:[e("module","mm",10,.1,100,.1),e("N1","scalar",23,3,1e3,1),e("N2","scalar",19,3,1e3,1),e("angleCenterCenter","degree",0,-180,180,1),e("addInterAxis","mm",0,0,100,.05),e("c1x","mm",0,-200,200,1),e("c1y","mm",0,-200,200,1),e("ah1","scalar",1,.1,2,.05),e("dh1","scalar",1,.1,2,.05),e("bh1","scalar",.25,.1,2,.05),e("bRound1","mm",2,0,50,.1),e("ah2","scalar",1,.1,2,.05),e("dh2","scalar",1,.1,2,.05),e("bh2","scalar",.25,.1,2,.05),e("bRound2","mm",2,0,50,.1),e("at1","%",50,10,90,.5),e("at2","%",50,10,90,.5),rt("involSym",!0),wt("involROpt",["Optimum","Base-1","Base-2","PressureAngle","FreeBase-12"]),wt("involLOpt",["Optimum","Base-1","Base-2","PressureAngle","FreeBase-12"]),e("brr1","mm",50,10,2e3,.05),e("brr2","mm",50,10,2e3,.05),e("blr1","mm",50,10,2e3,.05),e("blr2","mm",50,10,2e3,.05),e("involArcPairs1","scalar",2,1,40,1),e("involArcPairs2","scalar",2,1,40,1),e("skinThickness1","mm",0,-3,3,.01),e("skinThickness2","mm",0,-3,3,.01),e("initAngle1","degree",0,-180,180,1),wt("gw2Position",["right","left","center"]),rt("centralAxis",!0),e("axisRadius","mm",10,.1,200,.1),e("ribNb","scalar",5,0,32,1),e("ribWidth","mm",8,1,100,.1),e("ribHeight","mm",8,1,100,.1),e("ribRound1","mm",2,0,20,.1),e("ribRound2","mm",2,0,20,.1),rt("hollow",!0),e("materialHeightExt","mm",20,1,200,.5),e("materialHeightInt","mm",15,1,200,.5),e("spokeNb","scalar",5,1,18,1),e("spokeWidth","mm",15,1,200,.1),e("spokeRound","mm",10,0,20,.1),rt("wheelAxis",!0),e("wheelHeight","mm",40,.1,400,.1),e("wheelMidExtra","mm",6,0,10,.1),e("wheelAxisLength","mm",40,0,400,.1),e("wheelAxisRadius","mm",20,0,200,.1),e("wheelMidRadius","mm",60,0,200,.1),e("wheelRadiusExtra","mm",1,0,20,.1),e("wheelAxisExtRound","mm",4,0,20,.1),e("wheelAxisIntRound","mm",0,0,20,.1),e("wheelExtraRound","mm",4,0,20,.1)],paramSvg:{module:"default_param_blank.svg",N1:"default_param_blank.svg",N2:"default_param_blank.svg",angleCenterCenter:"default_param_blank.svg",addInterAxis:"default_param_blank.svg",c1x:"default_param_blank.svg",c1y:"default_param_blank.svg",ah1:"default_param_blank.svg",dh1:"default_param_blank.svg",bh1:"default_param_blank.svg",bRound1:"default_param_blank.svg",ah2:"default_param_blank.svg",dh2:"default_param_blank.svg",bh2:"default_param_blank.svg",bRound2:"default_param_blank.svg",at1:"default_param_blank.svg",at2:"default_param_blank.svg",involSym:"default_param_blank.svg",involROpt:"default_param_blank.svg",involLOpt:"default_param_blank.svg",brr1:"default_param_blank.svg",brr2:"default_param_blank.svg",blr1:"default_param_blank.svg",blr2:"default_param_blank.svg",involArcPairs1:"default_param_blank.svg",skinThickness1:"default_param_blank.svg",involArcPairs2:"default_param_blank.svg",skinThickness2:"default_param_blank.svg",initAngle1:"default_param_blank.svg",gw2Position:"default_param_blank.svg",centralAxis:"default_param_blank.svg",axisRadius:"default_param_blank.svg",ribNb:"default_param_blank.svg",ribWidth:"default_param_blank.svg",ribHeight:"default_param_blank.svg",ribRound1:"default_param_blank.svg",ribRound2:"default_param_blank.svg",hollow:"default_param_blank.svg",materialHeightExt:"default_param_blank.svg",materialHeightInt:"default_param_blank.svg",spokeNb:"default_param_blank.svg",spokeWidth:"default_param_blank.svg",spokeRound:"default_param_blank.svg",wheelAxis:"default_param_blank.svg",wheelHeight:"default_param_blank.svg",wheelMidExtra:"default_param_blank.svg",wheelAxisLength:"default_param_blank.svg",wheelAxisRadius:"default_param_blank.svg",wheelMidRadius:"default_param_blank.svg",wheelRadiusExtra:"default_param_blank.svg",wheelAxisExtRound:"default_param_blank.svg",wheelAxisIntRound:"default_param_blank.svg",wheelExtraRound:"default_param_blank.svg"},sim:{tMax:100,tStep:.5,tUpdate:500}};function Se(l,t){const s=nt(Yt.partName),n=C(),o=C();s.logstr+=`${s.partName} simTime: ${l}
|
|
22
|
+
`;try{const i=Wt(),d=Wt();i.set1ModuleToothNumber(t.module,t.N1),d.set1ModuleToothNumber(t.module,t.N2),i.set2CenterPosition(t.c1x,t.c1y);const w=Et(t.angleCenterCenter),[_,a,h]=ae(i,d,w,t.addInterAxis);d.set2CenterPosition(_,a),i.set3CircleRadius(t.ah1,t.dh1,t.bh1,t.bRound1),d.set3CircleRadius(t.ah2,t.dh2,t.bh2,t.bRound2);const[g,r,c,f]=ge(i,d,t.brr1,t.blr1,t.brr2,t.blr2,t.involSym,t.involROpt,t.involROpt);i.set4BaseCircles(g,r),d.set4BaseCircles(c,f),i.set5AddendumThickness(t.at1),d.set5AddendumThickness(t.at2);const N=Et(t.initAngle1)+l*3*i.as/100;i.set6Angles(N,w);const y=_e(i,d,N,w,h,t.gw2Position);y.prepare();for(const k of y.getContours())n.addDynamics(k);n.addPoints(y.getContactPoint()),d.set6Angles(y.getInitAngle2(),w+Math.PI),s.logstr+=y.getMsg(),i.set7InvoluteDetails(t.involArcPairs1,t.skinThickness1),d.set7InvoluteDetails(t.involArcPairs2,t.skinThickness2);for(const k of i.getRefCircles())n.addDynamics(k);for(const k of d.getRefCircles())n.addDynamics(k);n.addDynamics(i.getToothRef()),n.addDynamics(d.getToothRef());const x=i.getProfile();if(s.logstr+=i.getMsg(),s.logstr+=x.check(),n.addMain(x),t.centralAxis===1){const k=fe(i.cx,i.cy,t.axisRadius,t.ribNb,t.ribWidth,t.ribHeight,t.ribRound1,t.ribRound2,N);s.logstr+=k.check(),n.addMain(k)}if(t.hollow===1){const k=i.br,$=t.axisRadius+t.ribHeight,b=k-t.materialHeightExt,u=$+t.materialHeightInt;if(u>b)throw`err902: hollowMaterialInt ${L(u)} bigger than hollowMaterialExt ${L(b)}`;const H=Le(i.cx,i.cy,b,u,t.spokeNb,t.spokeWidth,t.spokeRound,N);for(const I of H)s.logstr+=I.check(),n.addMain(I)}const A=d.getProfile();s.logstr+=A.check(),n.addSecond(A);const S=i.ar+t.wheelRadiusExtra;if(t.wheelAxis===1){const k=qt(t.wheelHeight,t.wheelMidExtra,t.wheelAxisLength,t.wheelAxisRadius,t.wheelMidRadius,S,t.wheelAxisExtRound,t.wheelAxisIntRound,t.wheelExtraRound,!0),$=qt(t.wheelHeight,t.wheelMidExtra,t.wheelAxisLength,t.wheelAxisRadius,t.wheelMidRadius,S,t.wheelAxisExtRound,t.wheelAxisIntRound,t.wheelExtraRound,!1);o.addMain(k),o.addSecond($)}else{const k=z(0,-t.wheelHeight/2).addSegStrokeR(0,t.wheelHeight).addSegStrokeR(S,0).addSegStrokeR(0,-t.wheelHeight).closeSegStroke(),$=z(0,-t.wheelHeight/2).addSegStrokeR(0,t.wheelHeight).addSegStrokeR(-S,0).addSegStrokeR(0,-t.wheelHeight).closeSegStroke();o.addMain(k),o.addSecond($)}s.fig={teethProfile:n,axisProfile:o};const R=s.partName,D=t.wheelHeight/2+t.wheelMidExtra+t.wheelAxisLength+10;s.vol={extrudes:[{outName:`subpax_${R}_teethProfile`,face:`${R}_teethProfile`,extrudeMethod:O.eLinearOrtho,length:2*D,rotate:[0,0,0],translate:[0,0,-D]},{outName:`subpax_${R}_axisProfile`,face:`${R}_axisProfile`,extrudeMethod:O.eRotate,rotate:[0,0,0],translate:[0,0,0]}],volumes:[{outName:`pax_${R}`,boolMethod:Z.eIntersection,inList:[`subpax_${R}_teethProfile`,`subpax_${R}_axisProfile`]}]},s.logstr+=`gear_wheel_wheel drawn successfully!
|
|
23
|
+
`,s.calcErr=!1}catch(i){s.logstr+=i,console.log(i)}return s}var Vt={pTitle:"Gearwheel-gearwheel",pDescription:"Gear-system with two wheels",pDef:Yt,pGeom:Se},Xt={partName:"simplified_gear_wheel",params:[e("module","mm",10,.1,100,.1),e("N1","scalar",23,3,1e3,1),e("c1x","mm",0,-200,200,1),e("c1y","mm",0,-200,200,1),rt("centralAxis",!0),e("axisRadius","mm",10,.1,200,.1),e("ribNb","scalar",5,0,32,1),e("ribWidth","mm",8,1,100,.1),e("ribHeight","mm",8,1,100,.1),e("ribRound1","mm",2,0,20,.1),e("ribRound2","mm",2,0,20,.1),rt("hollow",!0),e("materialHeightExt","mm",20,1,200,.5),e("materialHeightInt","mm",15,1,200,.5),e("spokeNb","scalar",5,1,18,1),e("spokeWidth","mm",15,1,200,.1),e("spokeRound","mm",10,0,20,.1),rt("wheelAxis",!0),e("wheelHeight","mm",40,.1,400,.1),e("wheelMidExtra","mm",6,0,10,.1),e("wheelAxisLength","mm",40,0,400,.1),e("wheelAxisRadius","mm",20,0,200,.1),e("wheelMidRadius","mm",60,0,200,.1),e("wheelRadiusExtra","mm",1,0,20,.1),e("wheelAxisExtRound","mm",4,0,20,.1),e("wheelAxisIntRound","mm",0,0,20,.1),e("wheelExtraRound","mm",4,0,20,.1)],paramSvg:{module:"default_param_blank.svg",N1:"default_param_blank.svg",c1x:"default_param_blank.svg",c1y:"default_param_blank.svg",centralAxis:"default_param_blank.svg",axisRadius:"default_param_blank.svg",ribNb:"default_param_blank.svg",ribWidth:"default_param_blank.svg",ribHeight:"default_param_blank.svg",ribRound1:"default_param_blank.svg",ribRound2:"default_param_blank.svg",hollow:"default_param_blank.svg",materialHeightExt:"default_param_blank.svg",materialHeightInt:"default_param_blank.svg",spokeNb:"default_param_blank.svg",spokeWidth:"default_param_blank.svg",spokeRound:"default_param_blank.svg",wheelAxis:"default_param_blank.svg",wheelHeight:"default_param_blank.svg",wheelMidExtra:"default_param_blank.svg",wheelAxisLength:"default_param_blank.svg",wheelAxisRadius:"default_param_blank.svg",wheelMidRadius:"default_param_blank.svg",wheelRadiusExtra:"default_param_blank.svg",wheelAxisExtRound:"default_param_blank.svg",wheelAxisIntRound:"default_param_blank.svg",wheelExtraRound:"default_param_blank.svg"},sim:{tMax:100,tStep:.5,tUpdate:500}};function we(l,t){const s=nt(Xt.partName),n=C(),o=C();s.logstr+=`${s.partName} simTime: ${l}
|
|
24
|
+
`;try{const i=dt(Vt.pDef);i.setVal("module",t.module),i.setVal("N1",t.N1),i.setVal("c1x",t.c1x),i.setVal("c1y",t.c1y),i.setVal("centralAxis",t.centralAxis),i.setVal("axisRadius",t.axisRadius),i.setVal("ribNb",t.ribNb),i.setVal("ribWidth",t.ribWidth),i.setVal("ribHeight",t.ribHeight),i.setVal("ribRound1",t.ribRound1),i.setVal("ribRound2",t.ribRound2),i.setVal("hollow",t.hollow),i.setVal("materialHeightExt",t.materialHeightExt),i.setVal("materialHeightInt",t.materialHeightInt),i.setVal("spokeNb",t.spokeNb),i.setVal("spokeWidth",t.spokeWidth),i.setVal("spokeRound",t.spokeRound),i.setVal("wheelAxis",t.wheelAxis),i.setVal("wheelHeight",t.wheelHeight),i.setVal("wheelMidExtra",t.wheelMidExtra),i.setVal("wheelAxisLength",t.wheelAxisLength),i.setVal("wheelAxisRadius",t.wheelAxisRadius),i.setVal("wheelMidRadius",t.wheelMidRadius),i.setVal("wheelRadiusExtra",t.wheelRadiusExtra),i.setVal("wheelAxisExtRound",t.wheelAxisExtRound),i.setVal("wheelAxisIntRound",t.wheelAxisIntRound),i.setVal("wheelExtraRound",t.wheelExtraRound);const d=Vt.pGeom(l,i.getParamVal());ct(d),s.logstr+=ht(d.logstr,i.partName),n.mergeFigure(d.fig.teethProfile),o.mergeFigure(d.fig.axisProfile),s.fig={teethProfile:n,axisProfile:o};const w=s.partName;s.vol={inherits:[{outName:`inpax_${w}_gearWW`,subdesign:"pax_gear_wheel_wheel",subgeom:d,rotate:[0,0,0],translate:[0,0,0]}],extrudes:[],volumes:[{outName:`pax_${w}`,boolMethod:Z.eIdentity,inList:[`inpax_${w}_gearWW`]}]};const _={partName:i.getPartName(),dparam:i.getDesignParamList(),orientation:[0,0,0],position:[0,0,0]};s.sub={gear_wheel_wheel_1:_},s.logstr+=`simplified_gear_wheel drawn successfully!
|
|
25
|
+
`,s.calcErr=!1}catch(i){s.logstr+=i,console.log(i)}return s}var He={pTitle:"Simplified gearwheel",pDescription:"One simplified gearwheel without details on teeth-profile",pDef:Xt,pGeom:we},jt={partName:"pole_static",params:[e("D1","mm",1e3,20,4e3,1),e("D2","mm",700,10,4e3,1),e("D3","mm",800,10,4e3,1),e("H1","mm",3e3,10,4e4,10),e("H2","mm",7e3,50,4e4,10),e("E1","mm",30,1,80,1),e("E2","mm",5,1,80,1),e("N1","",32,3,100,1),e("D5","mm",40,1,100,1),e("L1","mm",45,1,300,1),e("D4","mm",600,1,1200,1),e("H3","mm",300,5,1200,1),e("H4","mm",1800,10,2500,1),e("L2","mm",30,1,100,1),e("E3","mm",40,1,100,1)],paramSvg:{D1:"pole_stator_cut.svg",D2:"pole_stator_cut.svg",D3:"pole_stator_cut.svg",H1:"pole_stator_cut.svg",H2:"pole_stator_cut.svg",E1:"pole_stator_cut.svg",E2:"pole_stator_E2.svg",N1:"pole_stator_bottom.svg",D5:"pole_stator_bottom.svg",L1:"pole_stator_bottom.svg",D4:"pole_stator_face.svg",H3:"pole_stator_face.svg",H4:"pole_stator_face.svg",L2:"pole_stator_face.svg",E3:"pole_stator_right.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function De(l,t){let s,n;const o=nt(jt.partName),i=C(),d=C(),w=C(),_=C(),a=C();o.logstr+=`${o.partName} simTime: ${l}
|
|
26
|
+
`;try{const h=t.D1/2,g=t.D2/2,r=t.D3/2;if(g>h)throw`err091: D2 ${t.D2} is larger than D1 ${t.D1}`;if(r+t.E2>h)throw`err095: D3 ${t.D3} and E2 ${t.E2} are too large compare to D1 ${t.D1}`;const c=t.H1+t.H2;o.logstr+=`pole-height: ${L(c)} mm
|
|
27
|
+
`;const f=Math.atan2(h-g,t.H2);o.logstr+=`cone-half-angle: ${L(st(f))} degree
|
|
28
|
+
`;const N=t.E2*Math.tan(f/2),y=t.H1-N;s=function(b,u){const H=z(b*h,0).addSegStrokeA(b*h,t.H1).addSegStrokeA(b*g,c).addSegStrokeR(-b*t.E2*Math.cos(f),-t.E2*Math.sin(f)).addSegStrokeA(b*(h-t.E2),y);return u?H.addSegStrokeA(b*(h-t.E2),t.E1).addSegStrokeA(b*r,t.E1).addSegStrokeA(b*r,0):H.addSegStrokeA(b*(h-t.E2),0),H.closeSegStroke(),H},i.addMain(s(1,!1)),i.addSecond(s(1,!0)),i.addSecond(s(-1,!0));const x=t.D4/2,A=t.H4-2*x;if(A<0)throw`err121: H4 ${t.H4} is too small compare to D4 ${t.D4}`;if(x-t.L2<0)throw`err121: D4 ${t.D4} is too small compare to L2 ${t.L2}`;n=function(b){const u=x-b,H=t.H3+x;return z(u,H+A).addPointR(-u,u).addSegArc(u,!1,!0).addPointR(-u,-u).addSegArc(u,!1,!0).addSegStrokeR(0,-A).addPointR(u,-u).addSegArc(u,!1,!0).addPointR(u,u).addSegArc(u,!1,!0).closeSegStroke()},d.addMain(n(0)),d.addMain(n(t.L2));const S=z(h,0).addSegStrokeA(h,t.H1).addSegStrokeA(g,c).addSegStrokeA(-g,c).addSegStrokeA(-h,t.H1).addSegStrokeA(-h,0).closeSegStroke();d.addSecond(S);const R=z(-h,t.H3).addSegStrokeR(0,t.H4).addSegStrokeR(-t.E3,0).addSegStrokeR(0,-t.H4).closeSegStroke();d.addSecond(R),w.addMain(v(0,0,h)),w.addMain(v(0,0,r));const D=r+t.L1,k=2*Math.PI/t.N1;for(let b=0;b<t.N1;b++){const u=D*Math.cos(b*k),H=D*Math.sin(b*k);w.addMain(v(u,H,t.D5/2))}w.addSecond(v(0,0,g)),w.addSecond(v(0,0,h-t.E2)),_.addMain(v(0,0,h+t.E3)),_.addMain(v(0,0,h-t.E2)),a.addMain(n(t.L2)),o.fig={poleCut:i,poleFace:d,poleBottom:w,emptyPole:_,emptyDoor:a};const $=o.partName;o.vol={extrudes:[{outName:`subpax_${$}_pole`,face:`${$}_poleCut`,extrudeMethod:O.eRotate,rotate:[0,0,0],translate:[0,0,0]},{outName:`subpax_${$}_bottom`,face:`${$}_poleBottom`,extrudeMethod:O.eLinearOrtho,length:t.E1,rotate:[0,0,0],translate:[0,0,0]},{outName:`subpax_${$}_door`,face:`${$}_poleFace`,extrudeMethod:O.eLinearOrtho,length:h+t.E3,rotate:[Math.PI/2,0,0],translate:[0,0,0]},{outName:`subpax_${$}_emptyPole`,face:`${$}_emptyPole`,extrudeMethod:O.eLinearOrtho,length:t.H1,rotate:[0,0,0],translate:[0,0,0]},{outName:`subpax_${$}_emptyDoor`,face:`${$}_emptyDoor`,extrudeMethod:O.eLinearOrtho,length:h+t.E3+10,rotate:[Math.PI/2,0,0],translate:[0,0,0]}],volumes:[{outName:`ipax_${$}_door`,boolMethod:Z.eIntersection,inList:[`subpax_${$}_door`,`subpax_${$}_emptyPole`]},{outName:`ipax_${$}_pole`,boolMethod:Z.eSubstraction,inList:[`subpax_${$}_pole`,`subpax_${$}_emptyDoor`]},{outName:`pax_${$}`,boolMethod:Z.eUnion,inList:[`ipax_${$}_pole`,`subpax_${$}_bottom`,`ipax_${$}_door`]}]},o.sub={},o.logstr+=`pole_static drawn successfully!
|
|
29
|
+
`,o.calcErr=!1}catch(h){o.logstr+=h,console.log(h)}return o}var Dt={pTitle:"Heliostat pole static",pDescription:"The vertical pole of an heliostat",pDef:jt,pGeom:De},Zt={partName:"rake",params:[e("D1","mm",600,10,4e3,10),e("D2","mm",400,10,4e3,10),e("D3","mm",400,10,4e3,10),e("H1","mm",800,1,4e3,10),e("H2","mm",3e3,20,6e3,10),e("H3","mm",400,0,4e3,10),e("E1","mm",20,1,80,1),e("E3","mm",30,1,80,1),e("H4","mm",400,10,1e3,10),e("D4","mm",300,10,1e3,10),e("E4","mm",20,1,80,1),e("H5","mm",1e3,10,2e3,10),e("D5","mm",200,1,1e3,10),e("L4","mm",300,1,1e3,10),e("L5","mm",2e3,10,4e3,10),e("L6","mm",2e3,1,4e3,10),e("D6","mm",100,1,600,10),e("E6","mm",10,1,80,1),e("L7","mm",100,1,1e3,1),e("L8","mm",200,1,1e3,1),e("N1","",24,3,100,1),e("D7","mm",40,1,100,1),e("L1","mm",30,1,300,1),e("D8","mm",400,1,1e3,10),e("H6","mm",100,1,1e3,10),e("H7","mm",600,10,2e3,10),e("L9","mm",300,1,1e3,10),e("R9","mm",50,0,300,1)],paramSvg:{D1:"rake_face.svg",D2:"rake_face.svg",D3:"rake_face.svg",H1:"rake_face.svg",H2:"rake_face.svg",H3:"rake_face.svg",E1:"rake_face.svg",E3:"rake_face.svg",H4:"rake_side.svg",D4:"rake_side.svg",E4:"rake_side.svg",H5:"rake_side.svg",D5:"rake_side.svg",L4:"rake_face.svg",L5:"rake_face.svg",L6:"rake_face.svg",D6:"rake_face.svg",E6:"rake_face.svg",L7:"rake_face.svg",L8:"rake_face.svg",N1:"rake_top.svg",D7:"rake_top.svg",L1:"rake_top.svg",D8:"rake_side.svg",H6:"rake_door.svg",H7:"rake_door.svg",L9:"rake_door.svg",R9:"rake_door.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function be(l,t){let s,n,o;const i=nt(Zt.partName),d=C(),w=C(),_=C(),a=C(),h=C(),g=C(),r=C(),c=C();i.logstr+=`${i.partName} simTime: ${l}
|
|
30
|
+
`;try{const f=t.D1/2,N=t.D2/2,y=t.D3/2,x=t.D4/2,A=t.D5/2,S=t.D6/2,R=t.D7/2,D=t.D8/2,k=t.H1+t.H2,$=k-t.H4+t.H5;if(i.logstr+=`cone-height: ${L(k)} mm
|
|
31
|
+
`,i.logstr+=`cone-height total: ${L($)} mm
|
|
32
|
+
`,t.D2>t.D1)throw`err110: D2 ${t.D2} is larger than D1 ${t.D1}`;if(t.D3+t.E1>t.D1)throw`err113: D3 ${t.D3} is too large compare to D1 ${t.D1} and E1 ${t.E1}`;if(t.H3+t.E3>t.H1)throw`err116: H3 ${t.H3} is too large compare to H1 ${t.H1} and E3 ${t.E3}`;if(t.H4+x>t.H2)throw`err119: H4 ${t.H4} is too large compare to H2 ${t.H2} and D4 ${t.D4}`;if(t.E4>x)throw`err122: E4 ${t.E4} is too large compare to D4 ${t.D4}`;if(t.D8<=t.D5)throw`err146: D8 ${t.D8} is too small compare to D5 ${t.D5}`;const b=4*t.L4+t.L5+2*t.L6,u=t.H1+t.H2-t.H4,H=x*Math.cos(Math.PI/6),I=x*Math.sin(Math.PI/6),M=A*Math.cos(Math.PI/6),B=A*Math.sin(Math.PI/6),T=D*Math.cos(Math.PI/6),F=D*Math.sin(Math.PI/6),p=[-b/2,-t.L5/2-t.L4,t.L5/2,b/2-t.L4],W=t.H2-t.L8-t.H4-x;if(W<0)throw`err140: H2 ${t.H2} too small compare to L8 ${t.L8}, H4 ${t.H4} and D4 ${t.D4}`;const X=Math.atan2(f-N,t.H2);i.logstr+=`cone-angle: ${L(st(X))} degree
|
|
33
|
+
`;const K=b/2-t.L7-f+t.L8*Math.tan(X),it=Math.sqrt(K**2+W**2),q=Math.atan2(K,W);i.logstr+=`wing-angle: ${L(st(q))} degree
|
|
34
|
+
`;const Q=t.E1/Math.sin(q+X),m=it+t.E4/Math.cos(q)+Q,E=f-t.L8*Math.tan(X)-Q*Math.sin(q),P=t.H1+t.L8-Q*Math.cos(q),j=E-S*Math.cos(q),G=P+S*Math.sin(q),J=S-t.E6,ot=E-t.E6*Math.cos(q),lt=P+t.E6*Math.sin(q),ut=Math.PI/2-q,Lt=t.L9/2,_t=Lt-t.H7*Math.tan(X);if(_t<t.R9)throw`err177: R9 ${t.R9} too large compare to doorHighX ${_t} and L9 ${t.L9}`;if(t.L9>t.D1)throw`err180: L9 ${t.L9} too large compare to D1 ${t.D1}`;const Ht=t.E1*Math.cos(X),Pt=t.E1*Math.sin(X),mt=t.E1*Math.tan(X/2);s=function(Y){return z(Y*f,0).addSegStrokeA(Y*f,t.H1).addSegStrokeA(Y*N,k).addSegStrokeA(Y*(N-Ht),k-Pt).addSegStrokeA(Y*(f-t.E1),t.H1-mt).addSegStrokeA(Y*(f-t.E1),0).closeSegStroke()},n=function(Y){return z(Y*f,0).addSegStrokeA(Y*f,t.H1).addSegStrokeA(Y*N,k).addSegStrokeA(Y*(N-Ht),k-Pt).addSegStrokeA(Y*(f-t.E1),t.H1-mt).addSegStrokeA(Y*(f-t.E1),t.H1-t.H3).addSegStrokeA(Y*y,t.H1-t.H3).addSegStrokeA(Y*y,t.H1-t.H3-t.E3).addSegStrokeA(Y*(f-t.E1),t.H1-t.H3-t.E3).addSegStrokeA(Y*(f-t.E1),0).closeSegStroke()},o=function(Y,at,ft,vt,Mt){const Bt=Y*Math.cos(Mt),Ut=Y*Math.sin(Mt),Gt=-at*Math.sin(Mt),pt=at*Math.cos(Mt);return z(ft,vt).addSegStrokeA(ft+Bt,vt+Ut).addSegStrokeA(ft+Bt+Gt,vt+Ut+pt).addSegStrokeA(ft+Gt,vt+pt).closeSegStroke()};const At=z(Lt,t.H1+t.H6).addCornerRounded(t.R9).addSegStrokeA(_t,t.H1+t.H6+t.H7).addCornerRounded(t.R9).addSegStrokeA(-_t,t.H1+t.H6+t.H7).addCornerRounded(t.R9).addSegStrokeA(-Lt,t.H1+t.H6).addCornerRounded(t.R9).closeSegStroke();d.addMain(s(1)),d.addSecond(n(1)),d.addSecond(n(-1)),d.addSecond(o(b,t.D4,-b/2,u-x,0)),d.addSecond(o(b,t.D4-2*t.E4,-b/2,u-x+t.E4,0));for(const Y of p)d.addSecond(o(t.L4,t.H5-I-B,Y,u+I,0));d.addSecond(o(m,2*S,E,P,ut)),d.addSecond(o(m,2*J,ot,lt,ut)),d.addSecond(o(2*S,m,-E,P,q)),d.addSecond(o(2*J,m,-ot,lt,q)),d.addSecond(At);const Rt=z(H,u+I).addSegStrokeA(T,u+t.H5-F).addSegStrokeA(M,u+t.H5-B).addPointA(-M,u+t.H5-B).addSegArc(A,!1,!1).addSegStrokeA(-T,u+t.H5-F).addSegStrokeA(-H,u+I).closeSegArc(x,!1,!1);w.addMain(v(0,u,x)),w.addMain(v(0,u,x-t.E4)),w.addSecond(n(1)),w.addSecond(n(-1)),w.addSecond(Rt),w.addSecond(v(0,u+t.H5,A)),w.addSecond(o(2*S,W,-S,t.H1+t.L8,0)),w.addSecond(o(2*J,W,-J,t.H1+t.L8,0)),w.addSecond(At),_.addMain(v(0,u,x-t.E4)),_.addSecond(v(0,u,x)),_.addSecond(Rt),a.addMain(v(0,0,f)),a.addMain(v(0,0,y));const Ot=y+t.L1,zt=2*Math.PI/t.N1;for(let Y=0;Y<t.N1;Y++){const at=Ot*Math.cos(Y*zt),ft=Ot*Math.sin(Y*zt);a.addMain(v(at,ft,R))}a.addSecond(v(0,0,f-t.E1)),a.addSecond(v(0,0,N)),a.addSecond(o(t.D4,b,-x,-b/2,0)),a.addSecond(o(t.D4-2*t.E4,b,-x+t.E4,-b/2,0));for(const Y of p)a.addSecond(o(2*H,t.L4,-H,Y,0)),a.addSecond(o(2*M,t.L4,-M,Y,0)),a.addSecond(o(2*T,t.L4,-T,Y,0));a.addSecond(o(2*S,K,-S,f-t.L8*Math.tan(X),0)),a.addSecond(o(2*J,K,-J,f-t.L8*Math.tan(X),0)),a.addSecond(o(2*S,K,-S,-f+t.L8*Math.tan(X)-K,0)),a.addSecond(o(2*J,K,-J,-f+t.L8*Math.tan(X)-K,0)),h.addMain(Rt),h.addSecond(v(0,u,x)),h.addSecond(v(0,u,x-t.E4)),h.addSecond(v(0,u+t.H5,A)),g.addMain(v(0,0,S)),g.addMain(v(0,0,J)),r.addSecond(v(0,0,S)),r.addMain(v(0,0,J)),c.addMain(At),c.addSecond(n(1)),c.addSecond(n(-1)),c.addSecond(o(b,t.D4,-b/2,u-x,0)),c.addSecond(o(b,t.D4-2*t.E4,-b/2,u-x+t.E4,0));for(const Y of p)c.addSecond(o(t.L4,t.H5-I-B,Y,u+I,0));c.addSecond(o(m,2*S,E,P,ut)),c.addSecond(o(m,2*J,ot,lt,ut)),c.addSecond(o(2*S,m,-E,P,q)),c.addSecond(o(2*J,m,-ot,lt,q)),i.fig={faceCone:d,faceBeam:w,faceBeamHollow:_,faceDisc:a,faceHand:h,faceWing:g,faceWingHollow:r,faceDoor:c};const U=i.partName,ne=p.map((Y,at)=>({outName:`subpax_${U}_hand_${at}`,face:`${U}_faceHand`,extrudeMethod:O.eLinearOrtho,length:t.L4,rotate:[Math.PI/2,0,0],translate:[0,-Y,0]}));i.vol={extrudes:[{outName:`subpax_${U}_cone`,face:`${U}_faceCone`,extrudeMethod:O.eRotate,rotate:[0,0,0],translate:[0,0,0]},{outName:`subpax_${U}_beam`,face:`${U}_faceBeam`,extrudeMethod:O.eLinearOrtho,length:b,rotate:[Math.PI/2,0,0],translate:[0,b/2,0]},{outName:`subpax_${U}_beamHollow`,face:`${U}_faceBeamHollow`,extrudeMethod:O.eLinearOrtho,length:b,rotate:[Math.PI/2,0,0],translate:[0,b/2,0]},{outName:`subpax_${U}_disc`,face:`${U}_faceDisc`,extrudeMethod:O.eLinearOrtho,length:t.E3,rotate:[0,0,0],translate:[0,0,t.H1-t.H3-t.E3]},{outName:`subpax_${U}_wing_right`,face:`${U}_faceWing`,extrudeMethod:O.eLinearOrtho,length:m,rotate:[-q,0,0],translate:[0,j,G]},{outName:`subpax_${U}_wing_left`,face:`${U}_faceWing`,extrudeMethod:O.eLinearOrtho,length:m,rotate:[q,0,0],translate:[0,-j,G]},{outName:`subpax_${U}_wing_hollow_right`,face:`${U}_faceWingHollow`,extrudeMethod:O.eLinearOrtho,length:m,rotate:[-q,0,0],translate:[0,j,G]},{outName:`subpax_${U}_wing_hollow_left`,face:`${U}_faceWingHollow`,extrudeMethod:O.eLinearOrtho,length:m,rotate:[q,0,0],translate:[0,-j,G]},{outName:`subpax_${U}_door`,face:`${U}_faceDoor`,extrudeMethod:O.eLinearOrtho,length:t.D1,rotate:[Math.PI/2,0,Math.PI/2],translate:[0,0,0]},...ne],volumes:[{outName:`ipax_${U}_plus`,boolMethod:Z.eUnion,inList:[`subpax_${U}_cone`,`subpax_${U}_beam`,`subpax_${U}_disc`,`subpax_${U}_hand_0`,`subpax_${U}_hand_1`,`subpax_${U}_hand_2`,`subpax_${U}_hand_3`,`subpax_${U}_wing_right`,`subpax_${U}_wing_left`]},{outName:`ipax_${U}_hollow`,boolMethod:Z.eUnion,inList:[`subpax_${U}_beamHollow`,`subpax_${U}_wing_hollow_right`,`subpax_${U}_wing_hollow_left`,`subpax_${U}_door`]},{outName:`pax_${U}`,boolMethod:Z.eSubstraction,inList:[`ipax_${U}_plus`,`ipax_${U}_hollow`]}]},i.sub={},i.logstr+=`heliostat-rake drawn successfully!
|
|
35
|
+
`,i.calcErr=!1}catch(f){i.logstr+=f,console.log(f)}return i}var bt={pTitle:"Heliostat rake",pDescription:"The rake on top of the pole-rotor of the heliostat",pDef:Zt,pGeom:be},Ct={partName:"spider",params:[e("D1","mm",100,1,400,1),e("L1","mm",400,1,1e3,1),e("L2","mm",400,1,1e3,1),e("L3","mm",100,1,400,1),e("L4","mm",3e3,10,8e3,10),e("L5","mm",2e3,1,8e3,1),e("L6","mm",30,1,100,1),e("E1","mm",3,1,80,1),e("E2","mm",50,1,200,1),e("E3","mm",3,1,80,1),e("R2","mm",100,0,400,10),e("N1","",6,1,20,1)],paramSvg:{D1:"spider_profile.svg",L1:"spider_profile.svg",L2:"spider_profile.svg",L3:"spider_profile.svg",L4:"spider_profile.svg",L5:"spider_lateral.svg",L6:"spider_lateral.svg",E1:"spider_profile.svg",E2:"spider_profile.svg",E3:"spider_profile.svg",R2:"spider_profile.svg",N1:"spider_lateral.svg"},sim:{tMax:360,tStep:.5,tUpdate:500}};function $e(l,t){let s,n;const o=nt(Ct.partName),i=C(),d=C(),w=C();o.logstr+=`${o.partName} simTime: ${l}
|
|
36
|
+
`;try{const _=t.D1/2;if(t.D1<t.E2)throw`err476: D1 ${t.D1} smaller then E2 ${t.E2}`;const a=t.E2/2,h=Math.sqrt(_**2-a**2),g=t.L1+t.L2*Math.sqrt(2),r=t.L2+t.L1*Math.sqrt(2),c=t.L4-r;if(c<t.R2)throw`err984: L4 ${t.L4} too small compare to R2 ${t.R2}`;const f=c*Math.cos(Math.PI/4),N=c*Math.sin(Math.PI/4),y=t.E2*Math.cos(Math.PI/4),x=t.E2*Math.sin(Math.PI/4),A=t.E2*Math.tan(Math.PI/8);if(_<t.E1)throw`err092: D1 ${t.D1} too small compare to E1 ${t.E1}`;if(t.L3<t.E2)throw`err994: L3 ${t.L3} smaller than E2 ${t.E2}`;if(t.L3<2*t.E3)throw`err997: L3 ${t.L3} too small compare to E3 ${t.E3}`;const S=(t.L3-t.E2)/2*Math.cos(Math.PI/4),R=g+f+S,D=-t.L1-N+S,k=D-t.E3*Math.sqrt(2);if(t.L5<t.N1*t.L6)throw`err110: L5 ${t.L5} too small compare to N1 ${t.N1} and L6 ${t.L6}`;let $=1;t.N1>1&&($=(t.L5-t.L6)/(t.N1-1));const b=[...Array(t.N1).keys()].map(T=>T*$);s=function(T,F,p){return z(T,F).addSegStrokeA(T+p*Math.cos(Math.PI/4),F-p*Math.sin(Math.PI/4)).addSegStrokeA(T,F-2*p*Math.sin(Math.PI/4)).addSegStrokeA(T-p*Math.cos(Math.PI/4),F-p*Math.sin(Math.PI/4)).closeSegStroke()},n=function(T,F,p,W){return z(p,W).addSegStrokeA(p+T,W).addSegStrokeA(p+T,W+F).addSegStrokeA(p,W+F).closeSegStroke()};const u=Math.sin(2*Math.PI*l/Ct.sim.tMax)*Math.PI/2;o.logstr+=`spide leg number: ${t.N1}
|
|
37
|
+
`,o.logstr+=`spide position angle: ${L(st(u))} degree
|
|
38
|
+
`;const H=z(a,-h).addCornerRounded(t.R2).addSegStrokeA(a,-t.L1).addCornerRounded(t.R2).addSegStrokeA(g,-t.L1).addCornerRounded(t.R2+t.E2).addSegStrokeA(g+f,-t.L1-N).addSegStrokeA(g+f-y,-t.L1-N-x).addSegStrokeA(g-A,-t.L1-t.E2).addCornerRounded(t.R2).addSegStrokeA(-g+A,-t.L1-t.E2).addCornerRounded(t.R2).addSegStrokeA(-g-f+y,-t.L1-N-x).addSegStrokeA(-g-f,-t.L1-N).addSegStrokeA(-g,-t.L1).addCornerRounded(t.R2+t.E2).addSegStrokeA(-a,-t.L1).addCornerRounded(t.R2).addSegStrokeA(-a,-h).addCornerRounded(t.R2).closeSegArc(_,!0,!1);i.addMain(H),i.addMain(v(0,0,_-t.E1)),i.addSecond(s(R,D,t.L3)),i.addSecond(s(R,k,t.L3-2*t.E3)),i.addSecond(s(-R,D,t.L3)),i.addSecond(s(-R,k,t.L3-2*t.E3)),d.addMain(v(0,0,_)),d.addMain(v(0,0,_-t.E1)),d.addMain(s(R,D,t.L3)),d.addMain(s(R,k,t.L3-2*t.E3)),d.addMain(s(-R,D,t.L3)),d.addMain(s(-R,k,t.L3-2*t.E3)),d.addSecond(H),w.addSecond(n(t.L5,t.D1,0,-t.D1/2)),w.addSecond(n(t.L5,t.L3,0,-t.L4-t.L3));for(const T of b)w.addSecond(n(t.L6,t.L4,T,-t.L4));o.fig={faceLegs:i.rotate(0,0,u),faceTube:d.rotate(0,0,u),faceBody:w};const I=o.partName,M=b.map((T,F)=>({outName:`subpax_${I}_leg_${F}`,face:`${I}_faceLegs`,extrudeMethod:O.eLinearOrtho,length:t.L6,rotate:[0,0,0],translate:[0,0,T]})),B=b.map((T,F)=>`subpax_${I}_leg_${F}`);o.vol={extrudes:[{outName:`subpax_${I}_tube`,face:`${I}_faceTube`,extrudeMethod:O.eLinearOrtho,length:t.L5,rotate:[0,0,0],translate:[0,0,0]},...M],volumes:[{outName:`pax_${I}`,boolMethod:Z.eUnion,inList:[`subpax_${I}_tube`,...B]}]},o.sub={},o.logstr+=`heliostat-spider drawn successfully!
|
|
39
|
+
`,o.calcErr=!1}catch(_){o.logstr+=_,console.log(_)}return o}var It={pTitle:"Heliostat spider",pDescription:"The spider part for the control of the inclination of the heliostat",pDef:Ct,pGeom:$e},Jt={partName:"swing",params:[e("L1","mm",12500,100,4e4,10),e("L2","mm",6e3,100,4e4,10),e("L3","mm",500,1,4e3,1),e("L4","mm",600,1,4e3,1),e("L5","mm",2e3,1,1e4,1),e("L6","mm",2e3,1,1e4,1),e("D1","mm",400,1,1e3,1),e("H1","mm",100,1,400,1),e("H2","mm",100,1,400,1),e("H3","mm",100,1,400,1),e("H4","mm",100,1,400,1),e("E1","mm",5,1,80,1),e("E2","mm",3,1,80,1),e("E3","mm",3,1,80,1),e("rod1","",10,1,40,1),e("rod2","mm",1300,10,4e3,10),e("rod3","mm",400,10,1e3,10),e("rod4","mm",100,1,400,1)],paramSvg:{L1:"swing_top.svg",L2:"swing_top.svg",L3:"swing_top.svg",L4:"swing_top.svg",L5:"swing_top.svg",L6:"swing_top.svg",D1:"swing_top.svg",H1:"swing_top.svg",H2:"swing_top.svg",H3:"swing_side.svg",H4:"swing_side.svg",E1:"swing_side.svg",E2:"swing_side.svg",E3:"swing_face.svg",rod1:"swing_with_rod.svg",rod2:"swing_with_rod.svg",rod3:"swing_with_rod.svg",rod4:"swing_with_rod.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function ve(l,t){let s,n;const o=nt(Jt.partName),i=C(),d=C(),w=C(),_=C();o.logstr+=`${o.partName} simTime: ${l}
|
|
40
|
+
`;try{const a=t.D1/2;o.logstr+=`swing size: L1 ${L(t.L1)} x L2 ${L(t.L2)} mm
|
|
41
|
+
`,s=function(S,R,D,k){return z(S,R).addSegStrokeA(S+D,R).addSegStrokeA(S+D,R+k).addSegStrokeA(S,R+k).closeSegStroke()},n=function(S,R,D,k,$){return z(S,R).addCornerRounded($).addSegStrokeA(S+D,R).addCornerRounded($).addSegStrokeA(S+D,R+k).addCornerRounded($).addSegStrokeA(S,R+k).addCornerRounded($).closeSegStroke()},i.addMain(v(0,0,a)),i.addMain(v(0,0,a-t.E1));const h=[-t.L2/2,-t.L3-t.H2,t.L3,t.L2/2-t.H2];for(const S of h)i.addMain(s(S,a-t.H4,t.H2,t.H4)),i.addMain(s(S+t.E2,a-t.H4+t.E2,t.H2-2*t.E2,t.H4-2*t.E2));i.addSecond(s(-t.L2/2,a,t.L2,t.H3));const g=[];g.push(-t.L1/2),g.push(t.L1/2-t.H1);for(const S of[-t.L5/2-2*t.L4-t.L6,-t.L5/2-t.L4,t.L5/2,t.L5/2+t.L4+t.L6])for(const R of[0,t.L4-t.H1])g.push(S+R);for(const S of g)d.addMain(s(S,a,t.H1,t.H3)),d.addMain(s(S+t.E3,a+t.E3,t.H1-2*t.E3,t.H3-2*t.E3));d.addSecond(s(-t.L1/2,-a,t.L1,t.D1)),d.addSecond(s(-t.L1/2,a-t.H4,t.L1,t.H4));for(const S of g)w.addSecond(s(S,-t.L2/2,t.H1,t.L2));for(const S of h)w.addSecond(s(-t.L1/2,S,t.L1,t.H2));w.addSecond(s(-t.L1/2,-a,t.L1,t.D1));for(const S of g)_.addMain(s(S,-t.L2/2,t.H1,t.L2));for(const S of h)_.addMain(s(-t.L1/2,S,t.L1,t.H2));_.addMain(s(-t.L1/2,-a,t.L1,t.D1));const r=-((t.rod1-1)*t.rod2+t.rod3)/2,c=(t.rod3-t.rod4)/2,f=t.rod3/2,N=1.2*t.L2,y=(N-f)/3,x=-N/2;for(let S=0;S<t.rod1;S++){const R=r+S*t.rod2;_.addSecond(s(R+c,x,t.rod4,N));for(let D=0;D<4;D++)_.addSecond(n(R,x+D*y,t.rod3,f,f/4))}o.fig={faceSide:i,faceFace:d,faceTop:w,faceTopWithRods:_};const A=o.partName;o.vol={extrudes:[{outName:`subpax_${A}_side`,face:`${A}_faceSide`,extrudeMethod:O.eLinearOrtho,length:t.L1,rotate:[0,0,0],translate:[0,0,-t.L1/2]},{outName:`subpax_${A}_face`,face:`${A}_faceFace`,extrudeMethod:O.eLinearOrtho,length:t.L2,rotate:[0,Math.PI/2,0],translate:[-t.L2/2,0,0]}],volumes:[{outName:`pax_${A}`,boolMethod:Z.eUnion,inList:[`subpax_${A}_side`,`subpax_${A}_face`]}]},o.sub={},o.logstr+=`heliostat-swing drawn successfully!
|
|
42
|
+
`,o.calcErr=!1}catch(a){o.logstr+=a,console.log(a)}return o}var $t={pTitle:"Heliostat swing",pDescription:"The swing for the heliostat inclination",pDef:Jt,pGeom:ve},Ft={partName:"heliostat",params:[e("H1","mm",3e3,10,4e4,10),e("H2","mm",2500,50,4e4,10),e("H3","mm",200,1,500,1),e("H4","mm",800,1,4e3,1),e("H5","mm",3e3,50,6e3,10),e("H6","mm",200,1,4e3,1),e("H7","mm",800,1,4e3,1),e("H8","mm",200,1,4e3,1),e("H9","mm",100,1,400,1),e("D1","mm",1e3,20,4e3,10),e("D2","mm",700,20,4e3,10),e("D3","mm",900,20,4e3,10),e("D4","mm",400,20,4e3,10),e("D5","mm",300,20,1e3,10),e("D6","mm",200,10,1e3,10),e("D7","mm",400,10,1e3,10),e("D8","mm",100,1,1e3,1),e("D9","mm",100,1,1e3,1),e("S1","mm",250,1,800,1),e("S2","mm",200,1,800,1),e("E1","mm",30,1,80,1),e("E2","mm",50,1,80,1),e("L1","mm",12500,100,4e4,10),e("L2","mm",6e3,100,4e4,10),e("L3","mm",100,1,500,1),e("L4","mm",600,1,4e3,1),e("L5","mm",2e3,10,6e3,1),e("L6","mm",2e3,1,6e3,1),e("L7","mm",100,1,1e3,1),e("L8","mm",200,1,1e3,1),e("al","degree",80,0,95,1),e("ar","degree",80,0,95,1)],paramSvg:{H1:"heliostat_overview.svg",H2:"heliostat_side.svg",H3:"heliostat_side_sizing.svg",H4:"heliostat_side_sizing.svg",H5:"heliostat_side_sizing.svg",H6:"heliostat_side_sizing.svg",H7:"heliostat_side_sizing.svg",H8:"heliostat_side_sizing.svg",H9:"heliostat_side_sizing.svg",D1:"heliostat_side_sizing.svg",D2:"heliostat_side_sizing.svg",D3:"heliostat_side_sizing.svg",D4:"heliostat_side_sizing.svg",D5:"heliostat_side_sizing.svg",D6:"heliostat_side_sizing.svg",D7:"heliostat_side_sizing.svg",D8:"heliostat_side_sizing.svg",D9:"heliostat_face_sizing.svg",S1:"heliostat_side_sizing.svg",S2:"heliostat_side_sizing.svg",E1:"heliostat_side_sizing.svg",E2:"heliostat_side_sizing.svg",L1:"heliostat_face_sizing.svg",L2:"heliostat_side_sizing.svg",L3:"heliostat_face_sizing.svg",L4:"heliostat_face_sizing.svg",L5:"heliostat_face_sizing.svg",L6:"heliostat_face_sizing.svg",L7:"heliostat_face_sizing.svg",L8:"heliostat_face_sizing.svg",al:"heliostat_side_sizing.svg",ar:"heliostat_side_sizing.svg"},sim:{tMax:100,tStep:.5,tUpdate:500}};function Me(l,t){const s=nt(Ft.partName),n=C(),o=C();s.logstr+=`${s.partName} simTime: ${l}
|
|
43
|
+
`;try{const i=t.H1+t.H2-t.H3+t.H4+t.H5-t.H6+t.H7;s.logstr+=`heliostat-height: ${L(i)}, diameter ${L(t.D1)} m
|
|
44
|
+
`,s.logstr+=`heliostat-swing-length: ${L(t.L1)}, width ${L(t.L2)} m
|
|
45
|
+
`;const w=(t.al-t.ar)/2-Math.sin(2*Math.PI*l/Ft.sim.tMax)*(t.al+t.ar)/2,_=Et(w);s.logstr+=`swing position angle: ${L(st(_))} degree
|
|
46
|
+
`;const a=t.H1+t.H2-t.H3,h=a+t.H4+t.H5-t.H6+t.H7,g=h+t.H8,r=dt(Dt.pDef),c=dt(bt.pDef),f=dt(It.pDef),N=dt($t.pDef);r.setVal("H1",t.H1),r.setVal("H2",t.H2),r.setVal("D1",t.D1),r.setVal("D2",t.D2),r.setVal("D3",t.D1-6*t.E1),r.setVal("E1",t.E1),r.setVal("E2",t.E1);const y=32,x=(t.D1-6*t.E1)/(y*4);r.setVal("N1",y),r.setVal("D5",x),r.setVal("L1",t.E1+x/2),r.setVal("H3",t.H1/4),r.setVal("H4",t.H1/2),r.setVal("D4",t.H1/4),r.setVal("L2",t.H1/80),r.setVal("E3",t.H1/80),c.setVal("H1",t.H4),c.setVal("H2",t.H5),c.setVal("H3",t.H4-2*t.E1),c.setVal("D1",t.D3),c.setVal("D2",t.D4),c.setVal("L9",t.D3/2),c.setVal("H7",t.D3/2*1.6),c.setVal("H6",t.D3/20),c.setVal("R9",t.D3/20),c.setVal("E1",t.E1),c.setVal("E3",t.E1),c.setVal("E4",t.E1);const A=t.D2*.6,S=24,R=A/(S*4);if(c.setVal("D3",A),t.D2>t.D3-2*t.E1)throw`err153: D2 ${t.D2} too large compare to D3 ${t.D3} and E1 ${t.E1}`;if(c.setVal("N1",S),c.setVal("D7",R),c.setVal("L1",R),c.setVal("H4",t.H6),c.setVal("D4",t.D5),c.setVal("L7",t.L7),c.setVal("L8",t.L8),c.setVal("D6",t.D9),c.setVal("H5",t.H7+t.H8),c.setVal("D5",t.D6),c.setVal("D8",t.D7),t.D6>=t.D7)throw`err164: D6 ${t.D6} too large compare to D7 ${t.D7}`;const D=t.L4-2*t.L3;if(c.setVal("L4",D),D<=0)throw`err169: L3 ${t.L3} too large compare to L4 ${t.L4}`;c.setVal("L5",t.L5+2*t.L3),c.setVal("L6",t.L6+2*t.L3);const k=t.L5*.96,$=6;if(f.setVal("L5",k),f.setVal("D1",t.D8),f.setVal("L1",t.S1),f.setVal("L2",t.S2),f.setVal("L3",t.E2*2),f.setVal("E1",t.E1),f.setVal("E2",t.E2),f.setVal("E3",t.E1),f.setVal("L4",t.L2/2-t.H8),f.setVal("R2",0),f.setVal("N1",$),f.setVal("L6",k/($*10)),N.setVal("L2",t.L2),N.setVal("D1",t.D6),N.setVal("H3",t.H9),N.setVal("H4",t.H9),N.setVal("L1",t.L1),t.L1<4*t.L4+2*t.L6+t.L5+2*t.L3)throw`err185: L1 ${t.L1} too small compare to L4 ${t.L4}, L5 ${t.L5}, L6 ${t.L6}`;N.setVal("H1",t.L3),N.setVal("H2",t.L3),N.setVal("L4",t.L4),N.setVal("L5",t.L5),N.setVal("L6",t.L6),N.setVal("L3",t.D7);const b=Dt.pGeom(0,r.getParamVal());ct(b),s.logstr+=ht(b.logstr,r.partName);const u=bt.pGeom(0,c.getParamVal());ct(u),s.logstr+=ht(u.logstr,c.partName);const H=It.pGeom(0,f.getParamVal());ct(H),s.logstr+=ht(H.logstr,f.partName);const I=$t.pGeom(0,N.getParamVal());ct(I),s.logstr+=ht(I.logstr,N.partName),n.mergeFigure(b.fig.poleCut),n.mergeFigure(u.fig.faceBeam.translate(0,a)),n.mergeFigure(H.fig.faceLegs.translate(0,h).rotate(0,h,_/2)),n.mergeFigure(I.fig.faceSide.translate(0,g).rotate(0,g,_)),o.mergeFigure(b.fig.poleCut),o.mergeFigure(u.fig.faceCone.translate(0,a)),o.mergeFigure(H.fig.faceBody.translate(-k/2,h)),o.mergeFigure(I.fig.faceFace.translate(0,g)),s.fig={faceSide:n,faceFace:o};const M=s.partName;s.vol={inherits:[{outName:`inpax_${M}_poleStatic`,subdesign:"pax_pole_static",subgeom:b,rotate:[0,0,0],translate:[0,0,0]},{outName:`inpax_${M}_rake`,subdesign:"pax_rake",subgeom:u,rotate:[0,0,0],translate:[0,0,a]},{outName:`inpax_${M}_swing`,subdesign:"pax_swing",subgeom:I,rotate:[Math.PI/2,0,0],translate:[0,0,g]},{outName:`inpax_${M}_spider`,subdesign:"pax_spider",subgeom:H,rotate:[Math.PI/2,0,0],translate:[0,k/2,h]}],extrudes:[],volumes:[{outName:`pax_${M}`,boolMethod:Z.eUnion,inList:[`inpax_${M}_poleStatic`,`inpax_${M}_rake`,`inpax_${M}_swing`,`inpax_${M}_spider`]}]};const B={partName:r.getPartName(),dparam:r.getDesignParamList(),orientation:[0,0,0],position:[0,0,0]},T={partName:c.getPartName(),dparam:c.getDesignParamList(),orientation:[0,0,0],position:[0,0,a]},F={partName:f.getPartName(),dparam:f.getDesignParamList(),orientation:[Math.PI/2,0,0],position:[0,k/2,h]},p={partName:N.getPartName(),dparam:N.getDesignParamList(),orientation:[Math.PI/2,0,0],position:[0,0,g]};s.sub={pole_static_1:B,rake_1:T,spider_1:F,swing_1:p},s.logstr+=`heliostat-overview drawn successfully!
|
|
47
|
+
`,s.calcErr=!1}catch(i){s.logstr+=i,console.log(i)}return s}var xe={pTitle:"Heliostat overview",pDescription:"The heliostat inclination mechanism",pDef:Ft,pGeom:Me},Kt={partName:"rake_stopper",params:[e("D1","mm",600,10,4e3,10),e("D2","mm",400,10,4e3,10),e("D3","mm",400,1,4e3,1),e("H1","mm",800,1,4e3,1),e("H2","mm",3e3,20,6e3,10),e("H3","mm",400,0,4e3,1),e("E1","mm",20,1,80,1),e("E3","mm",30,1,80,1),e("H4","mm",200,1,1e3,1),e("D4","mm",300,1,1e3,1),e("E4","mm",20,1,80,1),e("H5","mm",400,1,2e3,1),e("D5","mm",200,1,1e3,1),e("L4","mm",300,1,1e3,1),e("L5","mm",2e3,1,4e3,1),e("L6","mm",2e3,1,4e3,1),e("D6","mm",100,1,600,1),e("E6","mm",10,1,80,1),e("L7","mm",100,1,1e3,1),e("L8","mm",200,1,1e3,1),e("N1","",24,3,100,1),e("D7","mm",40,1,100,1),e("L1","mm",30,1,300,1),e("D8","mm",400,1,1e3,1),e("H6","mm",100,1,1e3,1),e("H7","mm",600,1,2e3,1),e("L9","mm",300,1,1e3,1),e("R9","mm",50,0,300,1),e("S1","mm",100,1,300,1),e("S2","mm",2e3,1,8e3,1),e("E7","mm",5,1,80,1)],paramSvg:{D1:"rake_face.svg",D2:"rake_face.svg",D3:"rake_face.svg",H1:"rake_face.svg",H2:"rake_face.svg",H3:"rake_face.svg",E1:"rake_face.svg",E3:"rake_face.svg",H4:"rake_side.svg",D4:"rake_side.svg",E4:"rake_side.svg",H5:"rake_side.svg",D5:"rake_side.svg",L4:"rake_face.svg",L5:"rake_face.svg",L6:"rake_face.svg",D6:"rake_face.svg",E6:"rake_face.svg",L7:"rake_face.svg",L8:"rake_face.svg",N1:"rake_top.svg",D7:"rake_top.svg",L1:"rake_top.svg",D8:"rake_side.svg",H6:"rake_door.svg",H7:"rake_door.svg",L9:"rake_door.svg",R9:"rake_door.svg",S1:"rake_side_stopper.svg",S2:"rake_top_stopper.svg",E7:"rake_side_stopper.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function ke(l,t){let s;const n=nt(Kt.partName),o=C(),i=C(),d=C(),w=C(),_=C(),a=C(),h=C(),g=C(),r=C(),c=C(),f=C(),N=C(),y=C(),x=C(),A=C();n.logstr+=`${n.partName} simTime: ${l}
|
|
48
|
+
`;try{const S=t.D1/2,R=t.H1+t.H2,D=R-t.H4+t.H5;if(n.logstr+=`cone-height: ${L(R)} mm
|
|
49
|
+
`,n.logstr+=`cone-height total: ${L(D)} mm
|
|
50
|
+
`,2*t.E7>=t.S1)throw`err135: E7 ${t.E7} too large compare to S1 ${t.S1}`;if(t.L5<t.D2)throw`err138: L5 ${t.L5} too small compare to D2 ${t.D2}`;const k=D-t.S2;if(k<0)throw`err143: S2 ${t.S2} too large compare to H1H5 ${L(D)}`;const $=t.H1+t.H2-t.H4+t.D4/2,b=t.H1+t.L8-t.S1;s=function(j,G,J,ot,lt){const ut=j*Math.cos(lt),Lt=j*Math.sin(lt),_t=-G*Math.sin(lt),Ht=G*Math.cos(lt);return z(J,ot).addSegStrokeA(J+ut,ot+Lt).addSegStrokeA(J+ut+_t,ot+Lt+Ht).addSegStrokeA(J+_t,ot+Ht).closeSegStroke()};const u=dt(bt.pDef);u.setVal("D1",t.D1),u.setVal("D2",t.D2),u.setVal("D3",t.D3),u.setVal("H1",t.H1),u.setVal("H2",t.H2),u.setVal("H3",t.H3),u.setVal("E1",t.E1),u.setVal("E3",t.E3),u.setVal("H4",t.H4),u.setVal("D4",t.D4),u.setVal("E4",t.E4),u.setVal("H5",t.H5),u.setVal("D5",t.D5),u.setVal("L4",t.L4),u.setVal("L5",t.L5),u.setVal("L6",t.L6),u.setVal("D6",t.D6),u.setVal("E6",t.E6),u.setVal("L7",t.L7),u.setVal("L8",t.L8),u.setVal("N1",t.N1),u.setVal("D7",t.D7),u.setVal("L1",t.L1),u.setVal("D8",t.D8),u.setVal("H6",t.H6),u.setVal("H7",t.H7),u.setVal("L9",t.L9),u.setVal("R9",t.R9);const H=bt.pGeom(0,u.getParamVal());ct(H),n.logstr+=ht(H.logstr,u.partName),o.mergeFigure(H.fig.faceCone),i.mergeFigure(H.fig.faceBeam),d.mergeFigure(H.fig.faceBeamHollow),w.mergeFigure(H.fig.faceDisc),_.mergeFigure(H.fig.faceHand),a.mergeFigure(H.fig.faceWing),h.mergeFigure(H.fig.faceWingHollow),g.mergeFigure(H.fig.faceDoor),r.mergeFigure(H.fig.faceDisc,!0);const I=t.L5/2,M=t.S1/2,B=t.S1-2*t.E7,T=B/2;r.addMain(s(t.S1,t.L5,-S-t.S1,-I,0)),r.addMain(s(B,t.L5,-S-t.E7-B,-I,0)),r.addMain(s(t.S1,t.L5,t.S2-t.S1,-I,0)),r.addMain(s(B,t.L5,t.S2-t.E7-B,-I,0));const F=t.S2-t.S1/2;r.addMain(s(F,t.S1,0,-I,0)),r.addMain(s(F,B,0,-I+t.E7,0)),r.addMain(s(F,t.S1,0,I-t.S1,0)),r.addMain(s(F,B,0,I-t.S1+t.E7,0)),r.addMain(s(F,t.S1,0,-S-t.S1,0)),r.addMain(s(F,B,0,-S-t.S1+t.E7,0)),r.addMain(s(F,t.S1,0,S,0)),r.addMain(s(F,B,0,S+t.E7,0)),c.mergeFigure(H.fig.faceBeam,!0),c.addMain(v(-S-M,k+M,M)),c.addMain(v(-S-M,k+M,T)),c.addMain(v(t.S2-M,$+M,M)),c.addMain(v(t.S2-M,$+M,T)),c.addSecond(s(F,t.S1,0,$,0)),c.addSecond(s(F,B,0,$+t.E7,0));const p=$+t.S1/2-b,W=Math.sqrt(F**2+p**2),X=Math.atan2(p,F);n.logstr+=`stopper-rod: L ${L(W)} mm, A ${L(st(X))} degree
|
|
51
|
+
`;const K=M*Math.sin(X),it=M*Math.cos(X),q=b-it;c.addSecond(s(W,t.S1,K,q,X));const Q=T*Math.sin(X),m=T*Math.cos(X),E=b-m;c.addSecond(s(W,B,Q,E,X)),f.mergeFigure(H.fig.faceBeam,!0),f.addSecond(v(-S-M,k+M,M)),f.addMain(v(-S-M,k+M,T)),f.addSecond(v(t.S2-M,$+M,M)),f.addMain(v(t.S2-M,$+M,T)),N.mergeFigure(H.fig.faceCone,!0),N.addMain(v(-t.L5/2+M,$+M,M)),N.addMain(v(-t.L5/2+M,$+M,T)),N.addMain(v(t.L5/2-M,$+M,M)),N.addMain(v(t.L5/2-M,$+M,T)),y.mergeFigure(H.fig.faceCone,!0),y.addSecond(v(-t.L5/2+M,$+M,M)),y.addMain(v(-t.L5/2+M,$+M,T)),y.addSecond(v(t.L5/2-M,$+M,M)),y.addMain(v(t.L5/2-M,$+M,T)),x.mergeFigure(H.fig.faceCone,!0),x.addMain(v(-S-M,0,M)),x.addMain(v(-S-M,0,T)),x.addMain(v(S+M,0,M)),x.addMain(v(S+M,0,T)),A.mergeFigure(H.fig.faceCone,!0),A.addSecond(v(-S-M,0,M)),A.addMain(v(-S-M,0,T)),A.addSecond(v(S+M,0,M)),A.addMain(v(S+M,0,T)),n.fig={faceCone:o,faceBeam:i,faceBeamHollow:d,faceDisc:w,faceHand:_,faceWing:a,faceWingHollow:h,faceDoor:g,faceStopperTop:r,faceStopperSide:c,faceStopperSideH:f,faceStopperFaceT:N,faceStopperFaceTH:y,faceStopperFaceB:x,faceStopperFaceBH:A};const P=n.partName;n.vol={inherits:[{outName:`inpax_${P}_rake`,subdesign:"pax_rake",subgeom:H,rotate:[0,0,0],translate:[0,0,0]}],extrudes:[{outName:`subpax_${P}_stpSide`,face:`${P}_faceStopperSide`,extrudeMethod:O.eLinearOrtho,length:t.L5,rotate:[Math.PI/2,0,0],translate:[0,t.L5/2,0]},{outName:`subpax_${P}_stpSideH`,face:`${P}_faceStopperSideH`,extrudeMethod:O.eLinearOrtho,length:t.L5,rotate:[Math.PI/2,0,0],translate:[0,t.L5/2,0]},{outName:`subpax_${P}_stpFaceT`,face:`${P}_faceStopperFaceT`,extrudeMethod:O.eLinearOrtho,length:F,rotate:[Math.PI/2,0,Math.PI/2],translate:[0,0,0]},{outName:`subpax_${P}_stpFaceTH`,face:`${P}_faceStopperFaceTH`,extrudeMethod:O.eLinearOrtho,length:F,rotate:[Math.PI/2,0,Math.PI/2],translate:[0,0,0]},{outName:`subpax_${P}_stpFaceB`,face:`${P}_faceStopperFaceB`,extrudeMethod:O.eLinearOrtho,length:W,rotate:[Math.PI/2-X,0,Math.PI/2],translate:[0,0,b]},{outName:`subpax_${P}_stpFaceBH`,face:`${P}_faceStopperFaceBH`,extrudeMethod:O.eLinearOrtho,length:W,rotate:[Math.PI/2-X,0,Math.PI/2],translate:[0,0,b]}],volumes:[{outName:`ipax_${P}_plus`,boolMethod:Z.eUnion,inList:[`subpax_${P}_stpSide`,`subpax_${P}_stpFaceT`,`subpax_${P}_stpFaceB`]},{outName:`ipax_${P}_hollow`,boolMethod:Z.eUnion,inList:[`subpax_${P}_stpSideH`,`subpax_${P}_stpFaceTH`,`subpax_${P}_stpFaceBH`]},{outName:`ipax_${P}_stopper`,boolMethod:Z.eSubstraction,inList:[`ipax_${P}_plus`,`ipax_${P}_hollow`]},{outName:`pax_${P}`,boolMethod:Z.eUnion,inList:[`inpax_${P}_rake`,`ipax_${P}_stopper`]}]},n.sub={},n.logstr+=`heliostat-rake drawn successfully!
|
|
52
|
+
`,n.calcErr=!1}catch(S){n.logstr+=S,console.log(S)}return n}var yt={pTitle:"Heliostat rake with stopper",pDescription:"The rake-stopper on top of the pole-rotor of the heliostat",pDef:Kt,pGeom:ke},Tt={partName:"heliostat_2",params:[e("H1","mm",3e3,10,4e4,10),e("H2","mm",2500,50,4e4,10),e("H3","mm",200,1,500,1),e("H4","mm",800,1,4e3,1),e("H5","mm",3e3,50,6e3,10),e("H6","mm",200,1,4e3,1),e("H7","mm",400,1,4e3,1),e("H9","mm",100,1,400,1),e("D1","mm",1e3,20,4e3,10),e("D2","mm",700,20,4e3,10),e("D3","mm",900,20,4e3,10),e("D4","mm",400,20,4e3,10),e("D5","mm",300,20,1e3,10),e("D6","mm",200,10,1e3,10),e("D7","mm",400,10,1e3,10),e("D9","mm",100,1,1e3,1),e("E1","mm",30,1,80,1),e("L1","mm",12500,100,4e4,10),e("L2","mm",6e3,100,4e4,10),e("L3","mm",100,1,500,1),e("L4","mm",600,1,4e3,1),e("L5","mm",2e3,10,6e3,10),e("L6","mm",2e3,1,6e3,1),e("L7","mm",100,1,1e3,1),e("L8","mm",200,1,1e3,1),e("al","degree",80,0,95,1),e("S1","mm",100,1,800,1)],paramSvg:{H1:"heliostat_overview.svg",H2:"heliostat_side.svg",H3:"heliostat2_side_sizing.svg",H4:"heliostat2_side_sizing.svg",H5:"heliostat2_side_sizing.svg",H6:"heliostat2_side_sizing.svg",H7:"heliostat2_side_sizing.svg",H9:"heliostat2_side_sizing.svg",D1:"heliostat2_side_sizing.svg",D2:"heliostat2_side_sizing.svg",D3:"heliostat2_side_sizing.svg",D4:"heliostat2_side_sizing.svg",D5:"heliostat2_side_sizing.svg",D6:"heliostat2_side_sizing.svg",D7:"heliostat2_side_sizing.svg",D9:"heliostat2_face_sizing.svg",E1:"heliostat2_side_sizing.svg",L1:"heliostat2_face_sizing.svg",L2:"heliostat2_side_sizing.svg",L3:"heliostat2_face_sizing.svg",L4:"heliostat2_face_sizing.svg",L5:"heliostat2_face_sizing.svg",L6:"heliostat2_face_sizing.svg",L7:"heliostat2_face_sizing.svg",L8:"heliostat2_face_sizing.svg",al:"heliostat2_side_sizing.svg",S1:"heliostat2_side_sizing.svg"},sim:{tMax:100,tStep:.5,tUpdate:500}};function Ee(l,t){const s=nt(Tt.partName),n=C(),o=C(),i=C();s.logstr+=`${s.partName} simTime: ${l}
|
|
53
|
+
`;try{const d=t.H1+t.H2-t.H3+t.H4+t.H5-t.H6+t.H7;s.logstr+=`heliostat-height: ${L(d)}, diameter ${L(t.D1)} m
|
|
54
|
+
`,s.logstr+=`heliostat-swing-length: ${L(t.L1)}, width ${L(t.L2)} m
|
|
55
|
+
`;const w=t.al*l/Tt.sim.tMax,_=Et(w);s.logstr+=`swing position angle: ${L(st(_))} degree
|
|
56
|
+
`;const a=t.H1+t.H2-t.H3,h=a+t.H4+t.H5-t.H6+t.H7,g=dt(Dt.pDef),r=dt(yt.pDef),c=dt($t.pDef);g.setVal("H1",t.H1),g.setVal("H2",t.H2),g.setVal("D1",t.D1),g.setVal("D2",t.D2),g.setVal("D3",t.D1-6*t.E1),g.setVal("E1",t.E1),g.setVal("E2",t.E1);const f=32,N=(t.D1-6*t.E1)/(f*4);g.setVal("N1",f),g.setVal("D5",N),g.setVal("L1",t.E1+N/2),g.setVal("H3",t.H1/4),g.setVal("H4",t.H1/2),g.setVal("D4",t.H1/4),g.setVal("L2",t.H1/80),g.setVal("E3",t.H1/80),r.setVal("H1",t.H4),r.setVal("H2",t.H5),r.setVal("H3",t.H4-2*t.E1),r.setVal("D1",t.D3),r.setVal("D2",t.D4),r.setVal("L9",t.D3/2),r.setVal("H7",t.D3/2*1.6),r.setVal("H6",t.D3/20),r.setVal("R9",t.D3/20),r.setVal("E1",t.E1),r.setVal("E3",t.E1),r.setVal("E4",t.E1),r.setVal("E6",t.E1),r.setVal("E7",t.E1);const y=t.D2*.6,x=24,A=y/(x*4);if(r.setVal("D3",y),t.D2>t.D3-2*t.E1)throw`err153: D2 ${t.D2} too large compare to D3 ${t.D3} and E1 ${t.E1}`;if(r.setVal("N1",x),r.setVal("D7",A),r.setVal("L1",A),r.setVal("H4",t.H6),r.setVal("D4",t.D5),r.setVal("L7",t.L7),r.setVal("L8",t.L8),r.setVal("D6",t.D9),r.setVal("H5",t.H7),r.setVal("D5",t.D6),r.setVal("D8",t.D7),t.D6>=t.D7)throw`err164: D6 ${t.D6} too large compare to D7 ${t.D7}`;const S=t.L4-2*t.L3;if(r.setVal("L4",S),S<=0)throw`err169: L3 ${t.L3} too large compare to L4 ${t.L4}`;if(r.setVal("L5",t.L5+2*t.L3),r.setVal("L6",t.L6+2*t.L3),r.setVal("S1",t.S1),r.setVal("S2",t.L2/2),c.setVal("L2",t.L2),c.setVal("D1",t.D6),c.setVal("H3",t.H9),c.setVal("H4",t.H9),c.setVal("L1",t.L1),t.L1<4*t.L4+2*t.L6+t.L5+2*t.L3)throw`err185: L1 ${t.L1} too small compare to L4 ${t.L4}, L5 ${t.L5}, L6 ${t.L6}`;c.setVal("H1",t.L3),c.setVal("H2",t.L3),c.setVal("L4",t.L4),c.setVal("L5",t.L5),c.setVal("L6",t.L6),c.setVal("L3",t.D7);const R=Dt.pGeom(0,g.getParamVal());ct(R),s.logstr+=ht(R.logstr,g.partName);const D=yt.pGeom(0,r.getParamVal());ct(D),s.logstr+=ht(D.logstr,r.partName);const k=$t.pGeom(0,c.getParamVal());ct(k),s.logstr+=ht(k.logstr,c.partName),n.mergeFigure(R.fig.poleCut),n.mergeFigure(D.fig.faceStopperSide.translate(0,a)),n.mergeFigure(k.fig.faceSide.translate(0,h).rotate(0,h,_)),o.mergeFigure(R.fig.poleCut),o.mergeFigure(D.fig.faceStopperFaceT.translate(0,a)),o.mergeFigure(k.fig.faceFace.translate(0,h)),i.mergeFigure(R.fig.poleBottom.translate(0,0)),i.mergeFigure(D.fig.faceStopperTop.translate(0,0)),i.mergeFigure(k.fig.faceTop.rotate(0,0,Math.PI/2)),s.fig={faceSide:n,faceFace:o,faceTop:i};const $=s.partName;s.vol={inherits:[{outName:`inpax_${$}_poleStatic`,subdesign:"pax_pole_static",subgeom:R,rotate:[0,0,0],translate:[0,0,0]},{outName:`inpax_${$}_rake`,subdesign:"pax_rake_stopper",subgeom:D,rotate:[0,0,0],translate:[0,0,a]},{outName:`inpax_${$}_swing`,subdesign:"pax_swing",subgeom:k,rotate:[Math.PI/2,0,0],translate:[0,0,h]}],extrudes:[],volumes:[{outName:`pax_${$}`,boolMethod:Z.eUnion,inList:[`inpax_${$}_poleStatic`,`inpax_${$}_rake`,`inpax_${$}_swing`]}]};const b=g.getDesignParamList(),u={partName:g.getPartName(),dparam:b,orientation:[0,0,0],position:[0,0,0]},H={partName:r.getPartName(),dparam:r.getDesignParamList(),orientation:[0,0,0],position:[0,0,a]},I={partName:c.getPartName(),dparam:c.getDesignParamList(),orientation:[0,0,0],position:[0,0,h]};s.sub={pole_static_1:u,rake_1:H,swing_1:I},s.logstr+=`heliostat-2-overview drawn successfully!
|
|
57
|
+
`,s.calcErr=!1}catch(d){s.logstr+=d,console.log(d)}return s}var Pe={pTitle:"Heliostat-2 overview",pDescription:"The heliostat-2 inclination mechanism",pDef:Tt,pGeom:Ee},Qt={partName:"base",params:[e("D1","mm",600,10,4e3,10),e("D2","mm",700,10,4e3,10),e("D3","mm",400,10,4e3,10),e("D4","mm",500,10,4e3,10),e("E1","mm",30,1,80,1),e("E2","mm",30,1,80,1),e("E3","mm",30,1,80,1),e("H1","mm",800,10,4e3,10),e("H2","mm",50,1,4e3,1),e("H3","mm",400,10,4e3,10),e("N2","",12,1,100,1),e("L2","mm",100,1,400,1),e("N1","",24,3,100,1),e("D5","mm",40,1,100,1),e("L1","mm",34,1,300,1)],paramSvg:{D1:"base_cut.svg",D2:"base_cut.svg",D3:"base_cut.svg",D4:"base_cut.svg",E1:"base_cut.svg",E2:"base_cut.svg",E3:"base_cut.svg",H1:"base_cut.svg",H2:"base_hollow.svg",H3:"base_hollow.svg",N2:"base_hollow.svg",L2:"base_hollow.svg",N1:"base_top.svg",D5:"base_top.svg",L1:"base_top.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function Ae(l,t){let s,n,o;const i=nt(Qt.partName),d=C(),w=C(),_=C();i.logstr+=`${i.partName} simTime: ${l}
|
|
58
|
+
`;try{const a=t.D1/2,h=t.D2/2,g=t.D3/2,r=t.D4/2,c=t.D5/2,f=t.L2/2;if(h<a)throw`err089: D2 ${t.D2} too small compare to D1 ${t.D1}`;if(r>a-t.E2)throw`err189: D4 ${t.D4} too large compare to D1 ${t.D1} and E2 ${t.E2}`;i.logstr+=`base-height: ${L(t.H1)} mm
|
|
59
|
+
`,i.logstr+=`base-external-diameter: ${L(t.D2)} mm
|
|
60
|
+
`;const N=t.D1*Math.PI/t.N2-t.L2;if(i.logstr+=`inter-hollow: ${L(N)} mm
|
|
61
|
+
`,s=function(H){return z(H*h,0).addSegStrokeA(H*h,t.E3).addSegStrokeA(H*a,t.E3).addSegStrokeA(H*a,t.H1).addSegStrokeA(H*(a-t.E2),t.H1).addSegStrokeA(H*(a-t.E2),t.E3).addSegStrokeA(H*r,t.E3).addSegStrokeA(H*r,0).closeSegStroke()},n=function(H){return z(H*h,0).addSegStrokeA(H*h,t.E3).addSegStrokeA(H*a,t.E3).addSegStrokeA(H*a,t.H1).addSegStrokeA(H*g,t.H1).addSegStrokeA(H*g,t.H1-t.E1).addSegStrokeA(H*(a-t.E2),t.H1-t.E1).addSegStrokeA(H*(a-t.E2),t.E3).addSegStrokeA(H*r,t.E3).addSegStrokeA(H*r,0).closeSegStroke()},t.H1<t.E3+t.H2+t.H3+t.E1)throw`err125: H1 ${t.H1} too small compare to E3 ${t.H3}, H2 ${t.H2}, H3 ${t.H3}, E1 ${t.E1}`;if(t.D5>t.H3)throw`err128: D5 ${t.D5} too large compare to H3 ${t.H3}`;const y=2*Math.asin(f/(a-t.E2));if(t.N2*y>2*Math.PI)throw`err132: N2 ${t.N2} too large compare to L2 ${t.L2}, D1 ${t.D1}, E2 ${t.E2}`;const x=t.E3+t.H2+f;if(o=function(H){return z(H*f,x).addSegStrokeA(H*f,x+t.H3-t.L2).addPointA(-H*f,x+t.H3-t.L2).addSegArc(f,!1,!0).addSegStrokeA(-H*f,x).closeSegArc(f,!1,!0)},d.addMain(s(1)),d.addSecond(n(1)),d.addSecond(n(-1)),d.addSecond(o(1)),g+t.L1+c>a-t.E2)throw`err127: D3 ${t.D3} too large compare to D1 ${t.D1}, E2 ${t.E2}, L1 ${t.L1}, R5 ${t.D5}`;if(c>t.L1)throw`err130: D5 ${t.D5} too large compare to L1 ${t.L1}`;const A=2*Math.asin(c/(h+t.L1));if(t.N1*A>2*Math.PI)throw`err134: N1 ${t.N1} too large compare to D5 ${t.D5}, L1 ${t.L1}, D2 ${t.D2}`;w.addMain(v(0,0,a)),w.addMain(v(0,0,g));const S=g+t.L1,R=2*Math.PI/t.N1;for(let H=0;H<t.N1;H++){const I=S*Math.cos(H*R),M=S*Math.sin(H*R);w.addMain(v(I,M,c))}w.addSecond(v(0,0,a-t.E1)),w.addSecond(v(0,0,h)),w.addSecond(v(0,0,r)),_.addMain(o(1)),_.addSecond(n(1)),_.addSecond(n(-1)),i.fig={faceCut:d,faceTop:w,faceHollow:_};const D=i.partName,k=2*Math.PI/t.N2,$=[...Array(t.N2).keys()],b=$.map(H=>({outName:`subpax_${D}_hollow_${H}`,face:`${D}_faceHollow`,extrudeMethod:O.eLinearOrtho,length:h+t.E2,rotate:[Math.PI/2,0,H*k],translate:[0,0,0]})),u=$.map(H=>`subpax_${D}_hollow_${H}`);i.vol={extrudes:[{outName:`subpax_${D}_cut`,face:`${D}_faceCut`,extrudeMethod:O.eRotate,rotate:[0,0,0],translate:[Math.PI/2,0,0]},{outName:`subpax_${D}_top`,face:`${D}_faceTop`,extrudeMethod:O.eLinearOrtho,length:t.E1,rotate:[0,0,0],translate:[0,0,t.H1-t.E1]},...b],volumes:[{outName:`ipax_${D}_hollows`,boolMethod:Z.eUnion,inList:[...u]},{outName:`ipax_${D}_cylinder`,boolMethod:Z.eSubstraction,inList:[`subpax_${D}_cut`,`ipax_${D}_hollows`]},{outName:`pax_${D}`,boolMethod:Z.eUnion,inList:[`ipax_${D}_cylinder`,`subpax_${D}_top`]}]},i.sub={},i.logstr+=`heliostat-base drawn successfully!
|
|
62
|
+
`,i.calcErr=!1}catch(a){i.logstr+=a,console.log(a)}return i}var Re={pTitle:"Heliostat base",pDescription:"The base for the static-pole of the heliostat",pDef:Qt,pGeom:Ae},te={partName:"pole_rotor",params:[e("D1","mm",600,1,4e3,1),e("D2","mm",400,1,4e3,1),e("H1","mm",8e3,10,4e4,10),e("E1","mm",5,1,80,1),e("E2","mm",30,1,80,1),e("N1","",24,3,100,1),e("D3","mm",40,1,100,1),e("L1","mm",45,1,300,1)],paramSvg:{D1:"pole_rotor_cut.svg",D2:"pole_rotor_cut.svg",H1:"pole_rotor_cut.svg",E1:"pole_rotor_cut.svg",E2:"pole_rotor_cut.svg",N1:"pole_rotor_ends.svg",D3:"pole_rotor_ends.svg",L1:"pole_rotor_ends.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function Ne(l,t){let s;const n=nt(te.partName),o=C(),i=C();n.logstr+=`${n.partName} simTime: ${l}
|
|
63
|
+
`;try{const d=t.D1/2,w=t.D2/2,_=t.D3/2;n.logstr+=`pole-height: ${L(t.H1)} mm
|
|
64
|
+
`;const a=z(d,0).addSegStrokeA(d,t.H1).addSegStrokeA(d-t.E1,t.H1).addSegStrokeA(d-t.E1,0).closeSegStroke();o.addMain(a),s=function(c){return z(c*d,0).addSegStrokeA(c*d,t.H1).addSegStrokeA(c*w,t.H1).addSegStrokeA(c*w,t.H1-t.E2).addSegStrokeA(c*(d-t.E1),t.H1-t.E2).addSegStrokeA(c*(d-t.E1),t.E2).addSegStrokeA(c*w,t.E2).addSegStrokeA(c*w,0).closeSegStroke()},o.addSecond(s(1)),o.addSecond(s(-1)),i.addMain(v(0,0,d)),i.addMain(v(0,0,w));const h=w+t.L1,g=2*Math.PI/t.N1;for(let c=0;c<t.N1;c++){const f=h*Math.cos(c*g),N=h*Math.sin(c*g);i.addMain(v(f,N,_))}i.addSecond(v(0,0,d-t.E1)),n.fig={faceCut:o,faceBottom:i};const r=n.partName;n.vol={extrudes:[{outName:`subpax_${r}_pole`,face:`${r}_faceCut`,extrudeMethod:O.eRotate,rotate:[0,0,0],translate:[0,0,0]},{outName:`subpax_${r}_bottom`,face:`${r}_faceBottom`,extrudeMethod:O.eLinearOrtho,length:t.E2,rotate:[0,0,0],translate:[0,0,0]},{outName:`subpax_${r}_top`,face:`${r}_faceBottom`,extrudeMethod:O.eLinearOrtho,length:t.E2,rotate:[0,0,0],translate:[0,0,t.H1-t.E2]}],volumes:[{outName:`pax_${r}`,boolMethod:Z.eUnion,inList:[`subpax_${r}_pole`,`subpax_${r}_bottom`,`subpax_${r}_top`]}]},n.sub={},n.logstr+=`pole_rotor drawn successfully!
|
|
65
|
+
`,n.calcErr=!1}catch(d){n.logstr+=d,console.log(d)}return n}var Ve={pTitle:"Heliostat pole rotor",pDescription:"The vertical axis inside the pole of an heliostat",pDef:te,pGeom:Ne},ee={partName:"rod",params:[e("L1","mm",1e4,100,4e4,10),e("L2","mm",100,2,400,1),e("L3","mm",400,10,1e3,1),e("L4","mm",600,10,1e3,1),e("H1","mm",200,5,4e3,1),e("E1","mm",2,1,80,1),e("E2","mm",10,1,80,1),e("N1","",10,2,50,1),e("N3","",2,1,20,1),e("N4","",4,1,20,1),e("R3","mm",100,1,500,1),e("D2","mm",10,1,100,1),e("L7","mm",10,1,300,1)],paramSvg:{L1:"rod_top.svg",L2:"rod_top.svg",L3:"rod_top.svg",L4:"rod_top.svg",H1:"rod_cut.svg",E1:"rod_cut.svg",E2:"rod_cut.svg",N1:"rod_top.svg",N3:"rod_top.svg",N4:"rod_top.svg",R3:"rod_top.svg",D2:"rod_plate.svg",L7:"rod_plate.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function Ce(l,t){let s,n;const o=nt(ee.partName),i=C(),d=C(),w=C();o.logstr+=`${o.partName} simTime: ${l}
|
|
66
|
+
`;try{const _=t.D2/2,a=t.L3/(t.N3+1),h=t.L4/(t.N4+1);o.logstr+=`rod-length: ${L(t.L1)} mm
|
|
67
|
+
`;const g=(t.L1-t.L3)/(t.N1-1);o.logstr+=`space-length: ${L(g)} mm
|
|
68
|
+
`,s=function(D){const k=[],$=z(t.L4/2,D).addCornerRounded(t.R3).addSegStrokeA(t.L4/2,D+t.L3).addCornerRounded(t.R3).addSegStrokeA(-t.L4/2,D+t.L3).addCornerRounded(t.R3).addSegStrokeA(-t.L4/2,D).addCornerRounded(t.R3).closeSegStroke();k.push($);for(let b=1;b<t.N3+1;b++)k.push(v(t.L4/2-t.L7,D+b*a,_)),k.push(v(-t.L4/2+t.L7,D+b*a,_));for(let b=1;b<t.N4+1;b++)k.push(v(-t.L4/2+b*h,D+t.L7,_)),k.push(v(-t.L4/2+b*h,D+t.L3-t.L7,_));return k},n=function(D,k){return z(t.L2/2,D).addSegStrokeA(t.L2/2,D+k).addSegStrokeA(-t.L2/2,D+k).addSegStrokeA(-t.L2/2,D).closeSegStroke()};const r=t.L2/2,c=t.L4/2,f=(t.L2-2*t.E1)/2,N=t.H1-t.E1,y=z(r,0).addSegStrokeA(r,t.H1).addSegStrokeA(-r,t.H1).addSegStrokeA(-r,0).closeSegStroke(),x=z(f,t.E1).addSegStrokeA(f,N).addSegStrokeA(-f,N).addSegStrokeA(-f,t.E1).closeSegStroke(),A=z(c,t.H1).addSegStrokeA(c,t.H1+t.E2).addSegStrokeA(-c,t.H1+t.E2).addSegStrokeA(-c,t.H1).closeSegStroke();i.addMain(y),i.addMain(x),i.addSecond(A),s(0).forEach(D=>d.addMain(D)),d.addSecond(n(-t.L3/2,2*t.L3));const S=(t.L1-t.L3)/(t.N1-1);for(let D=0;D<t.N1;D++)s(D*S).forEach(k=>w.addMain(k));w.addSecond(n(0,t.L1)),o.fig={faceCut:i,facePlate:d,faceTop:w};const R=o.partName;o.vol={extrudes:[{outName:`subpax_${R}_rod`,face:`${R}_faceCut`,extrudeMethod:O.eLinearOrtho,length:t.L1,rotate:[0,0,0],translate:[0,0,0]},{outName:`subpax_${R}_plates`,face:`${R}_faceTop`,extrudeMethod:O.eLinearOrtho,length:t.E2,rotate:[Math.PI/2,0,0],translate:[0,t.E2+t.H1,0]}],volumes:[{outName:`pax_${R}`,boolMethod:Z.eUnion,inList:[`subpax_${R}_rod`,`subpax_${R}_plates`]}]},o.sub={},o.logstr+=`heliostat-rod drawn successfully!
|
|
69
|
+
`,o.calcErr=!1}catch(_){o.logstr+=_,console.log(_)}return o}var Ie={pTitle:"Heliostat rod",pDescription:"The rod of an heliostat-surface",pDef:ee,pGeom:Ce},se={partName:"trapeze",params:[e("L1","mm",1600,10,4e3,1),e("L2","mm",1e3,10,4e3,1),e("L3","mm",400,5,800,1),e("L4","mm",300,5,800,1),e("N1","",7,1,20,1),e("N2","",4,1,20,1),e("N3","",2,1,20,1),e("N4","",2,1,20,1),e("L5","mm",100,1,400,1),e("L6","mm",20,1,400,1),e("L7","mm",20,1,400,1),e("D1","mm",10,1,40,1),e("D2","mm",10,1,40,1),e("D3","mm",30,1,100,1),e("D4","mm",26,1,100,1),e("R1","mm",60,1,400,1),e("R2","mm",20,1,400,1),e("R3","mm",20,1,400,1),e("H1","mm",300,.5,800,.5),e("H2","mm",2,.5,800,.5),e("H3","mm",5,.5,800,.5)],paramSvg:{L1:"trapeze_top.svg",L2:"trapeze_top.svg",L3:"trapeze_top.svg",L4:"trapeze_top.svg",N1:"trapeze_top.svg",N2:"trapeze_top.svg",N3:"trapeze_top.svg",N4:"trapeze_top.svg",L5:"trapeze_top.svg",L6:"trapeze_top.svg",L7:"trapeze_top.svg",D1:"trapeze_top.svg",D2:"trapeze_top.svg",D3:"trapeze_rod.svg",D4:"trapeze_rod.svg",R1:"trapeze_top.svg",R2:"trapeze_top.svg",R3:"trapeze_top.svg",H1:"trapeze_side.svg",H2:"trapeze_side.svg",H3:"trapeze_side.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function Fe(l,t){let s,n;const o=nt(se.partName),i=C(),d=C(),w=C(),_=C(),a=C();o.logstr+=`${o.partName} simTime: ${l}
|
|
70
|
+
`;try{if(t.L3>t.L1-t.L5)throw`err595: L3 ${t.L3} too large compare to L1 ${t.L1} and L5 ${t.L5}`;if(t.L4>t.L2-t.L5)throw`err596: L4 ${t.L4} too large compare to L2 ${t.L2} and L5 ${t.L5}`;if(t.H1-t.H2-t.H3<4*t.D3)throw`err597: H1 ${t.H1} too small compare to H2 ${t.H2}, H3 ${t.H3} and D3 ${t.D3}`;const h=t.R1*(1-1/Math.sqrt(2)),g=t.R3*(1-1/Math.sqrt(2)),r=t.L2/2-h-(t.L4/2-g),c=t.L1/2-h-(t.L3/2-g),f=Math.sqrt(r**2+c**2),N=t.H1-t.H2-t.H3,y=Math.sqrt(f**2+N**2),x=Math.atan2(N,f),A=Math.atan2(c,r);o.logstr+=`rod-slope: length: ${L(y)} mm, angle: ${L(st(x))} degree
|
|
71
|
+
`,o.logstr+=`rod-xy-angle: ${L(st(A))} degree
|
|
72
|
+
`;const S=t.D3/Math.cos(Math.PI/2-x);o.logstr+=`rod-footprint-length: ${L(S)} mm
|
|
73
|
+
`;const R=Math.sqrt((S/2)**2+(t.D3/2)**2),D=Math.atan2(t.D3,S);if(s=function(P,j,G){return z(P,j).addPointRP(G+Math.PI-D,R).addSeg2Arcs(G+Math.PI/2,G).addPointRP(G+Math.PI+D,R).addSeg2Arcs(G+Math.PI,G+Math.PI/2).addPointRP(G-D,R).addSeg2Arcs(G+3*Math.PI/2,G+Math.PI).addPointRP(G+D,R).addSeg2Arcs(G,G-Math.PI/2)},n=function(P,j,G){const J=P+R*Math.cos(G+Math.PI-D),ot=j+R*Math.sin(G+Math.PI-D);return z(J,ot).addSegStrokeRP(G+Math.PI,f).addSegStrokeRP(G-Math.PI/2,t.D3).addSegStrokeRP(G,f).closeSegStroke()},t.R1>t.L1/4||t.R1>t.L2/4)throw`err614: R1 ${t.R1} too large compare to L1 ${t.L1} or L2 ${t.L2}`;const k=z(t.L2/2,t.L1/2).addSegStrokeA(-t.L2/2,t.L1/2).addCornerRounded(t.R1).addSegStrokeA(-t.L2/2,-t.L1/2).addCornerRounded(t.R1).addSegStrokeA(t.L2/2,-t.L1/2).addCornerRounded(t.R1).closeSegStroke().addCornerRounded(t.R1);if(t.R2>(t.L1-2*t.L5)/4||t.R2>(t.L2-2*t.L5)/4)throw`err627: R2 ${t.R2} too large compare to L1 ${t.L1}, L2 ${t.L2} and L5 ${t.L5}`;const $=z(t.L2/2-t.L5,t.L1/2-t.L5).addSegStrokeA(-t.L2/2+t.L5,t.L1/2-t.L5).addCornerRounded(t.R2).addSegStrokeA(-t.L2/2+t.L5,-t.L1/2+t.L5).addCornerRounded(t.R2).addSegStrokeA(t.L2/2-t.L5,-t.L1/2+t.L5).addCornerRounded(t.R2).closeSegStroke().addCornerRounded(t.R2);if(t.R3>t.L3/4||t.R3>t.L4/4)throw`err639: R3 ${t.R3} too large compare to L3 ${t.L3} or L4 ${t.L4}`;const b=z(t.L4/2,t.L3/2).addSegStrokeA(-t.L4/2,t.L3/2).addCornerRounded(t.R3).addSegStrokeA(-t.L4/2,-t.L3/2).addCornerRounded(t.R3).addSegStrokeA(t.L4/2,-t.L3/2).addCornerRounded(t.R3).closeSegStroke().addCornerRounded(t.R3);i.addMain(k),i.addMain($),i.addSecond(b);const u=t.L1/(t.N1+1),H=t.L2/(t.N2+1),I=t.L3/(t.N3+1),M=t.L4/(t.N4+1);if(t.L5<t.D1/2+t.L6)throw`err658: L5 ${t.L5} too small compare to D1 ${t.D1} or L6 ${t.L6}`;if(I<t.D2/2+t.L7)throw`err661: D2 ${t.D2} or L7 ${t.L7} too large compare to L3 ${t.l3}`;if(M<t.D2/2+t.L7)throw`err664: D2 ${t.D2} or L7 ${t.L7} too large compare to L4 ${t.l4}`;const B=[];for(let P=1;P<t.N1+1;P++)B.push(v(t.L2/2-t.L6,-t.L1/2+P*u,t.D1/2)),B.push(v(-t.L2/2+t.L6,-t.L1/2+P*u,t.D1/2));for(let P=1;P<t.N2+1;P++)B.push(v(-t.L2/2+P*H,t.L1/2-t.L6,t.D1/2)),B.push(v(-t.L2/2+P*H,-t.L1/2+t.L6,t.D1/2));const T=[];for(let P=1;P<t.N3+1;P++)T.push(v(t.L4/2-t.L7,-t.L3/2+P*I,t.D2/2)),T.push(v(-t.L4/2+t.L7,-t.L3/2+P*I,t.D2/2));for(let P=1;P<t.N4+1;P++)T.push(v(-t.L4/2+P*M,t.L3/2-t.L7,t.D2/2)),T.push(v(-t.L4/2+P*M,-t.L3/2+t.L7,t.D2/2));B.forEach(P=>{i.addMain(P)}),T.forEach(P=>{i.addSecond(P)});const F=[];F.push(s(t.L2/2-h,t.L1/2-h,A)),F.push(s(t.L4/2-g,t.L3/2-g,A)),F.push(s(-t.L2/2+h,t.L1/2-h,Math.PI-A)),F.push(s(-t.L4/2+g,t.L3/2-g,Math.PI-A)),F.push(s(-t.L2/2+h,-t.L1/2+h,Math.PI+A)),F.push(s(-t.L4/2+g,-t.L3/2+g,Math.PI+A)),F.push(s(t.L2/2-h,-t.L1/2+h,-A)),F.push(s(t.L4/2-g,-t.L3/2+g,-A));const p=[];if(p.push(n(t.L2/2-h,t.L1/2-h,A)),p.push(n(-t.L2/2+h,t.L1/2-h,Math.PI-A)),p.push(n(-t.L2/2+h,-t.L1/2+h,Math.PI+A)),p.push(n(t.L2/2-h,-t.L1/2+h,-A)),F.forEach(P=>{i.addSecond(P)}),p.forEach(P=>{i.addSecond(P)}),d.addMain(b),T.forEach(P=>{d.addMain(P)}),d.addSecond(k),d.addSecond($),B.forEach(P=>{d.addSecond(P)}),F.forEach(P=>{d.addSecond(P)}),p.forEach(P=>{d.addSecond(P)}),t.D4>=t.D3)throw`err218: D4 ${t.D4} larger than D3 ${t.D3}`;w.addMain(v(0,0,t.D3/2)),w.addSecond(v(0,0,t.D4/2)),_.addMain(v(0,0,t.D4/2)),_.addSecond(v(0,0,t.D3/2));const W=t.D3*Math.cos(x),X=W/Math.tan(x),K=g+(S/2+X)*Math.cos(A),it=g+(S/2+X)*Math.sin(A),q=y+2*(S+X+W),Q=q+t.L3+t.L4+W,m=z(Q,Q).addSegStrokeA(-Q,Q).addSegStrokeA(-Q,-Q).addSegStrokeA(Q,-Q).closeSegStroke();a.addMain(m),o.fig={faceFrame:i,facePlate:d,faceRod:w,faceRodHollow:_,faceCutRod:a};const E=o.partName;o.vol={extrudes:[{outName:`subpax_${E}_frame`,face:`${E}_faceFrame`,extrudeMethod:O.eLinearOrtho,length:t.H2,rotate:[0,0,0],translate:[0,0,t.H1-t.H2]},{outName:`subpax_${E}_plate`,face:`${E}_facePlate`,extrudeMethod:O.eLinearOrtho,length:t.H3,rotate:[0,0,0],translate:[0,0,0]},{outName:`subpax_${E}_rod1`,face:`${E}_faceRod`,extrudeMethod:O.eLinearOrtho,length:q,rotate:[0,Math.PI/2-x,A],translate:[t.L4/2-K,t.L3/2-it,t.H3-W]},{outName:`subpax_${E}_rod2`,face:`${E}_faceRod`,extrudeMethod:O.eLinearOrtho,length:q,rotate:[0,Math.PI/2-x,Math.PI-A],translate:[-t.L4/2+K,t.L3/2-it,t.H3-W]},{outName:`subpax_${E}_rod3`,face:`${E}_faceRod`,extrudeMethod:O.eLinearOrtho,length:q,rotate:[0,Math.PI/2-x,Math.PI+A],translate:[-t.L4/2+K,-t.L3/2+it,t.H3-W]},{outName:`subpax_${E}_rod4`,face:`${E}_faceRod`,extrudeMethod:O.eLinearOrtho,length:q,rotate:[0,Math.PI/2-x,-A],translate:[t.L4/2-K,-t.L3/2+it,t.H3-W]},{outName:`subpax_${E}_rodH1`,face:`${E}_faceRodHollow`,extrudeMethod:O.eLinearOrtho,length:q,rotate:[0,Math.PI/2-x,A],translate:[t.L4/2-K,t.L3/2-it,t.H3-W]},{outName:`subpax_${E}_rodH2`,face:`${E}_faceRodHollow`,extrudeMethod:O.eLinearOrtho,length:q,rotate:[0,Math.PI/2-x,Math.PI-A],translate:[-t.L4/2+K,t.L3/2-it,t.H3-W]},{outName:`subpax_${E}_rodH3`,face:`${E}_faceRodHollow`,extrudeMethod:O.eLinearOrtho,length:q,rotate:[0,Math.PI/2-x,Math.PI+A],translate:[-t.L4/2+K,-t.L3/2+it,t.H3-W]},{outName:`subpax_${E}_rodH4`,face:`${E}_faceRodHollow`,extrudeMethod:O.eLinearOrtho,length:q,rotate:[0,Math.PI/2-x,-A],translate:[t.L4/2-K,-t.L3/2+it,t.H3-W]},{outName:`subpax_${E}_cut1`,face:`${E}_faceCutRod`,extrudeMethod:O.eLinearOrtho,length:Q,rotate:[0,0,0],translate:[0,0,-Q]},{outName:`subpax_${E}_cut2`,face:`${E}_faceCutRod`,extrudeMethod:O.eLinearOrtho,length:Q,rotate:[0,0,0],translate:[0,0,t.H1]}],volumes:[{outName:`ipax_${E}_rawRod`,boolMethod:Z.eUnion,inList:[`subpax_${E}_rod1`,`subpax_${E}_rod2`,`subpax_${E}_rod3`,`subpax_${E}_rod4`]},{outName:`ipax_${E}_rodHollow`,boolMethod:Z.eUnion,inList:[`subpax_${E}_rodH1`,`subpax_${E}_rodH2`,`subpax_${E}_rodH3`,`subpax_${E}_rodH4`]},{outName:`ipax_${E}_halfRods`,boolMethod:Z.eSubstraction,inList:[`ipax_${E}_rawRod`,`subpax_${E}_cut1`]},{outName:`ipax_${E}_rods`,boolMethod:Z.eSubstraction,inList:[`ipax_${E}_halfRods`,`subpax_${E}_cut2`]},{outName:`ipax_${E}_plus`,boolMethod:Z.eUnion,inList:[`subpax_${E}_frame`,`subpax_${E}_plate`,`ipax_${E}_rods`]},{outName:`pax_${E}`,boolMethod:Z.eSubstraction,inList:[`ipax_${E}_plus`,`ipax_${E}_rodHollow`]}]},o.sub={},o.logstr+=`trapeze drawn successfully!
|
|
74
|
+
`,o.calcErr=!1}catch(h){o.logstr+=h,console.log(h)}return o}var ye={pTitle:"Heliostat trapeze",pDescription:"The support of one solar panel. Made out of aluminium for lightness and cooling",pDef:se,pGeom:Fe},oe={partName:"surface",params:[e("LH","mm",1600,10,4e3,1),e("LV","mm",1e3,10,4e3,1),e("LZ","mm",40,0,100,1),e("nx","",9,1,40,1),e("ny","",9,1,40,1),wt("main_direction",["horizontal","vertical"]),rt("crenel",!1),e("first_row","",9,1,40,1),e("second_row","",9,1,40,1),e("EH","mm",10,0,1e3,1),rt("EH_gradient",!1),e("EH_sup","mm",500,0,1e3,1),e("EH_cycle","",1,0,3,.05),e("EH_start","",0,0,1,.05),wt("EH_shape",["sinusoid","triangle","sawUp","sawDown"]),e("EV","mm",10,0,1e3,1),rt("EV_gradient",!1),e("EV_sup","mm",500,0,1e3,1),e("EV_cycle","",1,0,3,.05),e("EV_start","",0,0,1,.05),wt("EV_shape",["sinusoid","triangle","sawUp","sawDown"]),e("power_efficiency","%",16,0,100,.1),e("solar_power","W/m2",816,100,2e3,1)],paramSvg:{LH:"surface_main.svg",LV:"surface_main.svg",LZ:"surface_lz.svg",nx:"surface_main.svg",ny:"surface_main.svg",main_direction:"surface_crenel.svg",crenel:"surface_crenel.svg",first_row:"surface_extremities.svg",second_row:"surface_extremities.svg",EH:"surface_main.svg",EH_gradient:"surface_space_evolution.svg",EH_sup:"surface_space_evolution.svg",EH_cycle:"surface_space_evolution.svg",EH_start:"surface_space_evolution.svg",EH_shape:"surface_space_shape.svg",EV:"surface_main.svg",EV_gradient:"surface_space_evolution.svg",EV_sup:"surface_space_evolution.svg",EV_cycle:"surface_space_evolution.svg",EV_start:"surface_space_evolution.svg",EV_shape:"surface_space_shape.svg",power_efficiency:"surface_power.svg",solar_power:"surface_power.svg"},sim:{tMax:180,tStep:.5,tUpdate:500}};function Te(l,t){let s;const n=nt(oe.partName),o=C(),i=C();n.logstr+=`${n.partName} simTime: ${l}
|
|
75
|
+
`;try{const d=t.LH*t.LV/1e6,w=t.solar_power*d*t.power_efficiency/100;n.logstr+=`panel surface: ${L(d)} m2
|
|
76
|
+
`,n.logstr+=`panel power: ${L(w)} W
|
|
77
|
+
`;const _=t.nx*t.ny;n.logstr+=`max panel number: ${_}
|
|
78
|
+
`,n.logstr+=`max panel surface: ${L(_*d)} m2
|
|
79
|
+
`,n.logstr+=`max panel power: ${L(_*w)} W
|
|
80
|
+
`;const a=t.main_direction===1?t.ny:t.nx,h=t.main_direction===1?t.nx:t.ny,g=t.main_direction===1?t.EV:t.EH,r=t.main_direction===1?t.EV_gradient:t.EH_gradient,c=t.main_direction===1?t.EV_sup:t.EH_sup,f=t.main_direction===1?t.EV_cycle:t.EH_cycle,N=t.main_direction===1?t.EV_start:t.EH_start,y=t.main_direction===1?t.EV_shape:t.EH_shape,x=t.main_direction===0?t.EV:t.EH,A=t.main_direction===0?t.EV_gradient:t.EH_gradient,S=t.main_direction===0?t.EV_sup:t.EH_sup,R=t.main_direction===0?t.EV_cycle:t.EH_cycle,D=t.main_direction===0?t.EV_start:t.EH_start,k=t.main_direction===0?t.EV_shape:t.EH_shape,$=Math.max(h,t.first_row,t.second_row),b=[];for(let m=0;m<a;m++){const E=(m+1)%2,P=t.crenel?h-E:h;b.push(P)}b[0]=t.first_row,b[b.length-1]=t.first_row,a>2&&(b[1]=t.second_row,b[b.length-2]=t.second_row);let u=0;b.forEach(m=>{u+=m}),n.logstr+=`actual panel number: ${u} (${L(100*u/_)} %)
|
|
81
|
+
`,n.logstr+=`actual panel surface: ${L(u*d)} m2
|
|
82
|
+
`,n.logstr+=`actual panel power: ${L(u*w)} W
|
|
83
|
+
`;const H=[];for(let m=0;m<a-1;m++){let E=g;if(r===1){const P=a>2?a-2:1,j=(N+m*f/P)%1;switch(y){case 0:E+=c*(1-Math.cos(j*2*Math.PI))/2;break;case 1:E+=c*(1-2*Math.abs(j-.5));break;case 2:E+=c*j;break;case 3:E+=c*(1-j);break;default:E+=c}}H.push(E)}let I=0;const M=[];M.push(0),H.forEach(m=>{I+=m,M.push(I)});const B=[];for(let m=0;m<$-1;m++){let E=x;if(A===1){const P=$>2?$-2:1,j=(D+m*R/P)%1;switch(k){case 0:E+=S*(1-Math.cos(j*2*Math.PI))/2;break;case 1:E+=S*(1-2*Math.abs(j-.5));break;case 2:E+=S*j;break;case 3:E+=S*(1-j);break;default:E+=S}}B.push(E)}let T=0;const F=[];F.push(0),B.forEach(m=>{T+=m,F.push(T)});let p=0,W=0;t.main_direction===0?(p=a*t.LH+I,W=$*t.LV+T):(p=$*t.LH+T,W=a*t.LV+I);const X=p*W/10**6;n.logstr+=`global horizontal width: ${L(p/1e3)} m
|
|
84
|
+
`,n.logstr+=`global vertical height: ${L(W/1e3)} m
|
|
85
|
+
`,n.logstr+=`global area: ${L(X)} m2
|
|
86
|
+
`,n.logstr+=`area efficiency: ${L(100*u*d/X)} %
|
|
87
|
+
`;const K=-p/2,it=-W/2;s=function(m,E){return z(m,E).addSegStrokeA(m+t.LH,E).addSegStrokeA(m+t.LH,E+t.LV).addSegStrokeA(m,E+t.LV).closeSegStroke()};const q=[];b.forEach((m,E)=>{const P=($-m)%2,j=Math.floor(($-m)/2);for(let G=0;G<m;G++){let J=0,ot=0;t.main_direction===0?(J=K+E*t.LH+M[E],ot=it+(j+G)*t.LV+F[j+G],P===1&&(ot+=(t.LV+F[j+G+1]-F[j+G])/2)):(ot=it+E*t.LV+M[E],J=K+(j+G)*t.LH+F[j+G],P===1&&(J+=(t.LH+F[j+G+1]-F[j+G])/2)),q.push([J,ot])}});for(const m of q)o.addMain(s(m[0],m[1]));i.addMain(s(0,0)),n.fig={faceSurface:o,faceOnePanel:i};const Q=n.partName;n.vol={extrudes:q.map((m,E)=>({outName:`subpax_${Q}_panel_${E}`,face:`${Q}_faceOnePanel`,extrudeMethod:O.eLinearOrtho,length:t.LZ,rotate:[0,0,0],translate:[m[0],m[1],0]})),volumes:[{outName:`pax_${Q}`,boolMethod:Z.eUnion,inList:q.map((m,E)=>`subpax_${Q}_panel_${E}`)}]},n.sub={},n.logstr+=`panel-surface drawn successfully!
|
|
88
|
+
`,n.calcErr=!1}catch(d){n.logstr+=d,console.log(d)}return n}var me={pTitle:"Heliostat panel-surface",pDescription:"The surface collecting the solar power",pDef:oe,pGeom:Te};const ie={"gear/gear_wheel_wheel":Vt,"gear/simplified_gear_wheel":He,"heliostat/heliostat":xe,"heliostat/heliostat_2":Pe,"heliostat/base":Re,"heliostat/pole_static":Dt,"heliostat/pole_rotor":Ve,"heliostat/rake":bt,"heliostat/rake_stopper":yt,"heliostat/spider":It,"heliostat/swing":$t,"heliostat/rod":Ie,"heliostat/trapeze":ye,"heliostat/surface":me};function Oe(l){const t=/^.*\//g;return l.replace(t,"")}function ze(l){const t={};for(const s of Object.keys(l)){const n=Oe(s);t[n]=`/${s}`}return t}function Be(l){const t=[];for(const s of Object.keys(l))t.push(s);return t}const We=ze(ie),qe=Be(ie);export{ie as a,We as b,qe as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s;const e=((s=globalThis.__sveltekit_1r7wx22)==null?void 0:s.base)??"";var a;const t=((a=globalThis.__sveltekit_1r7wx22)==null?void 0:a.assets)??e;export{t as a,e as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./entry.
|
|
1
|
+
import{s as e}from"./entry.C3zjkdvH.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p};
|