Draft: Use DXF OCS when importing circles and arcs to Part shapes

See #10985.
This commit is contained in:
Roy-043
2023-10-19 18:00:43 +02:00
parent ddd6f544e5
commit 885343c435
+17 -15
View File
@@ -993,21 +993,22 @@ def drawArc(arc, forceShape=False):
-----
Use local variables, not global variables.
"""
v = vec(arc.loc)
pl = placementFromDXFOCS(arc)
rad = vec(arc.radius)
firstangle = round(arc.start_angle, prec())
lastangle = round(arc.end_angle, prec())
circle = Part.Circle()
circle.Center = v
circle.Radius = vec(arc.radius)
try:
if (dxfCreateDraft or dxfCreateSketch) and (not forceShape):
pl = placementFromDXFOCS(arc)
return Draft.make_circle(circle.Radius, pl, face=False,
return Draft.make_circle(rad, pl, face=False,
startangle=firstangle,
endangle=lastangle)
else:
return circle.toShape(math.radians(firstangle),
math.radians(lastangle))
circle = Part.Circle()
circle.Radius = rad
shape = circle.toShape(math.radians(firstangle),
math.radians(lastangle))
shape.Placement = pl
return shape
except Part.OCCError:
warn(arc)
return None
@@ -1044,16 +1045,17 @@ def drawCircle(circle, forceShape=False):
-----
Use local variables, not global variables.
"""
v = vec(circle.loc)
curve = Part.Circle()
curve.Radius = vec(circle.radius)
curve.Center = v
pl = placementFromDXFOCS(circle)
rad = vec(circle.radius)
try:
if (dxfCreateDraft or dxfCreateSketch) and (not forceShape):
pl = placementFromDXFOCS(circle)
return Draft.make_circle(circle.radius, pl)
return Draft.make_circle(rad, pl, face=False)
else:
return curve.toShape()
curve = Part.Circle()
curve.Radius = rad
shape = curve.toShape()
shape.Placement = pl
return shape
except Part.OCCError:
warn(circle)
return None