3mfExporter
[Desktop Automation]
This class is used to export 3MF files from a Lua script. An instance is created with system:create3mfexporter();
.
Properties
Property | Read/write | Type | Description |
---|---|---|---|
exportmultiproperties | Read / Write | Boolean | Flag to toggle Multi-Property 3MF export. All traditional textures and colors are removed when this flag is set to true . |
writetextures | Read/write | Boolean | Flag to switch export textures to the 3MF on or off |
writematerials | Read/write | Boolean | Flag to switch export materials to the 3MF on or off |
writecolors | Read/write | Boolean | Flag to switch export colors to the 3MF on or off |
count | Read | Number | Number of entries to export |
Methods
Name | Syntax | Description |
---|---|---|
addattachment | Exporter:addattachment(Name:String; Content:String; Namespace:String) | Sets the attachment of the 3MF to be exported |
exporttofile | Exporter:exporttofile(Name:String) | Exports the content to a file |
setscenethumbnail | Exporter:setscenethumbnail(Thumbnail:Object) | Sets an Image Object as thumbnail for the 3MF |
add | Exporter:add(mesh) | Add a mesh to be exported. Mesh can be a LUATrayMesh or a simple mesh object. Returns an export entry. |
Example
-- Add simple mesh objects into one 3mf-file
local exporter = system:create3mfexporter();
for i, traymesh in pairs(meshes) do
local luamesh = traymesh.mesh;
local entry = exporter:add(luamesh);
entry.name = traymesh.name;
entry.grouppath = '3mfexport/unsupported';
if traymesh.hassupport then
entry:setsupport(traymesh.support);
entry.grouppath = '3mfexport/supported';
end;
end;
exporter:exporttofile("C:/temp/3mf_export_meshes_demo.3mf");
-- Add traymeshes directly into one 3MF file
system:log('3mf part export');
local exporter = system:create3mfexporter();
for i, traymesh in pairs(meshes) do
exporter:add(traymesh);
end;
exporter:exporttofile("C:/temp/3mf_export_parts_demo.3mf");