示例#1
0
def makeStirrup(
    l_cover,
    r_cover,
    t_cover,
    b_cover,
    f_cover,
    bentAngle,
    bentFactor,
    diameter,
    rounding,
    amount_spacing_check,
    amount_spacing_value,
    structure=None,
    facename=None,
):
    """makeStirrup(LeftCover, RightCover, TopCover, BottomCover, FrontCover,
    BentAngle, BentFactor, Diameter, Rounding, AmountSpacingCheck,
    AmountSpacingValue, Structure, Facename):
    Adds the Stirrup reinforcement bar to the selected structural object."""
    if not structure and not facename:
        selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
        structure = selected_obj.Object
        facename = selected_obj.SubElementNames[0]
    face = structure.Shape.Faces[getFaceNumber(facename) - 1]
    # StructurePRM = getTrueParametersOfStructure(structure)
    FacePRM = getParametersOfFace(structure, facename, False)
    FaceNormal = face.normalAt(0, 0)
    # FaceNormal = face.Placement.Rotation.inverted().multVec(FaceNormal)
    if not FacePRM:
        FreeCAD.Console.PrintError(
            "Cannot identified shape or from which base object sturctural "
            "element is derived\n")
        return
    # Calculate the coordinate values of Stirrup
    points = getpointsOfStirrup(
        FacePRM,
        l_cover,
        r_cover,
        t_cover,
        b_cover,
        bentAngle,
        bentFactor,
        diameter,
        rounding,
        FaceNormal,
    )
    import Draft

    line = Draft.makeWire(points, closed=False, face=True, support=None)
    import Arch

    line.Support = [(structure, facename)]
    if amount_spacing_check:
        rebar = Arch.makeRebar(
            structure,
            line,
            diameter,
            amount_spacing_value,
            f_cover + diameter / 2,
            name="Stirrup",
        )
    else:
        size = (ArchCommands.projectToVector(structure.Shape.copy(),
                                             face.normalAt(0, 0))).Length
        rebar = Arch.makeRebar(
            structure,
            line,
            diameter,
            int((size - diameter) / amount_spacing_value),
            f_cover + diameter / 2,
            name="Stirrup",
        )
    rebar.Direction = FaceNormal.negative()
    rebar.Rounding = rounding
    # Adds properties to the rebar object
    rebar.addProperty(
        "App::PropertyEnumeration",
        "RebarShape",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Shape of rebar"),
    ).RebarShape = RebarTypes.tolist()
    rebar.RebarShape = "Stirrup"
    rebar.setEditorMode("RebarShape", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "LeftCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Left Side cover of rebar"),
    ).LeftCover = l_cover
    rebar.setEditorMode("LeftCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "RightCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Right Side cover of rebar"),
    ).RightCover = r_cover
    rebar.setEditorMode("RightCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "TopCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Top Side cover of rebar"),
    ).TopCover = t_cover
    rebar.setEditorMode("TopCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "BottomCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Bottom Side cover of rebar"),
    ).BottomCover = b_cover
    rebar.setEditorMode("BottomCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "FrontCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Top cover of rebar"),
    ).FrontCover = f_cover
    rebar.setEditorMode("FrontCover", 2)
    rebar.addProperty(
        "App::PropertyInteger",
        "BentAngle",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property",
                          "Bent angle between at the end of rebar"),
    ).BentAngle = bentAngle
    rebar.setEditorMode("BentAngle", 2)
    rebar.addProperty(
        "App::PropertyInteger",
        "BentFactor",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property",
                          "Bent Length is the equal to BentFactor * Diameter"),
    ).BentFactor = bentFactor
    rebar.setEditorMode("BentFactor", 2)
    rebar.addProperty(
        "App::PropertyBool",
        "AmountCheck",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Amount radio button is checked"),
    )
    rebar.setEditorMode("AmountCheck", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "TrueSpacing",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Spacing between of rebars"),
    ).TrueSpacing = amount_spacing_value
    rebar.setEditorMode("TrueSpacing", 2)
    if amount_spacing_check:
        rebar.AmountCheck = True
    else:
        rebar.AmountCheck = False
        rebar.TrueSpacing = amount_spacing_value
    FreeCAD.ActiveDocument.recompute()
    return rebar
