Reinforcement BarShapeCutList: Difference between revisions

From FreeCAD Documentation
No edit summary
(Fix grammar issues)
Line 24: Line 24:


<!--T:4-->
<!--T:4-->
The [[Reinforcement Bar Shape Cut List|Rebar Shape Cut List]] tool allows the user to create rebar shape cut list of reinforcing bars.
The [[Reinforcement Bar Shape Cut List|Rebar Shape Cut List]] tool allows the user to create the rebar shape cut list of reinforcing bars.


<!--T:5-->
<!--T:5-->
Line 39: Line 39:


<!--T:8-->
<!--T:8-->
1. Select {{Button|[[Image:Arch_Rebar.svg|16px]] [[Arch Rebar|Arch Rebar]]}} and Rebar2 objects you want to include in Rebar Shape Cut List. Or select {{Button|[[Image:Arch_Structure.svg|16px]] [[Arch Structure|Arch Structure]]}} objects to include {{Button|[[Image:Arch_Rebar.svg|16px]] [[Arch Rebar|Arch Rebar]]}} and Rebar2 objects hosted by that into Rebar Shape Cut List. If nothing is selected, then Rebar Shape Cut List will be generated for all {{Button|[[Image:Arch_Rebar.svg|16px]] [[Arch Rebar|Arch Rebar]]}} and Rebar2 objects present in model.
1. Select {{Button|[[Image:Arch_Rebar.svg|16px]] [[Arch Rebar|Arch Rebar]]}} and Rebar2 objects you want to include in Rebar Shape Cut List. Or select {{Button|[[Image:Arch_Structure.svg|16px]] [[Arch Structure|Arch Structure]]}} objects to include {{Button|[[Image:Arch_Rebar.svg|16px]] [[Arch Rebar|Arch Rebar]]}} and Rebar2 objects hosted by that into Rebar Shape Cut List. If nothing is selected, then Rebar Shape Cut List will be generated for all {{Button|[[Image:Arch_Rebar.svg|16px]] [[Arch Rebar|Arch Rebar]]}} and Rebar2 objects present in the model.


<!--T:9-->
<!--T:9-->
Line 45: Line 45:


<!--T:10-->
<!--T:10-->
3. A dialog box will pop-out on screen as shown below.
3. A dialog box will pop-out on the screen as shown below.


</translate>
</translate>
Line 67: Line 67:
<!--T:16-->
<!--T:16-->
'''General:'''
'''General:'''
* {{PropertyData|Stirrup Extended Edge Offset}}: The offset of extended end edges of stirrup, so that end edges of stirrup with 90 degree bent angle do not overlap with stirrup edges.
* {{PropertyData|Stirrup Extended Edge Offset}}: The offset of extended end edges of the stirrup, so that end edges of the stirrup with a 90-degree bent angle do not overlap with stirrup edges.
* {{PropertyData|Rebars Stroke Width}}: The stroke-width of rebars in rebar shape cut list.
* {{PropertyData|Rebars Stroke Width}}: The stroke-width of rebars in the rebar shape cut list.
* {{PropertyData|Rebars Color Style}}: The color style of rebars.
* {{PropertyData|Rebars Color Style}}: The color style of rebars.
* {{PropertyData|Row Height}}: The height of each row of rebar shape in rebar shape cut list.
* {{PropertyData|Row Height}}: The height of each row of rebar shape in the rebar shape cut list.
* {{PropertyData|Column Width}}: The width of each column of rebar shape in rebar shape cut list.
* {{PropertyData|Column Width}}: The width of each column of rebar shape in the rebar shape cut list.
* {{PropertyData|Column Count}}: The number of columns in rebar shape cut list.
* {{PropertyData|Column Count}}: The number of columns in the rebar shape cut list.
* {{PropertyData|Side Padding}}: The padding on each side of rebar shape.
* {{PropertyData|Side Padding}}: The padding on each side of the rebar shape.
* {{PropertyData|Horizontal Rebar Shape}}: If True, then rebar shape will be made horizontal by rotating max length edge of rebar shape.
* {{PropertyData|Horizontal Rebar Shape}}: If True, then the rebar shape will be made horizontal by rotating the max length edge of the rebar shape.
* {{PropertyData|Include Mark}}: If it is set to True, then rebar.Mark will be included for each rebar shape in rebar shape cut list.
* {{PropertyData|Include Mark}}: If it is set to True, then rebar.Mark will be included for each rebar shape in the rebar shape cut list.
* {{PropertyData|SVG Output File}}: The output file to write generated rebar shape cut list svg.
* {{PropertyData|SVG Output File}}: The output file to write generated rebar shape cut list SVG.


<!--T:17-->
<!--T:17-->
'''Dimension Data:'''
'''Dimension Data:'''
* {{PropertyData|Include Dimensions}}: If True, then each rebar edge dimensions and bent angle dimensions will be included in rebar shape cut list.
* {{PropertyData|Include Dimensions}}: If True, then each rebar edge dimensions and bent angle dimensions will be included in the rebar shape cut list.
* {{PropertyData|Include Units in Dimension Label}}: If it is True, then rebar edge length units will be shown in dimension label.
* {{PropertyData|Include Units in Dimension Label}}: If it is True, then rebar edge length units will be shown in dimension label.
* {{PropertyData|Rebar Edge Dimension Units}}: The units to be used for rebar edge length dimensions.
* {{PropertyData|Rebar Edge Dimension Units}}: The units to be used for rebar edge length dimensions.
* {{PropertyData|Rebar Edge Dimension Precision}}: The number of decimals that should be shown for rebar edge length as dimension label.
* {{PropertyData|Rebar Edge Dimension Precision}}: The number of decimals that should be shown for rebar edge length as a dimension label.
* {{PropertyData|Dimension Font Family}}: The font-family of dimension text.
* {{PropertyData|Dimension Font Family}}: The font-family of dimension text.
* {{PropertyData|Dimension Font Size}}: The font-size of dimension text.
* {{PropertyData|Dimension Font Size}}: The font-size of dimension text.
* {{PropertyData|Bent Angle Dimension Exclude List}}: The list of bent angles to not include their dimensions.
* {{PropertyData|Bent Angle Dimension Exclude List}}: The list of bent angles to not include their dimensions.
* {{PropertyData|Helical Rebar Dimension Label Format}}: The format of helical rebar dimension label. e.g. "%L,r=%R,pitch=%P" where %L -> Length of helical rebar, %R -> Helix radius of helical rebar, %P -> Helix pitch of helical rebar.
* {{PropertyData|Helical Rebar Dimension Label Format}}: The format of the helical rebar dimension label. e.g. "%L,r=%R,pitch=%P" where %L -> Length of helical rebar, %R -> Helix radius of helical rebar, %P -> Helix pitch of helical rebar.


==Scripting== <!--T:18-->
==Scripting== <!--T:18-->
Line 126: Line 126:


