Thanks to visit codestin.com
Credit goes to github.com

Skip to content

a2plus assembly exporting to stl of parts in individual files #626

@missionsave

Description

@missionsave

I got this code working, but the stl files looses the position and rotation of the parts in the assembly a2plus, how to fix that?

`

import FreeCAD

import Mesh

doc = App.ActiveDocument

export_directory = "./"
 
for obj in doc.Objects: 
  if obj.isDerivedFrom("Part::Feature"): 
    global_transform = obj.Placement

    temp_obj = doc.addObject("Part::Feature", obj.Label + "_temp")
    temp_obj.Shape = obj.Shape

    temp_obj.Placement = global_transform

    stl_path = export_directory + obj.Label + ".stl"
    Mesh.export([temp_obj], stl_path)

    doc.removeObject(temp_obj.Name)`

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions