Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create beams along the edges of a wall face when the face is selected. However, while the beams are created properly along the lines, the orientation of the beams are different across the different edges. But more importantly, the orientations of the beams are different across the different planes of the wall faces.
This is my code -
selected_el_ref = selection.PickObject(ObjectType.Face)
selected_el = doc.GetElement(selected_el_ref)
# Check if selected element is wall
selected_wall = selected_el if type(selected_el) == Wall else None
wall_face = selected_wall.GetGeometryObjectFromReference(
selected_el_ref) if selected_wall else None
normal = wall_face.FaceNormal
origin = wall_face.Origin
curve_loops = wall_face.GetEdgesAsCurveLoops()
level = doc.GetElement(selected_wall.LevelId)
beam_type = FilteredElementCollector(doc).OfCategory(
BuiltInCategory.OST_StructuralFraming).OfClass(FamilySymbol).FirstElement()
for curve_loop in curve_loops:
for curve in curve_loop:
beam = doc.Create.NewFamilyInstance( curve, beam_type, level, Structure.StructuralType.Beam)
If I select a wall face in the YZ plane, then these are the beams that are created.
From the above pictures, it can be seen that the cross-section rotation and the yJustification are off along the different lines in the same plane.
After that, I chose an XZ plane and applied a uniform cross section rotation of 90 degrees to all the lines but from the above picture you can see that the top line is different from the rest.
The real problem comes in when I chose a wall that is at an angle. The above picture is the beam creation when I choose a wall that is created at 45 degrees in the XY plane. From the picture, it can be seen that the beam on the side of the wall is at a 45 degree angle. When I set the cross section rotation to 45 degrees, it gets fixed.
I have tried all methods, I created a code to make sure all the lines are in one direction and they're oriented in clockwise direction as per the normal of the selected face but none of the changes works.
How do I create a generic program wherein when I select a wall face, it places the beams with a uniform cross section rotation and yJustification w.r.t the face that is chosen and not the XYZ coordinate system?
Solved! Go to Solution.