<!--T:22-->
<!--T:22-->
* Generates and return a rebar shape svg element for given {{incode|rebar}} object.
* Generates and returns a rebar shape SVG element for the given {{incode|rebar}} object.
* {{incode|rebar}} object can be of type <ArchRebar._Rebar> or <rebar2.BaseRebar>, to generate its shape svg.
* {{incode|rebar}} object can be of type <ArchRebar._Rebar> or <rebar2.BaseRebar>, to generate its shape svg.
* {{incode|view_direction}} specifies the view point direction for rebar shape. It can be of type {{incode|FreeCAD.Vector}} or {{incode|WorkingPlane.Plane}} though {{incode|WorkingPlane.Plane}} is preferred.
* {{incode|view_direction}} specifies the viewpoint direction for rebar shape. It can be of type {{incode|FreeCAD.Vector}} or {{incode|WorkingPlane.Plane}} though {{incode|WorkingPlane.Plane}} is preferred.
* {{incode|include_mark}} specifies if rebar.Mark is to be included in rebar shape svg or not.
* {{incode|include_mark}} specifies if rebar.Mark is to be included in rebar shape SVG or not.
* {{incode|stirrup_extended_edge_offset}} is the offset of extended end edges of stirrup, so that end edges of stirrup with 90 degree bent angle do not overlap with stirrup edges.
* {{incode|stirrup_extended_edge_offset}} is the offset of extended end edges of the stirrup, so that end edges of the stirrup with a 90-degree bent angle do not overlap with stirrup edges.
* {{incode|rebar_stroke_width}} specifies the stroke-width of rebar in svg.
* {{incode|rebar_stroke_width}} specifies the stroke-width of rebar in svg.
* {{incode|rebar_color_style}} specifies the color style of rebar. It can be "shape color" or "color_name or hex_value_of_color". "shape color" means select color of rebar shape.
* {{incode|rebar_color_style}} specifies the color style of rebar. It can be "shape color" or "color_name or hex_value_of_color". "shape color" means to select the color of the rebar shape.
* {{incode|include_dimensions}} specifies if each rebar edge dimensions and bent angle dimensions is to be included in rebar shape svg.
* {{incode|include_dimensions}} specifies if each rebar edge dimensions and bent angle dimensions are to be included in rebar shape SVG.
* {{incode|rebar_dimension_units}} specifies the units to be used for rebar length dimensions.
* {{incode|rebar_dimension_units}} specifies the units to be used for rebar length dimensions.
* {{incode|rebar_length_dimension_precision}} specifies the number of decimals that should be shown for rebar length as dimension label. Set it to None to use user preferred unit precision from FreeCAD unit preferences.
* {{incode|rebar_length_dimension_precision}} specifies the number of decimals that should be shown for rebar length as a dimension label. Set it to None to use user preferred unit precision from FreeCAD unit preferences.
* {{incode|include_units_in_dimension_label}} specifies if rebar length units is to be shown in dimension label.
* {{incode|include_units_in_dimension_label}} specifies if rebar length units is to be shown in dimension label.
* {{incode|bent_angle_dimension_exclude_list}} specifies the list of bent angles to not include their dimensions.
* {{incode|bent_angle_dimension_exclude_list}} specifies the list of bent angles to not include their dimensions.
Line 144: Line 144:
%R -> Helix radius of helical rebar
%R -> Helix radius of helical rebar
%P -> Helix pitch of helical rebar
%P -> Helix pitch of helical rebar
* {{incode|scale}} specifies the scale value to scale rebar svg. The scale parameter helps to scale down rebar_stroke_width and dimension_font_size to make them resolution independent. If max_height or max_width is set to non-zero value, then scale parameter will be ignored.
* {{incode|scale}} specifies the scale value to scale rebar SVG. The scale parameter helps to scale down rebar_stroke_width and dimension_font_size to make them resolution-independent. If max_height or max_width is set to a non-zero value, then the scale parameter will be ignored.
* {{incode|max_height}} specifies the maximum height of rebar shape svg. Set it to 0 to have rebar shape svg height based on scale parameter.
* {{incode|max_height}} specifies the maximum height of rebar shape SVG. Set it to 0 to have rebar shape SVG height based on the scale parameter.
* {{incode|max_width}} specifies the maximum width of rebar shape svg. Set it to 0 to have rebar shape svg width based on scale parameter.
* {{incode|max_width}} specifies the maximum width of rebar shape SVG. Set it to 0 to have rebar shape SVG width based on the scale parameter.
* {{incode|side_padding}} specifies the padding on each side of rebar shape.
* {{incode|side_padding}} specifies the padding on each side of the rebar shape.
* {{incode|horizontal_shape}} specifies if rebar shape is to be made horizontal by rotating max length edge of rebar shape.
* {{incode|horizontal_shape}} specifies if the rebar shape is to be made horizontal by rotating the max length edge of the rebar shape.


==== Example ==== <!--T:23-->
==== Example ==== <!--T:23-->
Line 240: Line 240:


