Arch Fence: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
m (<translate>)
Line 54: Line 54:
<!--T:18-->
<!--T:18-->
Example.
Example.
</translate>

{{Code|code=
{{Code|code=
import FreeCAD
import FreeCAD
Line 59: Line 61:
import Arch
import Arch


<!--T:19-->
parts = []
parts = []


<!--T:20-->
parts.append(Part.makeBox(2000, 50, 30, FreeCAD.Vector(0, 0, 1000 - 30)))
parts.append(Part.makeBox(2000, 50, 30, FreeCAD.Vector(0, 0, 1000 - 30)))
parts.append(Part.makeBox(2000, 50, 30))
parts.append(Part.makeBox(2000, 50, 30))
Line 68: Line 68:
parts.append(Part.makeBox(20, 20, 1000 - 60, FreeCAD.Vector(1980, 15, 30)))
parts.append(Part.makeBox(20, 20, 1000 - 60, FreeCAD.Vector(1980, 15, 30)))


<!--T:21-->
for i in range(8):
for i in range(8):
parts.append(Part.makeBox(20, 20, 1000 - 60, FreeCAD.Vector((2000 / 9 * (i + 1)) - 10, 15, 30)))
parts.append(Part.makeBox(20, 20, 1000 - 60, FreeCAD.Vector((2000 / 9 * (i + 1)) - 10, 15, 30)))


<!--T:22-->
Part.show(Part.makeCompound(parts), "Fence_section")
Part.show(Part.makeCompound(parts), "Fence_section")
fence_section = FreeCAD.ActiveDocument.Fence_section
fence_section = FreeCAD.ActiveDocument.Fence_section


<!--T:23-->
sketch = FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject", "Path")
sketch = FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject", "Path")
sketch.Placement = FreeCAD.Placement(FreeCAD.Vector(0, 0, 0), FreeCAD.Rotation(0, 0, 0, 1))
sketch.Placement = FreeCAD.Placement(FreeCAD.Vector(0, 0, 0), FreeCAD.Rotation(0, 0, 0, 1))
Line 82: Line 79:
sketch.addGeometry(Part.LineSegment(FreeCAD.Vector(20000, 0, 0), FreeCAD.Vector(20000, 20000, 0)), False)
sketch.addGeometry(Part.LineSegment(FreeCAD.Vector(20000, 0, 0), FreeCAD.Vector(20000, 20000, 0)), False)


<!--T:24-->
post = Part.makeBox(100, 100, 1000, FreeCAD.Vector(0, 0, 0))
post = Part.makeBox(100, 100, 1000, FreeCAD.Vector(0, 0, 0))
Part.show(post, "Post")
Part.show(post, "Post")
post = FreeCAD.ActiveDocument.Post
post = FreeCAD.ActiveDocument.Post


<!--T:25-->
Fence = Arch.buildFence(fence_section, post, sketch)
Fence = Arch.buildFence(fence_section, post, sketch)
}}
}}
<translate>

<!--T:17-->
<!--T:17-->
{{docnav|[[Arch_Frame|Frame]]|[[Arch_Equipment|Equipment]]|[[Arch_Module|Arch]] | IconL=Arch_Frame.svg|IconC=Workbench_Arch.svg|IconR=Arch_Equipment.svg}}
{{docnav|[[Arch_Frame|Frame]]|[[Arch_Equipment|Equipment]]|[[Arch_Module|Arch]] | IconL=Arch_Frame.svg|IconC=Workbench_Arch.svg|IconR=Arch_Equipment.svg}}

Revision as of 08:08, 14 May 2019

Arch Fence

Menu location
Arch → Fence
Workbenches
Arch
Default shortcut
None
Introduced in version
0.19
See also
None

Description

The Arch Fence is a object that builds a fence by repeating a single fence post and section along a given path.

How to use

Creating from scratch

  1. Use a workbench of your choice to create a single fence post and a single section.
  2. Create the path the fence should follow using the Sketcher Workbench or Draft Workbench.
  3. Switch back to the Arch Workbench.
  4. Select the section, post and path in exactly that order.
  5. Press the Arch Fence button

Options

For now the tool assumes the following

  1. The Path is drawn on the XY-Plane
  2. Section and Post are drawn at the origin so that they stand upright in front view

Properties

Data

  • DataPath: The path the fence should follow
  • DataPost: A single fence post to repeat
  • DataSection: A single section to repeat
  • DataNumber Of Posts: The total number of posts used to build the fence. This is calculated automatically.
  • DataNumber Of Sections: The total number of sections used to build the fence. This is calculated automatically.

Scripting

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

Fence = buildFence(section, post, path)

Example.

import FreeCAD
import Part
import Arch

parts = []

parts.append(Part.makeBox(2000, 50, 30, FreeCAD.Vector(0, 0, 1000 - 30)))
parts.append(Part.makeBox(2000, 50, 30))
parts.append(Part.makeBox(20, 20, 1000 - 60, FreeCAD.Vector(0, 15, 30)))
parts.append(Part.makeBox(20, 20, 1000 - 60, FreeCAD.Vector(1980, 15, 30)))

for i in range(8):
    parts.append(Part.makeBox(20, 20, 1000 - 60, FreeCAD.Vector((2000 / 9 * (i + 1)) - 10, 15, 30)))

Part.show(Part.makeCompound(parts), "Fence_section")
fence_section = FreeCAD.ActiveDocument.Fence_section

sketch = FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject", "Path")
sketch.Placement = FreeCAD.Placement(FreeCAD.Vector(0, 0, 0), FreeCAD.Rotation(0, 0, 0, 1))
sketch.addGeometry(Part.LineSegment(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(20000, 0, 0)), False)
sketch.addGeometry(Part.LineSegment(FreeCAD.Vector(20000, 0, 0), FreeCAD.Vector(20000, 20000, 0)), False)

post = Part.makeBox(100, 100, 1000, FreeCAD.Vector(0, 0, 0))
Part.show(post, "Post")
post = FreeCAD.ActiveDocument.Post

Fence = Arch.buildFence(fence_section, post, sketch)