Difference between revisions of "Arch OBJ/de"

From FreeCAD Documentation
Jump to navigation Jump to search
(Created page with "== Exportieren ohne GUI ==")
(Created page with "== Weitere Informationen ==")
Line 38: Line 38:
== More information ==
== Weitere Informationen ==
* [https://forum.freecadweb.org/viewtopic.php?f=8&t=37452 Convert STEP to Wavefront OBJ with colors of faces]
* [https://forum.freecadweb.org/viewtopic.php?f=8&t=37452 Convert STEP to Wavefront OBJ with colors of faces]

Revision as of 14:03, 31 July 2021

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎polski • ‎português do Brasil • ‎čeština • ‎русский
Arrow-left.svg Vorherige: DAE
Nächste: JSON Arrow-right.svg


Zusätzlich zur Standard-FreeCAD OBJ-Exportfunktion hat das Arch-Modul eine alternative Exportfunktion, die nebeneinander liegende Flächen als vollständige (whole) Flächen exportiert, anstatt als dreiecksbasierte Formteil-Objekte, wie es die Standard-Exportfunktion tut.

Exportieren ohne GUI

Exporting without the graphical interface is possible from the command line, using the Mesh Workbench exporter only.

In this example, a STEP file is imported, the colors of the Shape are saved, then a mesh is created from it, the colors of the original object are re-applied to the faces of the new mesh, which is then exported to OBJ format. Since this is done with the Mesh Workbench, the result is a triangulated mesh.

import Mesh
import MeshPart
import Import

data = Import.open("example.stp")
shape = data[0][0].Shape
shape_colors = data[0][1]

mesh = MeshPart.meshFromShape(Shape=shape, LinearDeflection=0.1, Segments=True)

face_colors = [(0, 0, 0)] * mesh.CountFacets

for i in range(mesh.countSegments()):
    color = shape_colors[i]
    segm = mesh.getSegment(i)
    for j in segm:
        face_colors[j] = color

mesh.write(Filename="new_example.obj", Material=face_colors, Format="obj")

Weitere Informationen


Arrow-left.svg Vorherige: DAE
Nächste: JSON Arrow-right.svg