<!--T:25-->
<!--T:25-->
* Generate and return rebar shape cut list svg element for given {{incode|base_rebars_list}}.
* Generate and return rebar shape cut list SVG element for given {{incode|base_rebars_list}}.
* {{incode|base_rebars_list}} is a list of <ArchRebar._Rebar> or <rebar2.BaseRebar> objects, to generate their RebarShape cut list. If not provided, then all ArchRebars and rebar2.BaseRebar objects with unique Mark from ActiveDocument will be selected and rebars with no Mark assigned will be ignored.
* {{incode|base_rebars_list}} is a list of <ArchRebar._Rebar> or <rebar2.BaseRebar> objects, to generate their RebarShape cut list. If not provided, then all ArchRebars and rebar2.BaseRebar objects with unique Mark from ActiveDocument will be selected and rebars with no Mark assigned will be ignored.
* {{incode|view_directions}} is a list of view point directions for each rebar shape. It can be either of type {{incode|FreeCAD.Vector}} or {{incode|WorkingPlane.Plane}} OR their list. Keep it {{incode|FreeCAD.Vector(0, 0, 0)}} to automatically choose view_directions.
* {{incode|view_directions}} is a list of viewpoint directions for each rebar shape. It can be either of type {{incode|FreeCAD.Vector}} or {{incode|WorkingPlane.Plane}} OR their list. Keep it {{incode|FreeCAD.Vector(0, 0, 0)}} to automatically choose view_directions.
* {{incode|include_mark}} specifies if rebar.Mark is to be included for each rebar shape in rebar shape cut list svg or not.
* {{incode|include_mark}} specifies if rebar.Mark is to be included for each rebar shape in rebar shape cut list SVG or not.
* {{incode|stirrup_extended_edge_offset}} specifies the offset of extended end edges of stirrup, so that end edges of stirrup with 90 degree bent angle do not overlap with stirrup edges.
* {{incode|stirrup_extended_edge_offset}} specifies the offset of extended end edges of the stirrup, so that end edges of the stirrup with a 90-degree bent angle do not overlap with stirrup edges.
* {{incode|rebars_stroke_width}} specifies the stroke-width of rebars in rebar shape cut list svg.
* {{incode|rebars_stroke_width}} specifies the stroke-width of rebars in rebar shape cut list SVG.
* {{incode|rebars_color_style}} specifies the color style of rebars. It can be "shape color" or "color_name or hex_value_of_color". "shape color" means select color of rebar shape.
* {{incode|rebars_color_style}} specifies the color style of rebars. It can be "shape color" or "color_name or hex_value_of_color". "shape color" means to select the color of the rebar shape.
* {{incode|include_dimensions}} specifies if each rebar edge dimensions and bent angle dimensions is to be included in rebar shape cut list.
* {{incode|include_dimensions}} specifies if each rebar edge dimensions and bent angle dimensions are to be included in the rebar shape cut list.
* {{incode|rebar_edge_dimension_units}} specifies the units to be used for rebar edge length dimensions.
* {{incode|rebar_edge_dimension_units}} specifies the units to be used for rebar edge length dimensions.
* {{incode|rebar_edge_dimension_precision}} specifies the number of decimals that should be shown for rebar length as dimension label. Set it to None to use user preferred unit precision from FreeCAD unit preferences.
* {{incode|rebar_edge_dimension_precision}} specifies the number of decimals that should be shown for rebar length as a dimension label. Set it to None to use user preferred unit precision from FreeCAD unit preferences.
* {{incode|include_units_in_dimension_label}} specifies if rebars edge length units is to be shown in dimension label.
* {{incode|include_units_in_dimension_label}} specifies if rebars edge length units is to be shown in dimension label.
* {{incode|bent_angle_dimension_exclude_list}} specifies the list of bent angles to not include their dimensions.
* {{incode|bent_angle_dimension_exclude_list}} specifies the list of bent angles to not include their dimensions.
Line 258: Line 258:
%R -> Helix radius of helical rebar
%R -> Helix radius of helical rebar
%P -> Helix pitch of helical rebar
%P -> Helix pitch of helical rebar
* {{incode|row_height}} specifies the height of each row of rebar shape in rebar shape cut list.
* {{incode|row_height}} specifies the height of each row of rebar shape in the rebar shape cut list.
* {{incode|column_width}} specifies the width of each row of rebar shape in rebar shape cut list.
* {{incode|column_width}} specifies the width of each row of rebar shape in the rebar shape cut list.
* {{incode|column_count}} specifies the number of columns in rebar shape cut list. Set it to "row_count" to have column_count <= row_count
* {{incode|column_count}} specifies the number of columns in the rebar shape cut list. Set it to "row_count" to have column_count <= row_count
* {{incode|side_padding}} specifies the padding on each side of rebar shape in rebar shape cut list.
* {{incode|side_padding}} specifies the padding on each side of the rebar shape in the rebar shape cut list.
* {{incode|horizontal_rebar_shape}} specifies if rebar shape is to be made horizontal by rotating max length edge of rebar shape.
* {{incode|horizontal_rebar_shape}} specifies if the rebar shape is to be made horizontal by rotating the max length edge of the rebar shape.
* {{incode|output_file}} specifies the output file to write generated rebar shape cut list svg.
* {{incode|output_file}} specifies the output file to write generated rebar shape cut list SVG.


