Export 3mf File with Attributes

We just implemented a build 8.6 that this might work. The code looks like this:

#! python3

import math
import rhinoscriptsyntax as rs
import System
import System.Collections.Generic
import Rhino
import scriptcontext
import Rhino
import os
 
if scriptcontext.doc is not None:
    options = Rhino.FileIO.File3mfWriteOptions()
    options.Metadata["Title"] = "2578R"
    options.Metadata["Designer"] = "MyDesign"
    options.Metadata["Test"] = "Star"
    options.MoveOutputToPositiveXYZOctant = True;
    options_dictionary = options.ToDictionary()
 
 #Get the filename to create
    filter = "3MF File (*.c3mf)|*.3mf||"
    filename = rs.SaveFileName("Save 3MF as", filter)

    if filename is not None:
        success = scriptcontext.doc.Export(filename, options_dictionary)
    if success:
        print("Successfully exported sample.3mf")
    else:
        print("Error while trying to export sample.3mf")

The Metadata can contain any key and string value

2 Likes