I didn't understand why the normalAt was (0,0,-1).
Here is the function that draw the star with the bug :
Code: Select all
def execute(self, obj):
try:
if obj.OuterRadius< obj.InnerRadius :
#you cannot have it smaller
obj.OuterRadius=obj.InnerRadius
_points = []
for i in range(0, obj.Corners):
alpha = _math.pi *(2 * i + 2 - obj.Corners % 2)/(obj.Corners)
if i % 2 == 1:
radius = obj.InnerRadius
else:
radius = obj.OuterRadius
y = _math.cos(alpha) * radius
x = _math.sin(alpha) * radius
_points.append(App.Vector(x, y, 0.0))
if i ==0 :
saveFirstPoint=App.Vector(x,y,0.0)
if alpha>obj.Angle :
break
_points.append(saveFirstPoint)
test = _part.makePolygon(_points)
obj.Shape = _part.Face(test)
if hasattr(obj, "Area") and hasattr(obj.Shape, "Area"):
obj.Area = obj.Shape.Area
Actually changing the following lines fixed the normalAt to be (0,0,1) and that solve the issue of extruding the face which was going down rather than going up when you extrude the face.
I share with you this problem and the cause of the problem so maybe you face something like that also.
Code: Select all
x = _math.cos(alpha) * radius
y = _math.sin(alpha) * radius