Arch CutPlane: Difference between revisions

From FreeCAD Documentation
(Module to Workbench renaming.)
(V0.22 -> V1.0)
 
(20 intermediate revisions by 2 users not shown)
Line 4: Line 4:
<!--T:13-->
<!--T:13-->
{{Docnav
{{Docnav
|[[Arch_PipeConnector|PipeConnector]]
|[[Arch_CutLine|Cut with a line]]
|[[Arch_Add|Add component]]
|[[Arch_Add|Add]]
|[[Arch_Workbench|Arch]]
|[[Arch_Workbench|Arch]]
|IconL=Arch_CutLine.svg
|IconL=Arch_PipeConnector.svg
|IconR=Arch_Add.svg
|IconR=Arch_Add.svg
|IconC=Workbench_Arch.svg
|IconC=Workbench_Arch.svg
Line 15: Line 15:
{{GuiCommand
{{GuiCommand
|Name=Arch CutPlane
|Name=Arch CutPlane
|MenuLocation=Arch → Cut Plane
|MenuLocation=Arch → Cut with plane
|Workbenches=[[Arch_Workbench|Arch]]
|Workbenches=[[Arch_Workbench|Arch]]
|SeeAlso=[[Arch_CutLine|Arch CutLine]], [[Arch_Remove|Arch Remove]]
}}
}}


Line 23: Line 22:


<!--T:2-->
<!--T:2-->
The '''Arch CutPlane''' tool cuts a solid Arch object like an [[Arch_Wall|Arch Wall]] or [[Arch_Structure|Arch Structure]] with a planar face.
The Cut Plane tool allows you to cut an Arch object according to a plane:
* You can cut an Arch object with the selected face, normal or opposite of the face plane.
* This add a subtraction component CutVolume to the Arch object

<!--T:11-->
[[Image:Arch CutPlane example.jpg|640px]]


</translate>
[[Image:Arch_CutPlane_example.jpg|400px]]
<translate>
<!--T:3-->
<!--T:3-->
{{Caption|Left: Before applying the CutPlane tool. Middle: resulting wall after the cut is done. Right: yet another optional result}}
{{Caption|Left: Before applying the CutPlane tool. Middle: resulting wall after the cut is done. Right: yet another optional result}}
Line 36: Line 33:


<!--T:5-->
<!--T:5-->
# If the cutting plane is to be derived from a straight edge ({{Version|1.0}}) optionally align the [[Draft_SelectPlane|working plane]]:
# Select the object to be cut, then the face (the face must be the last one you selected, and must be selected in the [[3D View]]).
#* The selected edge cannot be parallel to the normal of the working plane.
# Press the {{Button|[[Image:Arch_CutPlane.svg|24px]] [[Arch CutPlane|Cut Plane]]}} button.
#* The generated cutting face will be perpendicular to the working plane.
# Choose if the object is cut '''behind''' the normal face or in'''front''' of the normal face.
# Click the {{Button|OK}} button.
# Select the object to be cut.
# Do one of the following:
#* Select an object with a single planar face. {{Version|1.0}}
#* Select a planar face in the [[3D_view|3D view]].
#* Select an object with a single straight edge. {{Version|1.0}}
#* Select a straight edge in the [[3D_view|3D view]]. {{Version|1.0}}
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Arch_CutPlane.svg|16px]] [[Arch_CutPlane|Cut with plane]]}} button.
#* Select the {{MenuCommand|Arch → [[Image:Arch_CutPlane.svg|16px]] Cut with plane}} option from the menu.
# Choose {{MenuCommand|Behind}} or {{MenuCommand|Front}} to indicate on which side of the cutting face material should be removed.
# Press the {{Button|OK}} button.


==Scripting== <!--T:6-->
==Scripting== <!--T:6-->

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


<!--T:7-->
<!--T:7-->
The CutPlane tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:
The CutPlane 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 60: Line 70:
<!--T:14-->
<!--T:14-->
Example:
Example:

