Arch OBJ/es: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<languages/>

Adicionalmente al exportador estándar de FreeCAD [http://en.wikipedia.org/wiki/Wavefront_.obj_file OBJ], el [[Arch Module/es|Módulo de Arquitectura]] dispone de un exportador alternativo que exporta caras coplanares como caras OBJ completas, en lugar de la triangulación de objetos basados en [[Part Module/es|formas]], como hace el exportador estándar.
<div class="mw-translate-fuzzy">
{{docnav/es|[[Arch DAE|DAE]]|[[Arch JSON|JSON]]|[[Arch_Workbench|Arch Module]]}}
</div>

{{TOCright}}

== Description ==

<div class="mw-translate-fuzzy">
Adicionalmente al exportador estándar de FreeCAD [http://en.wikipedia.org/wiki/Wavefront_.obj_file OBJ], el [[Arch_Workbench/es|Módulo de Arquitectura]] dispone de un exportador alternativo que exporta caras coplanares como caras OBJ completas, en lugar de la triangulación de objetos basados en [[Part_Workbench/es|formas]], como hace el exportador estándar.
</div>

== Exporting without GUI ==

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

In this example, a STEP file is imported, the colors of the [[Shape|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.

{{Code|code=
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 ==

* [https://forum.freecadweb.org/viewtopic.php?f=8&t=37452 Convert STEP to Wavefront OBJ with colors of faces]


==Tutorials==
==Tutorials==

* [[Import_from_STL_or_OBJ|Import from STL or OBJ]]
* [[Import_from_STL_or_OBJ|Import from STL or OBJ]]
* [[Export_to_STL_or_OBJ|Export to STL or OBJ]]
* [[Export_to_STL_or_OBJ|Export to STL or OBJ]]



[[Category:User Documentation/es]]
<div class="mw-translate-fuzzy">
{{docnav/es|[[Arch DAE|DAE]]|[[Arch JSON|JSON]]|[[Arch_Workbench|Arch Workbench]]}}
</div>

{{Arch Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
[[Category:File Formats{{#translation:}}]]

Latest revision as of 12:03, 19 May 2023

Description

Adicionalmente al exportador estándar de FreeCAD OBJ, el Módulo de Arquitectura dispone de un exportador alternativo que exporta caras coplanares como caras OBJ completas, en lugar de la triangulación de objetos basados en formas, como hace el exportador estándar.

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

Tutorials