Arch: File OBJ

From FreeCAD Documentation
Jump to navigation Jump to search
This page is a translated version of the page Arch OBJ and the translation is 55% complete.
Other languages:
Deutsch • ‎English • ‎Novial • ‎español • ‎français • ‎italiano • ‎polski • ‎čeština • ‎русский
Arrow-left.svg DAE Pagina precedente:
Pagina successiva: JSON Arrow-right.svg

Descrizione

Oltre all'esportatore OBJ standard di FreeCAD, il Modulo Architettura dispone di un esportatore alternativo che esporta le facce complanari come facce OBJ intere, invece di triangolazioni eseguite su oggetti costruiti su forme di base, come fa l'esportatore standard.

Exporting without 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")

More information

Tutorial

Arrow-left.svg DAE Pagina precedente:
Pagina successiva: JSON Arrow-right.svg