Class: Mittsu::ThreeMFExporter
- Inherits:
-
Object
- Object
- Mittsu::ThreeMFExporter
- Defined in:
- lib/mittsu/3mf/exporter.rb
Instance Method Summary collapse
- #export(object, filename) ⇒ Object (also: #parse)
-
#initialize(options = {}) ⇒ ThreeMFExporter
constructor
A new instance of ThreeMFExporter.
Constructor Details
#initialize(options = {}) ⇒ ThreeMFExporter
Returns a new instance of ThreeMFExporter.
6 7 |
# File 'lib/mittsu/3mf/exporter.rb', line 6 def initialize( = {}) end |
Instance Method Details
#export(object, filename) ⇒ Object Also known as: parse
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mittsu/3mf/exporter.rb', line 9 def export(object, filename) Zip::OutputStream.open(filename) do |zip| # OPC content types file store(zip, "[Content_Types].xml", content_types_file) # Add models models = [object] model_names = models.map do |model| # Set a model name if there isn't one model.name ||= SecureRandom.uuid # Store model name = filesystem_safe_name(model) store(zip, "3D/#{name}.model", model_file(model)) # Remember the name for later name end # Add OPC rels file with list of contained models store(zip, "_rels/.rels", rels_file(model_names)) end true end |