Das Wissen aller Anwender nutzen

Im Allplan Connect Forum tauschen sich Anwender aus, geben wertvolle Tipps oder beraten sich bei ganz konkreten Aufgabenstellungen − auch international.
Und damit wirklich keine Frage unbeantwortet bleibt, unterstützen die Mitarbeiter des Technischen Supports ebenfalls aktiv das Forum.

Es erwarten Sie:

  • Foren-Vielfalt aus CAD Architektur, CAD Ingenieurbau uvm.
  • Tipps von User für User
  • international: Deutsch, Englisch, Italienisch, Französisch und Tschechisch

Melden Sie sich jetzt an und diskutieren Sie mit!

Zur Registrierung

[Frage] Allplan crashes during rebar extrusion [Gelöst]

Schlagworte:
  • PythonParts
  • API
  • [AIDP-239612]

Hello,
As in topic, when I try to create rebar with only two points (single line) as shape input Allplan crashes during ExtrudeBarPlacement.Extrude()
I tried to use GeneralReinfShapeBuilder as well as ReinforcementShapeBuilder.

In my opinion there is problem with determining 3D plane for single line (which is impossible), if I add third point or hooks, script compiles. So the question is, how to extrude straight rebar shape?

Code for problematic shape creation:

    
     shape_data = BarShapePointDataList([concrete_cover,
                                        (crosssection_point_list[0],concrete_cover),
                                        (crosssection_point_list[1],concrete_cover),
                                        concrete_cover])


    shape_builder = AllplanReinf.ReinforcementShapeBuilder()
    shape_builder.AddPoints(shape_data)
    # shape_builder.SetHookStart(0,90, AllplanReinf.HookType.eStirrup) with this line script compiles

    shape = shape_builder.CreateShape(shape_props)
    shape.Rotate(RotationAngles(90, 0, 0))

    placement.AddCrossBendingShape(shape)

Lösung anzeigen Lösung verbergen

shape_data has 2 points that why Allplan Crash!.

You can try this way
AllplanReinf.BendingShape( shapePol: Shape polyline
bendingRoller: Bending roller
diameter: Diameter
steelGrade: Steel grade
concreteGrade: Concrete grade
bendingShapeType: Bending shape type)
\\\\

Then add this BendingShape to the BendingShapelist

Anhänge (2)

Typ: image/png
39-mal heruntergeladen
Größe: 41,81 KiB
Typ: image/png
14-mal heruntergeladen
Größe: 52,27 KiB

Hi,

ExtrudeBarPlacement is represents a special type of placement in Allplan, where the cross-sectional bars (e.g. stirrups) and longitudinal bars are places along any curve, and where the shape of the cross section does not change along path. If your goal is to simply create a straight rebar, using rebar extrusion for it is like using a sledgehammer to crack a nut.

If your goal is to place a straight bar, here we explain how you create basic bending shapes (like the straight bar) and here how you should place the rebar in the model. We just published the articles last Wednesday.

If you really want to create your rebar with the ExtrudeBarPlacement, there is plenty to think about so maybe attach your entire script here.

Best,
Bart

Zitiert von: bmarciniec
If your goal is to simply create a straight rebar, using rebar extrusion for it is like using a sledgehammer to crack a nut.

I agree with that, it's more of me checking what it's possible with Allplan API before commiting to more demanding projects.
Zitiert von: bmarciniec
If your goal is to place a straight bar, here we explain how you create basic bending shapes (like the straight bar) and here how you should place the rebar in the model. We just published the articles last Wednesday.

I was depending heavily on those pages during writing my code, it's really well explained, but I could not solve my problem with that.

Here is sample of my code, I switched to SweepBarPlacement during my attempts to solve it, but the problem remains:

def create_rebar_placement(build_ele:BuildingElement, path: AllplanGeo.Path3D, position: int) ->AllplanReinf.SweepBarPlacement:
    #-------------------- create the placement ----------------------------
    concrete_cover = 50
    interpolation = False
    spacing = 100

    rotation = {"No rotation": AllplanReinf.ExtrudeBarPlacement.eProfileRotation.eNoRotation,
                "Standard"   : AllplanReinf.ExtrudeBarPlacement.eProfileRotation.eStandard,
                "Z-Axis"     : AllplanReinf.ExtrudeBarPlacement.eProfileRotation.eZ_Axis}["Standard"]

    edge_offset = [AllplanReinf.SweepBarPlacement.eEdgeOffsetType.eZeroAtStart,
                    AllplanReinf.SweepBarPlacement.eEdgeOffsetType.eMajorValueAtStart,
                    AllplanReinf.SweepBarPlacement.eEdgeOffsetType.eStartEqualEnd,
                    AllplanReinf.SweepBarPlacement.eEdgeOffsetType.eMajorValueAtEnd,
                    AllplanReinf.SweepBarPlacement.eEdgeOffsetType.eZeroAtEnd]


    path_List = AllplanGeo.Path3DList()
    path_List.append(path)

    placement = AllplanReinf.SweepBarPlacement(
        positionNumber = position,
        sweepPaths = path_List,
        rotation = False,
        firstPathIsSweepPath= True,
        interpolation= interpolation,
        interpolationOfAllPoints= True,
        crossBarDistance= spacing,
        concreteCoverStart= concrete_cover,
        concreteCoverEnd= concrete_cover,
        edgeOffsetType= edge_offset[2],
        edgeOffsetStart= 0,
        edgeOffsetEnd= 0,
        barOffset= 0,
        benchingLength= 0,
        benchingAngle= 0
    )

    return placement