示例#2
0
def makeStraightRebars(
    s_cover,
    t_offset,
    b_offset,
    dia_of_main_rebars,
    number_angle_check,
    number_angle_value,
    structure,
    facename,
    base_line_list=None,
):
    """makeStraightRebars(SideCover, TopOffset, BottomOffset, Diameter,
    NumberAngleCheck, NumberAngleValue, Structure, Facename, BaseLineObjList):
    Adds the straight rebars in circular column structural object.
    """
    face = structure.Shape.Faces[(getFaceNumber(facename) - 1)]
    FacePRM = getParametersOfFace(structure, facename, False)
    column_size = ArchCommands.projectToVector(structure.Shape.copy(),
                                               face.normalAt(0, 0)).Length
    points_list = getPointsOfStraightRebars(
        FacePRM,
        s_cover,
        t_offset,
        b_offset,
        column_size,
        dia_of_main_rebars,
        number_angle_check,
        number_angle_value,
    )
    import Arch
    import Draft

    pl = FreeCAD.Placement()
    pl.Rotation.Q = (0.5, 0.5, 0.5, 0.5)
    main_rebars_list = []
    for i, points in enumerate(points_list):
        if not base_line_list or i >= len(base_line_list):
            line = Draft.makeWire(
                points,
                placement=pl,
                closed=False,
                face=True,
                support=[(structure, facename)],
            )
        else:
            line = base_line_list[i]
            line.Start = points[0]
            line.End = points[1]
        main_rebars_list.append(
            Arch.makeRebar(
                structure,
                line,
                dia_of_main_rebars,
                amount=1,
                name="StraightRebar",
            ))
        main_rebars_list[-1].Label = "StraightRebar"
        main_rebars_list[-1].OffsetStart = 0
        main_rebars_list[-1].OffsetEnd = 0
        main_rebars_list[-1].addProperty(
            "App::PropertyEnumeration",
            "RebarShape",
            "RebarDialog",
            QT_TRANSLATE_NOOP("App::Property", "Shape of rebar"),
        ).RebarShape = RebarTypes.tolist()
        main_rebars_list[-1].RebarShape = "StraightRebar"
        main_rebars_list[-1].setEditorMode("RebarShape", 2)

    return main_rebars_list
