Arch SplitMesh: Difference between revisions

From FreeCAD Documentation
(Code more complete)
No edit summary
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>
<!--T:11-->
{{docnav
|[[Arch_CloneComponent|Clone component]]
|[[Arch_MeshToShape|Mesh To Shape]]
|[[Arch_Module|Arch]]
|IconL=Arch_Component_Clone.svg
|IconC=Workbench_Arch.svg
|IconR=Arch_MeshToShape.svg
}}

<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
Line 6: Line 16:
|MenuLocation=Arch → Utilities → Split Mesh
|MenuLocation=Arch → Utilities → Split Mesh
|Workbenches=[[Arch Module|Arch]]
|Workbenches=[[Arch Module|Arch]]
|SeeAlso=[[Arch SelectNonSolidMeshes]], [[Arch MeshToShape]]
|SeeAlso=[[Arch SelectNonSolidMeshes|Arch SelectNonSolidMeshes]], [[Arch MeshToShape|Arch MeshToShape]]
}}
}}


Line 14: Line 24:
This tool splits a selected [[Mesh Module|Mesh]] object into its separate components
This tool splits a selected [[Mesh Module|Mesh]] object into its separate components


==How to use== <!--T:4-->
==Usage== <!--T:4-->


<!--T:5-->
<!--T:5-->
# Select a mesh object.
# Select a mesh object.
# Press the {{Button|[[Image:Arch SplitMesh.png|16px]] [[Arch SplitMesh|Split Mesh]]}} entry in {{MenuCommand|Arch → Utilities → Split Mesh}}.
# Press the {{Button|[[Image:Arch_SplitMesh.svg|16px]] [[Arch SplitMesh|Split Mesh]]}} entry in {{MenuCommand|Arch → Utilities → Split Mesh}}.


==Scripting== <!--T:6-->
==Scripting== <!--T:6-->
{{Emphasis|See also:}} [[Arch API]] and [[FreeCAD Scripting Basics]].
{{Emphasis|See also:}} [[Arch API|Arch API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


<!--T:7-->
<!--T:7-->
The SplitMesh tool can be used in [[macros]] and from the [[Python]] console by using the following function:
The SplitMesh tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:

</translate>
</translate>
{{Code|code=
{{Code|code=
Line 36: Line 47:
* {{incode|new_list}} is a list of all the individual components that make the mesh.
* {{incode|new_list}} is a list of all the individual components that make the mesh.


<!--T:12-->
Example:
Example:

</translate>
</translate>
{{Code|code=
{{Code|code=
Line 56: Line 69:
<translate>
<translate>


<!--T:10-->
<!--T:13-->
{{docnav
{{Arch Tools navi}}
|[[Arch_CloneComponent|Clone component]]
{{Userdocnavi}}
|[[Arch_MeshToShape|Mesh To Shape]]
|[[Arch_Module|Arch]]
|IconL=Arch_Component_Clone.svg
|IconC=Workbench_Arch.svg
|IconR=Arch_MeshToShape.svg
}}

</translate>
</translate>
{{Arch Tools navi{{#translation:}}}}

{{Userdocnavi{{#translation:}}}}

Revision as of 20:49, 20 February 2020

Arch SplitMesh

Menu location
Arch → Utilities → Split Mesh
Workbenches
Arch
Default shortcut
None
Introduced in version
-
See also
Arch SelectNonSolidMeshes, Arch MeshToShape

Description

This tool splits a selected Mesh object into its separate components

Usage

  1. Select a mesh object.
  2. Press the Split Mesh entry in Arch → Utilities → Split Mesh.

Scripting

See also: Arch API and FreeCAD Scripting Basics.

The SplitMesh tool can be used in macros and from the Python console by using the following function:

new_list = splitMesh(obj, mark=True)
  • Splits the given mesh object (obj) into separated components.
  • If mark is True non-manifold components will be painted red.
  • new_list is a list of all the individual components that make the mesh.

Example:

import FreeCAD, Draft, Arch, Mesh, MeshPart

Line = Draft.makeWire([FreeCAD.Vector(0, 0, 0),FreeCAD.Vector(2000, 2000, 0)])
Wall = Arch.makeWall(Line, width=150, height=3000)
FreeCAD.ActiveDocument.recompute()

Shape = Wall.Shape.copy(False)
Shape.Placement = Wall.getGlobalPlacement()

mesh_obj = FreeCAD.ActiveDocument.addObject("Mesh::Feature", "Mesh")
mesh_obj.Mesh = MeshPart.meshFromShape(Shape=Shape, MaxLength=520)
mesh_obj.ViewObject.DisplayMode = "Flat Lines"

new_list = Arch.splitMesh(mesh_obj)