==== Example ==== <!--T:26-->
==== Example ==== <!--T:26-->

Revision as of 19:48, 6 September 2020

Reinforcement Bar Shape Cut List

Menu location
Reinforcement → Rebar Shape Cut List
Workbenches
Reinforcement, Arch, BIM
Default shortcut
None
Introduced in version
0.19
See also
Reinforcement Drawing Dimensioning, Bill Of Material

Description

The Rebar Shape Cut List tool allows the user to create the rebar shape cut list of reinforcing bars.

This command is part of the Reinforcement Workbench, an external workbench that can be installed with the Addon Manager via the Tools → Addon manager → Reinforcement menu.

Rebar Shape Cut List of reinforcing bars

Usage

1. Select Arch Rebar and Rebar2 objects you want to include in Rebar Shape Cut List. Or select Arch Structure objects to include Arch Rebar and Rebar2 objects hosted by that into Rebar Shape Cut List. If nothing is selected, then Rebar Shape Cut List will be generated for all Arch Rebar and Rebar2 objects present in the model.

2. Then select Rebar Shape Cut List from the rebar tools.

3. A dialog box will pop-out on the screen as shown below.

Dialog Box for the Reinforcement Bar Shape Cut List tool

4. Modify data to suit your requirements.

5. Click OK or Apply to generate Rebar Shape Cut List for rebars.

6. Click Cancel to exit the dialog box.

Properties

General:

  • DataStirrup Extended Edge Offset: The offset of extended end edges of the stirrup, so that end edges of the stirrup with a 90-degree bent angle do not overlap with stirrup edges.
  • DataRebars Stroke Width: The stroke-width of rebars in the rebar shape cut list.
  • DataRebars Color Style: The color style of rebars.
  • DataRow Height: The height of each row of rebar shape in the rebar shape cut list.
  • DataColumn Width: The width of each column of rebar shape in the rebar shape cut list.
  • DataColumn Count: The number of columns in the rebar shape cut list.
  • DataSide Padding: The padding on each side of the rebar shape.
  • DataHorizontal Rebar Shape: If True, then the rebar shape will be made horizontal by rotating the max length edge of the rebar shape.
  • DataInclude Mark: If it is set to True, then rebar.Mark will be included for each rebar shape in the rebar shape cut list.
  • DataSVG Output File: The output file to write generated rebar shape cut list SVG.

Dimension Data:

  • DataInclude Dimensions: If True, then each rebar edge dimensions and bent angle dimensions will be included in the rebar shape cut list.
  • DataInclude Units in Dimension Label: If it is True, then rebar edge length units will be shown in dimension label.
  • DataRebar Edge Dimension Units: The units to be used for rebar edge length dimensions.
  • DataRebar Edge Dimension Precision: The number of decimals that should be shown for rebar edge length as a dimension label.
  • DataDimension Font Family: The font-family of dimension text.
  • DataDimension Font Size: The font-size of dimension text.
  • DataBent Angle Dimension Exclude List: The list of bent angles to not include their dimensions.
  • DataHelical Rebar Dimension Label Format: The format of the helical rebar dimension label. e.g. "%L,r=%R,pitch=%P" where %L -> Length of helical rebar, %R -> Helix radius of helical rebar, %P -> Helix pitch of helical rebar.

Scripting

See also: Arch API, Reinforcement API and FreeCAD Scripting Basics.

The Rebar Shape Cut List tool can be used in macros and from the Python console by using the following function:

Create Rebar Shape SVG