示例#3
0
def makeUShapeRebar(
    f_cover,
    b_cover,
    r_cover,
    l_cover,
    diameter,
    t_cover,
    rounding,
    amount_spacing_check,
    amount_spacing_value,
    orientation="Bottom",
    structure=None,
    facename=None,
):
    """makeUShapeRebar(FrontCover, BottomCover, RightCover, LeftCover, Diameter,
    Topcover, Rounding, AmountSpacingCheck, AmountSpacingValue, Orientation,
    Structure, Facename):
    Adds the U-Shape reinforcement bar to the selected structural object.

    It takes four different types of orientations as input i.e 'Bottom', 'Top',
    'Right', 'Left'.
    """
    if not structure and not facename:
        selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
        structure = selected_obj.Object
        facename = selected_obj.SubElementNames[0]
    face = structure.Shape.Faces[getFaceNumber(facename) - 1]
    # StructurePRM = getTrueParametersOfStructure(structure)
    FacePRM = getParametersOfFace(structure, facename)
    if not FacePRM:
        FreeCAD.Console.PrintError(
            "Cannot identified shape or from which base object sturctural "
            "element is derived\n")
        return
    # Get points of U-Shape rebar
    points = getpointsOfUShapeRebar(FacePRM, r_cover, l_cover, b_cover,
                                    t_cover, orientation, diameter)
    import Part
    import Arch

    sketch = FreeCAD.activeDocument().addObject("Sketcher::SketchObject",
                                                "Sketch")
    sketch.MapMode = "FlatFace"
    sketch.Support = [(structure, facename)]
    FreeCAD.ActiveDocument.recompute()
    sketch.addGeometry(Part.LineSegment(points[0], points[1]), False)
    sketch.addGeometry(Part.LineSegment(points[1], points[2]), False)

    sketch.addGeometry(Part.LineSegment(points[2], points[3]), False)
    if amount_spacing_check:
        rebar = Arch.makeRebar(
            structure,
            sketch,
            diameter,
            amount_spacing_value,
            f_cover + diameter / 2,
            name="UShapeRebar",
        )
        FreeCAD.ActiveDocument.recompute()
    else:
        size = (ArchCommands.projectToVector(structure.Shape.copy(),
                                             face.normalAt(0, 0))).Length
        rebar = Arch.makeRebar(
            structure,
            sketch,
            diameter,
            int((size - diameter) / amount_spacing_value),
            f_cover + diameter / 2,
            name="UShapeRebar",
        )
    rebar.Rounding = rounding
    # Adds properties to the rebar object
    rebar.addProperty(
        "App::PropertyEnumeration",
        "RebarShape",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Shape of rebar"),
    ).RebarShape = RebarTypes.tolist()
    rebar.RebarShape = "UShapeRebar"
    rebar.setEditorMode("RebarShape", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "FrontCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Front cover of rebar"),
    ).FrontCover = f_cover
    rebar.setEditorMode("FrontCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "RightCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Right Side cover of rebar"),
    ).RightCover = r_cover
    rebar.setEditorMode("RightCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "LeftCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Left Side cover of rebar"),
    ).LeftCover = l_cover
    rebar.setEditorMode("LeftCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "BottomCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Bottom cover of rebar"),
    ).BottomCover = b_cover
    rebar.setEditorMode("BottomCover", 2)
    rebar.addProperty(
        "App::PropertyBool",
        "AmountCheck",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Amount radio button is checked"),
    )
    rebar.setEditorMode("AmountCheck", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "TopCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Top cover of rebar"),
    ).TopCover = t_cover
    rebar.setEditorMode("TopCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "TrueSpacing",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Spacing between of rebars"),
    ).TrueSpacing = amount_spacing_value
    rebar.setEditorMode("TrueSpacing", 2)
    rebar.addProperty(
        "App::PropertyString",
        "Orientation",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Shape of rebar"),
    ).Orientation = orientation
    rebar.setEditorMode("Orientation", 2)
    if amount_spacing_check:
        rebar.AmountCheck = True
    else:
        rebar.AmountCheck = False
        rebar.TrueSpacing = amount_spacing_value
    FreeCAD.ActiveDocument.recompute()
    return rebar
