當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript makerjs.exporter類代碼示例

本文整理匯總了TypeScript中makerjs.exporter的典型用法代碼示例。如果您正苦於以下問題:TypeScript exporter類的具體用法?TypeScript exporter怎麽用?TypeScript exporter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了exporter類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: toStl

            function toStl(model: MakerJs.IModel, options: MakerJs.exporter.IJscadCsgOptions) {

                if (!deps[MakerJsPlaygroundExport.ExportFormat.Stl]) {
                    importScripts(
                        '../../../external/jscad/csg.js',
                        '../../../external/jscad/stl-serializer.js'
                    );
                    deps[MakerJsPlaygroundExport.ExportFormat.Stl] = true;
                }

                //make sure size is in mm for STL
                model = makerjs.model.convertUnits(model, makerjs.unitType.Millimeter);

                const { CAG }: { CAG: typeof jscad.CAG } = require('@jscad/csg');
                const stlSerializer: jscad.StlSerializer = require('@jscad/stl-serializer');

                options.statusCallback = function (status) {
                    result.percentComplete = status.progress;
                    postMessage(result);
                }

                return makerjs.exporter.toJscadSTL(CAG, stlSerializer, model, options);
            }
開發者ID:Microsoft,項目名稱:maker.js,代碼行數:23,代碼來源:export-worker.ts

示例2: toPdf

            function toPdf(model: MakerJs.IModel, exportOptions: MakerJs.exporter.IPDFRenderOptions) {

                if (!deps[MakerJsPlaygroundExport.ExportFormat.Pdf]) {
                    importScripts(
                        '../../../external/text-encoding/encoding-indexes.js',
                        '../../../external/text-encoding/encoding.js',
                        '../../../external/PDFKit/pdfkit.js',
                        'string-reader.js'
                    );
                    deps[MakerJsPlaygroundExport.ExportFormat.Pdf] = true;
                }

                function complete(pdfDataString: string) {
                    result.text = pdfDataString;
                    result.percentComplete = 100;
                    postMessage(result);
                }

                //TODO: watermark
                //TODO: title, author, grid from options
                var pdfOptions: PDFKit.PDFDocumentOptions = {
                    compress: false,
                    info: {
                        Producer: 'MakerJs',
                        Author: 'MakerJs'
                    }
                };
                var doc: PDFKit.PDFDocument = new PDFDocument(pdfOptions);
                var reader = new StringReader(complete);
                var stream = doc.pipe(reader);

                //TODO: break up model across pages

                makerjs.exporter.toPDF(doc, model, exportOptions);

                doc.end();
            }
開發者ID:Microsoft,項目名稱:maker.js,代碼行數:37,代碼來源:export-worker.ts

示例3:

    [0 - SCALE, 0 - SCALE]
  );
  layer.models = {border, holes};
  layer.layer = name;
  // layerOptions[name] = {fill: `hsla(${360 / PAGES * i}, 100%, 50%, 1)`};
  // layerOptions[name] = {fill: i%2===0 ? 'grey' : 'black'};
  const x = i % COLS * (BOARD + MARGIN);
  const y = Math.floor(i / COLS) * (BOARD + MARGIN);
  MakerJs.model.move(layer, [x, -y]);
  expanded[name] = layer;
}

const cut = {
  models: {
    // line: makerPath,
    expanded: {models: expanded}
  }
};

console.log(cut);
const svg = MakerJs.exporter.toSVG(cut, {
  // useSvgPathOnly: !DEBUG,
  // annotate: DEBUG,
  fill: 'white',
  // stroke: 'none',
  layerOptions
});
document.write(svg);

document.body.style.backgroundColor = 'hsla(0, 0%, 90%, 1)';
開發者ID:forresto,項目名稱:sketch,代碼行數:30,代碼來源:labyrinth-03.maker.ts

示例4: toDXF

 function toDXF(model: MakerJs.IModel, options: MakerJs.exporter.IDXFRenderOptions) {
     if (!options.units) {
         options.units = model.units || makerjs.unitType.Millimeter;
     }
     return makerjs.exporter.toDXF(model, options);
 }
開發者ID:Microsoft,項目名稱:maker.js,代碼行數:6,代碼來源:export-worker.ts


注:本文中的makerjs.exporter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。