Arch: rebar, allow to make rebars from an edge too
This commit is contained in:
@@ -312,9 +312,15 @@ class _Rebar(ArchComponent.Component):
|
||||
.format(obj.Name)
|
||||
)
|
||||
return
|
||||
if not obj.Base.Shape.Wires:
|
||||
if obj.Base.Shape.Faces:
|
||||
FreeCAD.Console.PrintError(
|
||||
"No Wires in Shape of Base, return without a rebar shape for {}.\n"
|
||||
"Faces in Shape of Base, return without a rebar shape for {}.\n"
|
||||
.format(obj.Name)
|
||||
)
|
||||
return
|
||||
if not obj.Base.Shape.Edges:
|
||||
FreeCAD.Console.PrintError(
|
||||
"No Edges in Shape of Base, return without a rebar shape for {}.\n"
|
||||
.format(obj.Name)
|
||||
)
|
||||
return
|
||||
@@ -342,13 +348,22 @@ class _Rebar(ArchComponent.Component):
|
||||
if hasattr(father,'Shape'):
|
||||
fathershape = father.Shape
|
||||
|
||||
wire = obj.Base.Shape.Wires[0]
|
||||
import Part
|
||||
# corner cases:
|
||||
# compound from more Wires
|
||||
# compound without Wires but with multiple Edges
|
||||
# Does they make sense? If yes handle them.
|
||||
# Does it makes sense to handle Shapes with Faces or even Solids?
|
||||
if not obj.Base.Shape.Wires and len(obj.Base.Shape.Edges) == 1:
|
||||
wire = Part.Wire(obj.Base.Shape.Edges[0])
|
||||
else:
|
||||
wire = obj.Base.Shape.Wires[0]
|
||||
if hasattr(obj,"Rounding"):
|
||||
#print(obj.Rounding)
|
||||
if obj.Rounding:
|
||||
radius = obj.Rounding * obj.Diameter.Value
|
||||
import DraftGeomUtils
|
||||
wire = DraftGeomUtils.filletWire(wire,radius)
|
||||
from DraftGeomUtils import filletWire
|
||||
wire = filletWire(wire,radius)
|
||||
bpoint, bvec = self.getBaseAndAxis(wire)
|
||||
if not bpoint:
|
||||
return
|
||||
@@ -382,7 +397,6 @@ class _Rebar(ArchComponent.Component):
|
||||
if length:
|
||||
obj.Length = length
|
||||
pl = obj.Placement
|
||||
import Part
|
||||
circle = Part.makeCircle(obj.Diameter.Value/2,bpoint,bvec)
|
||||
circle = Part.Wire(circle)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user