示例#4
0
def makeStraightRebar(
    f_cover,
    coverAlong,
    rt_cover,
    lb_cover,
    diameter,
    amount_spacing_check,
    amount_spacing_value,
    orientation="Horizontal",
    structure=None,
    facename=None,
):
    """Adds the straight reinforcement bar to the selected structural object.

    Case I: When orientation of straight rebar is 'Horizontal':
        makeStraightRebar(FrontCover, CoverAlong, RightCover, LeftCover,
        Diameter, AmountSpacingCheck, AmountSpacingValue, Orientation =
        "Horizontal", Structure, Facename)
        Note: Type of CoverAlong argument is a tuple. Syntax: (<Along>,
        <Value>). Here we have horizontal orientation so we can pass Top Side
        and Bottom Side to <Along> arguments.
        For eg. ("Top Side", 20) and ("Bottom Side", 20)

    Case II: When orientation of straight rebar is 'Vertical':
        makeStraightRebar(FrontCover, CoverAlong, TopCover, BottomCover,
        Diameter, AmountSpacingCheck, AmountSpacingValue, Orientation =
        "Horizontal", Structure, Facename)
        Note: Type of CoverAlong argument is a tuple. Syntax: (<Along>,
        <Value>). Here we have vertical orientation so we can pass Left Side
        and Right Side to <Along> arguments.
        For eg. ("Left Side", 20) and ("Right Side", 20)
    """
    if not structure and not facename:
        selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
        structure = selected_obj.Object
        facename = selected_obj.SubElementNames[0]
    face = structure.Shape.Faces[getFaceNumber(facename) - 1]
    # StructurePRM = getTrueParametersOfStructure(structure)
    FacePRM = getParametersOfFace(structure, facename)
    if not FacePRM:
        FreeCAD.Console.PrintError(
            "Cannot identify shape or from which base object structural "
            "element is derived\n")
        return
    # Get points of Straight rebar
    points = getpointsOfStraightRebar(
        FacePRM,
        rt_cover,
        lb_cover,
        coverAlong,
        orientation,
        diameter,
        facenormalDirection(structure, facename),
    )
    import Part
    import Arch

    sketch = FreeCAD.activeDocument().addObject("Sketcher::SketchObject",
                                                "Sketch")
    sketch.MapMode = "FlatFace"
    sketch.Support = [(structure, facename)]
    FreeCAD.ActiveDocument.recompute()
    sketch.addGeometry(Part.LineSegment(points[0], points[1]), False)
    if amount_spacing_check:
        rebar = Arch.makeRebar(
            structure,
            sketch,
            diameter,
            amount_spacing_value,
            f_cover + diameter / 2,
            name="StraightRebar",
        )
        FreeCAD.ActiveDocument.recompute()
    else:
        size = (ArchCommands.projectToVector(structure.Shape.copy(),
                                             face.normalAt(0, 0))).Length
        rebar = Arch.makeRebar(
            structure,
            sketch,
            diameter,
            get_rebar_amount_from_spacing(size, diameter,
                                          amount_spacing_value),
            f_cover + diameter / 2,
            name="StraightRebar",
        )
    # Adds properties to the rebar object
    rebar.addProperty(
        "App::PropertyEnumeration",
        "RebarShape",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Shape of rebar"),
    ).RebarShape = RebarTypes.tolist()
    rebar.RebarShape = "StraightRebar"
    rebar.setEditorMode("RebarShape", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "FrontCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Front cover of rebar"),
    ).FrontCover = f_cover
    rebar.setEditorMode("FrontCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "RightTopCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Right/Top Side cover of rebar"),
    ).RightTopCover = rt_cover
    rebar.setEditorMode("RightTopCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "LeftBottomCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Left/Bottom Side cover of rebar"),
    ).LeftBottomCover = lb_cover
    rebar.setEditorMode("LeftBottomCover", 2)
    rebar.addProperty(
        "App::PropertyString",
        "CoverAlong",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Cover along"),
    ).CoverAlong = coverAlong[0]
    rebar.setEditorMode("CoverAlong", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "Cover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property",
                          "Cover of rebar along user selected side"),
    ).Cover = coverAlong[1]
    rebar.setEditorMode("Cover", 2)
    rebar.addProperty(
        "App::PropertyBool",
        "AmountCheck",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Amount radio button is checked"),
    )
    rebar.setEditorMode("AmountCheck", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "TrueSpacing",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Spacing between of rebars"),
    ).TrueSpacing = amount_spacing_value
    rebar.setEditorMode("TrueSpacing", 2)
    rebar.addProperty(
        "App::PropertyString",
        "Orientation",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Shape of rebar"),
    ).Orientation = orientation
    rebar.setEditorMode("Orientation", 2)
    if amount_spacing_check:
        rebar.AmountCheck = True
    else:
        rebar.AmountCheck = False
        rebar.TrueSpacing = amount_spacing_value
    FreeCAD.ActiveDocument.recompute()
    return rebar