def create_bottom_perp_rebar(build_ele:BuildingElement, placement: AllplanReinf.SweepBarPlacement, crosssection_polygon:AllplanGeo.Polygon2D):
    #----------------- create the cross reinforcement
    concrete_cover = 50
    diameter       = 16
    bending_roller = -1
    steel_grade    = build_ele.ReinfSteelGrade.value

    shape_props = ReinforcementShapeProperties.rebar(diameter, bending_roller,
                                                        steel_grade, -1,
                                                        AllplanReinf.BendingShapeType.Freeform)

    # Get shape points from crosssection_polygon
    crosssection_point_list: List[AllplanGeo.Point2D] = []
    for point in crosssection_polygon.Points:
        crosssection_point_list.append(point)

    crosssection_point_list_3D = transform_xy_point_list_to_xz_plane(crosssection_point_list) # It's List[Point3D]

    shape_data = BarShapePointDataList([concrete_cover,
                                        (crosssection_point_list[0],concrete_cover),
                                        (crosssection_point_list[1],concrete_cover),
                                        concrete_cover])

    shape_builder = AllplanReinf.ReinforcementShapeBuilder()
    shape_builder.AddPoints(shape_data)
    # shape_builder.SetHookStart(0,90, AllplanReinf.HookType.eStirrup) with this line code works

    shape = shape_builder.CreateShape(shape_props)
    shape.Rotate(RotationAngles(90, 0, 0))

    shape_list = AllplanReinf.BendingShapeList()
    shape_list.append(shape)

    long_list =  AllplanReinf.LongitudinalBarPropertiesList()

    start_plane = AllplanGeo.Plane3D(crosssection_point_list_3D[2],AllplanGeo.Vector3D(0,1,0))
    placement.AddSectionBars(
        bendingShapes= shape_list,
        sectionsLongitudinalBarsProp= long_list,
        sectionPlane = start_plane
    )

#Main code
bottom_perp_placement = create_rebar_placement(build_ele,path,2)
create_bottom_perp_rebar(build_ele,bottom_perp_placement,cross_section)
bottom_perp_placement.Sweep()

Oh, now I get what you mean! The problem is there and it is not in your code, but in the Allplan application itself. The SweepBarPlacement (and ExtrudeBar... apparently as well) have problems, when at least one of the cross section bar shapes in the shape_list has no more than 2 vertices. In other words, the cross section bar cannot be a straight bar. Whether you add a hook at the end, or add an additional side, like

    shape_data = BarShapePointDataList([concrete_cover,
                                        (crosssection_point_list[0],concrete_cover),
                                        (crosssection_point_list[1],concrete_cover),
                                        (crosssection_point_list[2],concrete_cover),
                                        concrete_cover])

it solves the problem. I cannot tell you now, why is that and whether we solve it. For now just make sure, that:
len(shape.GetShapePolyline().Points) > 2
Best,
Bart

shape_data has 2 points that why Allplan Crash!.

You can try this way
AllplanReinf.BendingShape( shapePol: Shape polyline
bendingRoller: Bending roller
diameter: Diameter
steelGrade: Steel grade
concreteGrade: Concrete grade
bendingShapeType: Bending shape type)
\\\\

Then add this BendingShape to the BendingShapelist

Anhänge (2)

Typ: image/png
39-mal heruntergeladen
Größe: 41,81 KiB
Typ: image/png
14-mal heruntergeladen
Größe: 52,27 KiB

Thank you for your replay, it works pretty well!

The only issue is that concrete cover is not taken into account, but I guess it can be fixed by adjusting input points.

Indeed ReinforcementShapeBuilder does the work for you and considers the cover. When you create the BendingShape without this helper class, you have to consider the cover and bending diameter (including factor for ribs).

Best,
Bart

Zitiert von: PKrauze
Thank you for your replay, it works pretty well!
The only issue is that concrete cover is not taken into account, but I guess it can be fixed by adjusting input points.

you have to define the axis of your straight bar by moving the shapePol to right position. Divine by count ( only 1 segment ) with start and end length.

Or find a third point on the side of concrete cover, offset the polyline was created from 2 points of straight bar and the third point.
Final, choice the new edge from polyline offset.