Arch CloseHoles: Difference between revisions

From FreeCAD Documentation
(API and scripting links)
(Code more complete)
Line 27: Line 27:
</translate>
</translate>
{{Code|code=
{{Code|code=
closeHole (shape)
solid = closeHole(shape)
}}
}}
<translate>
<translate>

<!--T:8-->
<!--T:8-->
* Closes a hole in a {{incode|shape}}, which is a {{incode|Part.Shape}}, and returns the new {{incode|solid}} object.
closes a hole in an open shape

Example:
</translate>
{{Code|code=
import FreeCAD, Draft, Arch

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

Box = FreeCAD.ActiveDocument.addObject("Part::Box", "Box")
Box.Length = 900
Box.Width = 450
Box.Height = 2000
FreeCAD.ActiveDocument.recompute()

Draft.rotate(Box, 45)
Draft.move(Box, FreeCAD.Vector(1000, 700, 0))

Arch.removeComponents(Box, Wall)
FreeCAD.ActiveDocument.recompute()

solid = Arch.closeHole(Wall.Shape)
}}
<translate>


<!--T:9-->
<!--T:9-->

Revision as of 02:38, 2 December 2018

Arch CloseHoles

Menu location
Arch → Utilities → Close Holes
Workbenches
Arch
Default shortcut
None
Introduced in version
-
See also
Arch Check

Description

This tool identifies holes (circular sequence of open edges) in a Shape object and attempts to close it by adding it a new face made from that edges sequence. You must still verify yourself that the result is a solid, though.

How to use

  1. Select a Shape object.
  2. Press the Close Holes entry in Arch → Utilities → Close Holes.

Scripting

See also: Arch API and FreeCAD Scripting Basics.

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

solid = closeHole(shape)
  • Closes a hole in a shape, which is a Part.Shape, and returns the new solid object.

Example:

import FreeCAD, Draft, Arch

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

Box = FreeCAD.ActiveDocument.addObject("Part::Box", "Box")
Box.Length = 900
Box.Width = 450
Box.Height = 2000
FreeCAD.ActiveDocument.recompute()

Draft.rotate(Box, 45)
Draft.move(Box, FreeCAD.Vector(1000, 700, 0))

Arch.removeComponents(Box, Wall)
FreeCAD.ActiveDocument.recompute() 

solid = Arch.closeHole(Wall.Shape)