def makeHelicalRebar(
    s_cover, b_cover, diameter, t_cover, pitch, structure=None, facename=None
):
    """makeHelicalRebar(SideCover, BottomCover, Diameter, TopCover, Pitch,
    Structure, Facename):
    Adds the Helical reinforcement bar to the selected structural object."""
    if not structure and not facename:
        selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
        structure = selected_obj.Object
        facename = selected_obj.SubElementNames[0]
    face = structure.Shape.Faces[getFaceNumber(facename) - 1]
    # StructurePRM = getTrueParametersOfStructure(structure)
    FacePRM = getParametersOfFace(structure, facename, False)
    if not FacePRM:
        FreeCAD.Console.PrintError(
            "Cannot identify shape or from which base object structural "
            "element is derived\n"
        )
        return
    size = (
        ArchCommands.projectToVector(
            structure.Shape.copy(), face.normalAt(0, 0)
        )
    ).Length
    normal = face.normalAt(0, 0)
    # normal = face.Placement.Rotation.inverted().multVec(normal)
    import Arch

    helix = createHelicalWire(
        FacePRM, s_cover, b_cover, t_cover, pitch, size, normal, diameter
    )
    helix.Support = [(structure, facename)]
    rebar = Arch.makeRebar(
        structure, helix, diameter, 1, diameter / 2, name="HelicalRebar"
    )
    rebar.OffsetStart = diameter / 2
    rebar.OffsetEnd = diameter / 2
    FreeCAD.ActiveDocument.recompute()
    # Adds properties to the rebar object
    rebar.addProperty(
        "App::PropertyEnumeration",
        "RebarShape",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Shape of rebar"),
    ).RebarShape = RebarTypes.tolist()
    rebar.RebarShape = "HelicalRebar"
    rebar.setEditorMode("RebarShape", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "SideCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Front cover of rebar"),
    ).SideCover = s_cover
    rebar.setEditorMode("SideCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "Pitch",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Left Side cover of rebar"),
    ).Pitch = pitch
    rebar.setEditorMode("Pitch", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "BottomCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Bottom cover of rebar"),
    ).BottomCover = b_cover
    rebar.setEditorMode("BottomCover", 2)
    rebar.addProperty(
        "App::PropertyDistance",
        "TopCover",
        "RebarDialog",
        QT_TRANSLATE_NOOP("App::Property", "Top cover of rebar"),
    ).TopCover = t_cover
    rebar.setEditorMode("TopCover", 2)
    FreeCAD.ActiveDocument.recompute()
    return rebar
    def execute(self, obj):
        """This function is executed to recompute ReinforcementDimensioning
        object."""
        if not obj.ParentDrawingView:
            FreeCAD.Console.PrintError(
                "No ParentDrawingView, return without a reinforcement "
                "dimensioning for {}.\n".format(obj.Name)
            )
            return

        if obj.WayPointsType == "Automatic":
            if not obj.Rebar:
                FreeCAD.Console.PrintError(
                    "No Rebar, return without a reinforcement dimensioning for "
                    "{}.\n".format(obj.Name)
                )
                return
            elif obj.Rebar not in obj.ParentDrawingView.VisibleRebars:
                FreeCAD.Console.PrintError(
                    "Rebar is either not visible or not present in "
                    "reinforcement drawing.\n"
                )
                return
            elif not hasattr(obj.Rebar, "RebarShape"):
                FreeCAD.Console.PrintError(
                    "Unable to find rebar shape type. Automatic dimensioning "
                    "is not supported for custom rebars.\n"
                )
                return
            elif obj.Rebar.RebarShape not in RebarTypes.tolist():
                FreeCAD.Console.PrintError(
                    "Unsupported rebar type {}. Automatic dimensioning is only "
                    "supported for: {}\n".format(
                        obj.Rebar.RebarShape, ", ".join(RebarTypes.tolist())
                    )
                )
                return

        if obj.WayPointsType == "Custom" and len(obj.WayPoints) < 2:
            FreeCAD.Console.PrintError(
                "Empty WayPoints list, return without a reinforcement "
                "dimensioning for {}."
                "\n".format(obj.Name)
            )
            return

        obj.Scale = obj.ParentDrawingView.Scale
        obj.X = obj.ParentDrawingView.X
        obj.Y = obj.ParentDrawingView.Y
        root_svg = getSVGRootElement()

        view_plane = getViewPlane(obj.ParentDrawingView.View)
        min_x, min_y, max_x, max_y = getDrawingMinMaxXY(
            obj.ParentDrawingView.Structure,
            obj.ParentDrawingView.Rebars,
            view_plane,
        )

        if obj.WayPointsType == "Automatic":
            dimension_data_list, dimension_align = getRebarDimensionData(
                obj.Rebar,
                obj.DimensionFormat,
                view_plane,
                obj.DimensionLeftOffset.Value / obj.Scale,
                obj.DimensionRightOffset.Value / obj.Scale,
                obj.DimensionTopOffset.Value / obj.Scale,
                obj.DimensionBottomOffset.Value / obj.Scale,
                min_x,
                min_y,
                max_x,
                max_y,
                obj.Scale,
                obj.SingleRebar_OuterDimension,
                obj.MultiRebar_OuterDimension,
            )
            if hasattr(self, "FirstExecute") and self.FirstExecute is True:
                self.FirstExecute = False
                parent_drawing = obj.ParentDrawingView
                if dimension_align == "Left":
                    parent_drawing.DimensionLeftOffset.Value += (
                        self.DimensionLeftOffsetIncrement
                    )
                elif dimension_align == "Right":
                    parent_drawing.DimensionRightOffset.Value += (
                        self.DimensionRightOffsetIncrement
                    )
                elif dimension_align == "Top":
                    parent_drawing.DimensionTopOffset.Value += (
                        self.DimensionTopOffsetIncrement
                    )
                elif dimension_align == "Bottom":
                    parent_drawing.DimensionBottomOffset.Value += (
                        self.DimensionBottomOffsetIncrement
                    )
            for dimension_data in dimension_data_list:
                if (
                    "LabelOnly" in dimension_data
                    and dimension_data["LabelOnly"] is True
                ):
                    dimensions_svg = getSVGTextElement(
                        dimension_data["DimensionLabel"],
                        dimension_data["LabelPosition"].x,
                        dimension_data["LabelPosition"].y,
                        obj.Font,
                        obj.FontSize.Value / obj.Scale,
                        "middle",
                    )
                    dimensions_svg.set("fill", getrgb(obj.TextColor))
                else:
                    way_points = dimension_data["WayPoints"]
                    dimension_label = dimension_data["DimensionLabel"]
                    if dimension_data["VisibleRebars"] == "Single":
                        line_start_symbol = obj.SingleRebar_LineStartSymbol
                        line_end_symbol = obj.SingleRebar_LineEndSymbol
                        text_position_type = obj.SingleRebar_TextPositionType
                    elif dimension_data["VisibleRebars"] == "Multiple":
                        line_start_symbol = obj.MultiRebar_LineStartSymbol
                        line_end_symbol = obj.MultiRebar_LineEndSymbol
                        text_position_type = obj.MultiRebar_TextPositionType

                    dimensions_svg = getDimensionLineSVG(
                        [(point.x, point.y) for point in way_points],
                        dimension_label,
                        obj.Font,
                        obj.FontSize.Value / obj.Scale,
                        getrgb(obj.TextColor),
                        text_position_type,
                        obj.StrokeWidth.Value / obj.Scale,
                        obj.LineStyle,
                        getrgb(obj.LineColor),
                        line_start_symbol,
                        obj.LineMidPointSymbol,
                        line_end_symbol,
                    )

                # Apply translation so that (0,0) in dimensioning corresponds to
                # (0,0) in ParentDrawingView
                dimensions_svg.set(
                    "transform",
                    "translate({}, {})".format(-min_x, -min_y),
                )
                root_svg.append(dimensions_svg)
        else:
            if obj.Rebar:
                dimension_label = getRebarDimensionLabel(
                    obj.Rebar, obj.DimensionFormat
                )
            else:
                dimension_label = obj.DimensionFormat
            dimensions_svg = getDimensionLineSVG(
                [(point.x, point.y) for point in obj.WayPoints],
                dimension_label,
                obj.Font,
                obj.FontSize.Value / obj.Scale,
                getrgb(obj.TextColor),
                obj.TextPositionType,
                obj.StrokeWidth.Value / obj.Scale,
                obj.LineStyle,
                getrgb(obj.LineColor),
                obj.LineStartSymbol,
                obj.LineMidPointSymbol,
                obj.LineEndSymbol,
            )
            # Apply translation so that (0,0) in dimensioning corresponds to
            # (0,0) in ParentDrawingView
            dimensions_svg.set(
                "transform",
                "translate({}, {})".format(-min_x, -min_y),
            )
            root_svg.append(dimensions_svg)

        # Set svg height and width same as ParentDrawingView
        root_svg.set("width", "{}mm".format(obj.ParentDrawingView.Width.Value))
        root_svg.set(
            "height", "{}mm".format(obj.ParentDrawingView.Height.Value)
        )
        root_svg.set(
            "viewBox",
            "0 0 {} {}".format(
                obj.ParentDrawingView.Width.Value,
                obj.ParentDrawingView.Height.Value,
            ),
        )

        obj.Symbol = ElementTree.tostring(root_svg, encoding="unicode")

        if FreeCAD.GuiUp:
            obj.ViewObject.update()