本文整理汇总了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;未经允许,请勿转载。 |
请发表评论