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()