getRebarShapeSVG(
    rebar,
    view_direction: Union[FreeCAD.Vector, WorkingPlane.Plane] = FreeCAD.Vector(0, 0, 0),
    include_mark: bool = True,
    stirrup_extended_edge_offset: float = 2,
    rebar_stroke_width: float = 0.35,
    rebar_color_style: str = "shape color",
    include_dimensions: bool = True,
    rebar_dimension_units: str = "mm",
    rebar_length_dimension_precision: int = 0,
    include_units_in_dimension_label: bool = False,
    bent_angle_dimension_exclude_list: Tuple[float, ...] = (45, 90, 180),
    dimension_font_family: str = "DejaVu Sans",
    dimension_font_size: float = 2,
    helical_rebar_dimension_label_format: str = "%L,r=%R,pitch=%P",
    scale: float = 1,
    max_height: float = 0,
    max_width: float = 0,
    side_padding: float = 1,
    horizontal_shape: bool = False,
) -> ElementTree.Element
  • Generates and returns a rebar shape SVG element for the given rebar object.
  • rebar object can be of type <ArchRebar._Rebar> or <rebar2.BaseRebar>, to generate its shape svg.
  • view_direction specifies the viewpoint direction for rebar shape. It can be of type FreeCAD.Vector or WorkingPlane.Plane though WorkingPlane.Plane is preferred.
  • include_mark specifies if rebar.Mark is to be included in rebar shape SVG or not.
  • stirrup_extended_edge_offset is the offset of extended end edges of the stirrup, so that end edges of the stirrup with a 90-degree bent angle do not overlap with stirrup edges.
  • rebar_stroke_width specifies the stroke-width of rebar in svg.
  • rebar_color_style specifies the color style of rebar. It can be "shape color" or "color_name or hex_value_of_color". "shape color" means to select the color of the rebar shape.
  • include_dimensions specifies if each rebar edge dimensions and bent angle dimensions are to be included in rebar shape SVG.
  • rebar_dimension_units specifies the units to be used for rebar length dimensions.
  • rebar_length_dimension_precision specifies the number of decimals that should be shown for rebar length as a dimension label. Set it to None to use user preferred unit precision from FreeCAD unit preferences.
  • include_units_in_dimension_label specifies if rebar length units is to be shown in dimension label.
  • bent_angle_dimension_exclude_list specifies the list of bent angles to not include their dimensions.
  • dimension_font_family specifies the font-family of dimension text.
  • dimension_font_size specifies the font-size of dimension text.
  • helical_rebar_dimension_label_format specifies the format of helical rebar dimension label. E.g. "%L,r=%R,pitch=%P" where:
   %L -> Length of helical rebar
   %R -> Helix radius of helical rebar
   %P -> Helix pitch of helical rebar
  • scale specifies the scale value to scale rebar SVG. The scale parameter helps to scale down rebar_stroke_width and dimension_font_size to make them resolution-independent. If max_height or max_width is set to a non-zero value, then the scale parameter will be ignored.
  • max_height specifies the maximum height of rebar shape SVG. Set it to 0 to have rebar shape SVG height based on the scale parameter.
  • max_width specifies the maximum width of rebar shape SVG. Set it to 0 to have rebar shape SVG width based on the scale parameter.
  • side_padding specifies the padding on each side of the rebar shape.
  • horizontal_shape specifies if the rebar shape is to be made horizontal by rotating the max length edge of the rebar shape.

Example

from pathlib import Path
from xml.dom import minidom
from xml.etree import ElementTree

import Draft, Arch, Stirrup
from RebarShapeCutList import RebarShapeCutListfunc

Rect = Draft.makeRectangle(400, 400)
Structure = Arch.makeStructure(Rect, height=1600)
Structure.ViewObject.Transparency = 80
FreeCAD.ActiveDocument.recompute()

Rebar = Stirrup.makeStirrup(
    20, 20, 20, 20, 20, 90, 4, 8, 2, True, 10, Structure, "Face6"
)