</translate>
</translate>
{{Code|code=
{{Code|code=
Line 101: Line 112:
FreeCAD.ActiveDocument.recompute()
FreeCAD.ActiveDocument.recompute()
}}
}}

<translate>
<translate>


<!--T:15-->
<!--T:15-->
{{Docnav
{{Docnav
|[[Arch_PipeConnector|PipeConnector]]
|[[Arch_CutLine|Cut with a line]]
|[[Arch_Add|Add component]]
|[[Arch_Add|Add]]
|[[Arch_Workbench|Arch]]
|[[Arch_Workbench|Arch]]
|IconL=Arch_CutLine.svg
|IconL=Arch_PipeConnector.svg
|IconR=Arch_Add.svg
|IconR=Arch_Add.svg
|IconC=Workbench_Arch.svg
|IconC=Workbench_Arch.svg

Latest revision as of 09:51, 21 April 2024

Arch CutPlane

Menu location
Arch → Cut with plane
Workbenches
Arch
Default shortcut
None
Introduced in version
-
See also
None

Description

The Arch CutPlane tool cuts a solid Arch object like an Arch Wall or Arch Structure with a planar face.

Left: Before applying the CutPlane tool. Middle: resulting wall after the cut is done. Right: yet another optional result

Usage

  1. If the cutting plane is to be derived from a straight edge (introduced in version 1.0) optionally align the working plane:
    • The selected edge cannot be parallel to the normal of the working plane.
    • The generated cutting face will be perpendicular to the working plane.
  2. Select the object to be cut.
  3. Do one of the following:
  4. There are several ways to invoke the command:
    • Press the Cut with plane button.
    • Select the Arch → Cut with plane option from the menu.
  5. Choose Behind or Front to indicate on which side of the cutting face material should be removed.
  6. Press the OK button.

Scripting

See also: Arch API and FreeCAD Scripting Basics.

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

cutObj = cutComponentwithPlane(archObject, cutPlane, sideFace)
  • Creates a cutObj object from the given archObject, which is cut by cutPlane, which is the face of another object.
    • archObject should be a SelectionObject obtained from FreeCADGui.Selection.SelectionEx()[0].
    • cutPlane should be a FaceObject obtained from FreeCADGui.Selection.SelectionEx()[0].SubObjects[0].
  • sideFace specifies on which side of the FaceObject a volume will be created; this volume will then be used to subtract from the archObject. If sideFace is 0 it will create a volume in the rear of the face, otherwise it create it in front of the face.

Example:

import FreeCAD, FreeCADGui, Draft, Arch

p1 = FreeCAD.Vector(0, 0, 0)
p2 = FreeCAD.Vector(2000, 2000, 0)

Line = Draft.makeWire([p1, p2])
Wall = Arch.makeWall(Line, width=150, height=2000)

p3 = FreeCAD.Vector(0, 2000, 0)
p4 = FreeCAD.Vector(3000, 0, 0)

Line2 = Draft.makeWire([p3, p4])
Wall2 = Arch.makeWall(Line2, width=150, height=2000)
FreeCAD.ActiveDocument.recompute()

# Select the Wall
main_object = FreeCADGui.Selection.getSelectionEx()[0]

# Select the face of Wall2
selection = FreeCADGui.Selection.getSelectionEx()[0]
cut_face = selection.SubObjects[0]

cutObj = Arch.cutComponentwithPlane(main_object, cut_face, 0)
FreeCAD.ActiveDocument.recompute()

Wall3 = Draft.move(Wall, FreeCAD.Vector(-4000, 0, 0), copy=True)
Wall4 = Draft.move(Wall2, FreeCAD.Vector(-4000, 0, 0), copy=True)
FreeCAD.ActiveDocument.recompute()

# Select the Wall3
main_object2 = FreeCADGui.Selection.getSelectionEx()[0]

# Select the face of Wall4
selection2 = FreeCADGui.Selection.getSelectionEx()[0]
cut_face2 = selection2.SubObjects[0]

cutObj2 = Arch.cutComponentwithPlane(main_object2, cut_face2, 1)
FreeCAD.ActiveDocument.recompute()