| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 | const Utils = {    download: function (e, t, o = !0) {        o = o ? (window.webkitURL || window.URL).createObjectURL(t) : t;        const n = window.document.createElement("a"),            r = (n.href = o, n.download = e, document.createEvent("MouseEvents"));        r.initEvent("click", !0, !1), n.dispatchEvent(r), window.URL.revokeObjectURL(o)    },    svgString2Image: function (e, t, o, n, r) {        n = n || "png";        const a = document.createElement("canvas"),            i = a.getContext("2d"),            s = (a.width = t, a.height = o, new Image);        s.onload = function () {            i.clearRect(0, 0, t, o), i.drawImage(s, 0, 0, t, o);            var e = a.toDataURL("image/" + n);            r(e)        }, s.src = e    },    requestFormData: function (e, t, o, n = null, r = null) {        $.ajax({            method: t,            url: e,            data: o,            processData: !1,            contentType: !1,            success: e => {                n && n(e)            },            error: e => {                r && r()            }        })    },    request: function (e, t, o, n = null, r = null) {        $.ajax({            type: t,            url: e,            dataType: "json",            data: o,            success: e => {                n && n(e)            },            error: e => {                r && r()            }        })    },    logg: function (e, t, o = !0, n = !1, r = null, a = null) {        PNotify.removeAll();        const i = {                title: e,                text: "",                type: t,                hide: o,                shadow: !0,                addclass: r || "stack-topleft",                stack: {                    dir1: "right",                    dir2: "down",                    push: "bottom",                    firstpos1: 70,                    context: $("#pNotifyContext")                }            },            s = (n || (i.buttons = {                closer: !1,                sticker: !1            }), new PNotify(i));        s.get().click(() => {            o && s.remove(), a && a()        })    },    formatVector3: function (e, t, o = !1) {        return o ? [parseFloat(e.x.toFixed(t)), parseFloat(e.y.toFixed(t)), parseFloat(e.z.toFixed(t))] : new BABYLON.Vector3(parseFloat(e.x.toFixed(t)), parseFloat(e.y.toFixed(t)), parseFloat(e.z.toFixed(t)))    },    boxes: function (e, t = "#ff0000", o = .3) {        const n = new BABYLON.Mesh.CreateBox("asd", o, scene);        n.renderOverlay = !0, n.overlayColor = BABYLON.Color3.FromHexString(t), n.position = e    },    validateEmail(e) {        return /\S+@\S+\.\S+/.test(e)    },    setCookie(e, t, o) {        const n = new Date;        n.setTime(n.getTime() + 24 * o * 60 * 60 * 1e3);        o = "expires=" + n.toUTCString();        document.cookie = e + "=" + t + ";" + o + ";path=/"    },    getCookie(e) {        const t = new RegExp(e + "=([^;]+)");        e = t.exec(document.cookie);        return null != e ? unescape(e[1]) : null    },    getImgFromUrl(e) {        const t = new Image;        t.src = e, t.onload = function () {            logoLogiqs = t        }    },    round5(e) {        return parseFloat((.005 * Math.round(e / .005)).toFixed(4))    },    addMatHighLight(e, t = null) {        var o = t || BABYLON.Color3.Green(),            t = t ? new BABYLON.Color4(1, 1, 0, 0) : new BABYLON.Color4(0, 1, 0, 0);        matManager.matHighLight.neutralColor = t, e && !matManager.matHighLight.hasMesh(e) && matManager.matHighLight.addMesh(e, o)    },    removeMatHighLight(e) {        matManager.matHighLight.neutralColor = new BABYLON.Color4(0, 0, 0, 0), e && matManager.matHighLight.hasMesh(e) && matManager.matHighLight.removeMesh(e)    },    getFloorPosition() {        var e = scene.pick(scene.pointerX, scene.pointerY, function (e) {            return "floor" == e.id        });        return !!e.hit && e.pickedPoint    },    createButonUI(e) {        const t = BABYLON.GUI.Button.CreateSimpleButton("butRuler", e);        return t.width = "20px", t.height = "20px", t.fontSize = "13px", t.fontFamily = "FontAwesome", t.textBlock.top = "3px", t.textBlock.left = "1px", t.background = "rgba(25, 25, 25, 1)", t.color = "rgba(222, 222, 222, 1)", t.hoverCursor = "pointer", t.cornerRadius = 5, t.thickness = 1, t    },    createInputTextUI() {        const e = new BABYLON.GUI.InputText("labelRuler");        return e.width = "40px", e.height = "15px", e.color = "#555555", e.fontSize = "12px", e.fontWeight = "bold", e.fontFamily = "Arial", e.background = "transparent", e.disabledColor = "transparent", e.isEnabled = !1, e.linkOffsetY = 8, e.thickness = 0, e.margin = "0px", e    },    createTooltipUI(e) {        const t = new BABYLON.GUI.Rectangle("tooltipRuler"),            o = (t.width = 8 * e.length + "px", t.height = "20px", t.cornerRadius = 3, t.thickness = 1, t.isVisible = !1, t.background = "rgba(25, 25, 25, 0.8)", new BABYLON.GUI.TextBlock("tooltipTextRuler"));        return o.text = e, o.top = "2px", o.color = "rgba(250, 250, 250, 1)", o.fontSize = "15px", t.addControl(o), t    },    checkForProperty(e, t) {        e.hasOwnProperty("colors") && (t.colors = e.colors), e.hasOwnProperty("motor") && (t.motor = e.motor), e.hasOwnProperty("lifting") && (t.lifting = e.lifting), e.hasOwnProperty("positioning") && (t.positioning = e.positioning), e.hasOwnProperty("puller") && (t.puller = [...e.puller]), e.hasOwnProperty("benches") && (t.benches = e.benches), e.hasOwnProperty("arrows") && (t.arrows = [...e.arrows]), e.hasOwnProperty("atrack") && (t.atrack = e.atrack), e.hasOwnProperty("support") && (t.support = e.support), e.hasOwnProperty("pipes") && (t.pipes = e.pipes), e.hasOwnProperty("atDist") && (t.atDist = e.atDist)    },    createLine(e) {        var t = [new BABYLON.Vector3(-e.labelScale / 2, 0, e.length / 2), new BABYLON.Vector3(e.labelScale / 2, 0, e.length / 2)],            o = [new BABYLON.Vector3(-e.labelScale / 2, 0, -e.length / 2), new BABYLON.Vector3(e.labelScale / 2, 0, -e.length / 2)],            n = [new BABYLON.Vector3(0, 0, e.length / 2), new BABYLON.Vector3(0, 0, -e.length / 2)];        let r = new BABYLON.Color4(0, 0, 0, 1);        e.color && (r.r = e.color.r, r.g = e.color.g, r.b = e.color.b);        const a = new BABYLON.MeshBuilder.CreateLineSystem("lines", {            lines: [t, o, n]        }, scene);        return a.isPickable = !1, a.color = r, a    },    solvePromise(t, o) {        return new Promise(e => {            setTimeout(() => {                e(t)            }, o)        })    },    createThinInstance(e, t) {        var o = t.position.length;        if (0 !== o) {            const r = [],                a = [],                i = [],                s = [],                l = [];            var n = new Float32Array(16 * o);            for (let e = 0; e < o; ++e) a.push(new BABYLON.Vector3(t.scaling[e][0], t.scaling[e][1], t.scaling[e][2])), r.push(new BABYLON.Vector3(t.position[e][0], t.position[e][1], t.position[e][2])), i.push(new BABYLON.Vector3(t.rotation[e][0], t.rotation[e][1], t.rotation[e][2])), s.push(new BABYLON.Quaternion), l.push(new BABYLON.Matrix), BABYLON.Quaternion.FromEulerAnglesToRef(i[e].x, i[e].y, i[e].z, s[e]), BABYLON.Matrix.ComposeToRef(a[e], s[e], r[e], l[e]), l[e].copyToArray(n, 16 * e);            e.makeGeometryUnique(), e.setEnabled(t.visibility), e.doNotSyncBoundingInfo = !0, e.thinInstanceSetBuffer("matrix", n), e.thinInstanceRefreshBoundingInfo(!1)        }    }};
 |