rebar_shape_svg = RebarShapeCutListfunc.getRebarShapeSVG(
    Rebar,
    view_direction=FreeCAD.Vector(0, 0, 0),
    include_mark=True,
    stirrup_extended_edge_offset=2,
    rebar_stroke_width=0.35,
    rebar_color_style="shape color",
    include_dimensions=True,
    rebar_dimension_units="mm",
    rebar_length_dimension_precision=0,
    include_units_in_dimension_label=True,
    bent_angle_dimension_exclude_list=(45, 90, 180),
    dimension_font_family="DejaVu Sans",
    dimension_font_size=2,
    helical_rebar_dimension_label_format="%L,r=%R,pitch=%P",
    scale=1,
    max_height=100,
    max_width=100,
    side_padding=1,
    horizontal_shape=False,
)

output_file = str(Path.home() / "StirrupRebarShape.svg")
with open(output_file, "w", encoding="utf-8") as f:
    f.write(
        minidom.parseString(
            ElementTree.tostring(rebar_shape_svg, encoding="unicode")
        ).toprettyxml(indent="  ")
    )

Create Rebar Shape Cut List SVG

getRebarShapeCutList(
    base_rebars_list: Optional[List] = None,
    view_directions: Union[
        Union[FreeCAD.Vector, WorkingPlane.Plane],
        List[Union[FreeCAD.Vector, WorkingPlane.Plane]],
    ] = FreeCAD.Vector(0, 0, 0),
    include_mark: bool = True,
    stirrup_extended_edge_offset: float = 2,
    rebars_stroke_width: float = 0.35,
    rebars_color_style: str = "shape color",
    include_dimensions: bool = True,
    rebar_edge_dimension_units: str = "mm",
    rebar_edge_dimension_precision: int = 0,
    include_units_in_dimension_label: bool = False,
    bent_angle_dimension_exclude_list: Union[Tuple[float, ...], List[float]] = (
        45,
        90,
        180,
    ),
    dimension_font_family: str = "DejaVu Sans",
    dimension_font_size: float = 2,
    helical_rebar_dimension_label_format: str = "%L,r=%R,pitch=%P",
    row_height: float = 40,
    column_width: float = 60,
    column_count: Union[int, Literal["row_count"]] = "row_count",
    side_padding: float = 1,
    horizontal_rebar_shape: bool = True,
    output_file: Optional[str] = None,
) -> ElementTree.Element
  • Generate and return rebar shape cut list SVG element for given base_rebars_list.
  • base_rebars_list is a list of <ArchRebar._Rebar> or <rebar2.BaseRebar> objects, to generate their RebarShape cut list. If not provided, then all ArchRebars and rebar2.BaseRebar objects with unique Mark from ActiveDocument will be selected and rebars with no Mark assigned will be ignored.
  • view_directions is a list of viewpoint directions for each rebar shape. It can be either of type FreeCAD.Vector or WorkingPlane.Plane OR their list. Keep it FreeCAD.Vector(0, 0, 0) to automatically choose view_directions.
  • include_mark specifies if rebar.Mark is to be included for each rebar shape in rebar shape cut list SVG or not.
  • stirrup_extended_edge_offset specifies the offset of extended end edges of the stirrup, so that end edges of the stirrup with a 90-degree bent angle do not overlap with stirrup edges.
  • rebars_stroke_width specifies the stroke-width of rebars in rebar shape cut list SVG.
  • rebars_color_style specifies the color style of rebars. It can be "shape color" or "color_name or hex_value_of_color". "shape color" means to select the color of the rebar shape.
  • include_dimensions specifies if each rebar edge dimensions and bent angle dimensions are to be included in the rebar shape cut list.
  • rebar_edge_dimension_units specifies the units to be used for rebar edge length dimensions.
  • rebar_edge_dimension_precision specifies the number of decimals that should be shown for rebar length as a dimension label. Set it to None to use user preferred unit precision from FreeCAD unit preferences.
  • include_units_in_dimension_label specifies if rebars edge length units is to be shown in dimension label.
  • bent_angle_dimension_exclude_list specifies the list of bent angles to not include their dimensions.
  • dimension_font_family specifies the font-family of dimension text.
  • dimension_font_size specifies the font-size of dimension text.
  • helical_rebar_dimension_label_format specifies the format of helical rebar dimension label. E.g. "%L,r=%R,pitch=%P" where:
   %L -> Length of helical rebar
   %R -> Helix radius of helical rebar
   %P -> Helix pitch of helical rebar
  • row_height specifies the height of each row of rebar shape in the rebar shape cut list.
  • column_width specifies the width of each row of rebar shape in the rebar shape cut list.
  • column_count specifies the number of columns in the rebar shape cut list. Set it to "row_count" to have column_count <= row_count
  • side_padding specifies the padding on each side of the rebar shape in the rebar shape cut list.
  • horizontal_rebar_shape specifies if the rebar shape is to be made horizontal by rotating the max length edge of the rebar shape.
  • output_file specifies the output file to write generated rebar shape cut list SVG.

Example

from pathlib import Path

import FreeCAD, Draft, Arch
from ColumnReinforcement import SingleTie
from RebarShapeCutList import RebarShapeCutListfunc

Rect1 = Draft.makeRectangle(400, 400)
Structure1 = Arch.makeStructure(Rect1, height=1600)
Structure1.ViewObject.Transparency = 80
Rect2 = Draft.makeRectangle(500, 500)
Structure2 = Arch.makeStructure(Rect2, height=1600)
Structure2.ViewObject.Transparency = 80
Structure2.Placement = FreeCAD.Placement(FreeCAD.Vector(1000, 0, 0), FreeCAD.Rotation(FreeCAD.Vector(0, 0, 1), 0))
FreeCAD.ActiveDocument.recompute()

# Create Straight Rebars
rebar_group = SingleTie.makeSingleTieFourRebars(
    l_cover_of_tie=40,        
    r_cover_of_tie=40,
    t_cover_of_tie=40,
    b_cover_of_tie=40,
    offset_of_tie=100,
    bent_angle=135,
    extension_factor=8,
    dia_of_tie=8,
    number_spacing_check=True,
    number_spacing_value=10,
    dia_of_rebars=16,
    t_offset_of_rebars=40,
    b_offset_of_rebars=40,
    rebar_type="StraightRebar",
    hook_orientation="Top Inside",
    hook_extend_along="x-axis",
    l_rebar_rounding=None,
    hook_extension=None,
    structure=Structure1,
    facename="Face6",
).rebar_group

# Assign Mark to straight rebars
for straight_rebar in rebar_group.RebarGroups[1].MainRebars:
    straight_rebar.Mark = "main_sb"


# Create LShaped Rebars with hook along x-axis
rebar_group = SingleTie.makeSingleTieFourRebars(
    l_cover_of_tie=40,
    r_cover_of_tie=40,
    t_cover_of_tie=40,
    b_cover_of_tie=40,
    offset_of_tie=100,
    bent_angle=90,
    extension_factor=8,
    dia_of_tie=8,
    number_spacing_check=True,
    number_spacing_value=10,
    dia_of_rebars=16,
    t_offset_of_rebars=-40,
    b_offset_of_rebars=-40,
    rebar_type="LShapeRebar",
    hook_orientation="Top Outside",
    hook_extend_along="x-axis",
    l_rebar_rounding=2,
    hook_extension=100,
    structure=Structure2,
    facename="Face6",
).rebar_group

# Assign Mark to lshape rebars
for lshape_rebar in rebar_group.RebarGroups[1].MainRebars:
    lshape_rebar.Mark = "main_lb"

output_file = str(Path.home() / "RebarShapeCutList.svg")

# Create Rebar Shape Cut List for all base rebars in model
RebarShapeCutListfunc.getRebarShapeCutList(
    base_rebars_list=None,
    view_directions=FreeCAD.Vector(0, 0, 0),
    include_mark=True,
    stirrup_extended_edge_offset=2,
    rebars_stroke_width=0.35,
    rebars_color_style="shape color",
    include_dimensions=True,
    rebar_edge_dimension_units="mm",
    rebar_edge_dimension_precision=0,
    include_units_in_dimension_label=False,
    bent_angle_dimension_exclude_list=(45, 90, 180),
    dimension_font_family="DejaVu Sans",
    dimension_font_size=2,
    helical_rebar_dimension_label_format="%L,r=%R,pitch=%P",
    row_height=40,
    column_width=60,
    column_count="row_count",
    side_padding=1,
    horizontal_rebar_shape=True,
    output_file=output_file,
)