def _build_curve(self): def curve_point(alpha): alpha = radians(alpha) point = (cos(alpha) * self.rx, sin(alpha) * self.ry) point = rotate_2d(point, radians(self.rotation)) x, y = vadd(self.center, point) return (x, y, zaxis) def normalize_angle(angle): angle = fmod(angle, 360.0) if angle < 0: angle += 360.0 return angle zaxis = 0.0 if len(self.center) < 3 else self.center[2] points = [] delta = (self.endangle - self.startangle) / self.segments for segment in xrange(self.segments): alpha = self.startangle + delta * segment points.append(curve_point(alpha)) polyline = Polyline(points, color=self.color, layer=self.layer, linetype=self.linetype) if equals_almost(self.startangle, normalize_angle(self.endangle)): polyline.close() return polyline
def __dxftags__(self): def curve_point(alpha): alpha = radians(alpha) point = (cos(alpha) * self.rx, sin(alpha) * self.ry) point = rotate_2d(point, radians(self.rotation)) x, y = vadd(self.center, point) return (x, y, zaxis) def normalize_angle(angle): angle = fmod(angle, 360.) if angle < 0: angle += 360. return angle zaxis = 0. if len(self.center) < 3 else self.center[2] points = [] delta = (self.endangle - self.startangle) / self.segments for segment in xrange(self.segments): alpha = self.startangle + delta * segment points.append(curve_point(alpha)) polyline = Polyline(points, color=self.color, layer=self.layer, linetype=self.linetype) if equals_almost(self.startangle, normalize_angle(self.endangle)): polyline.close() return polyline.__dxftags__()
def _build_polyline(self): """ build the rectangle with a polyline """ polyline = Polyline(self.points, color=self.color, layer=self.layer) polyline.close() if self.linetype is not None: polyline['linetype'] = self.linetype return polyline
def _build_polyline(self): """ build the rectangle with a polyline """ polyline = Polyline(self.points, color=self.color, layer=self.layer) polyline.close() if self.linetype is not None: polyline['linetype'] = self.linetype return polyline
def _build_polyline(self): '''Build the polyline (key component)''' polyline = Polyline(self.transformed_points, color=self.color, layer=self.layer, flags=0) polyline.close() #redundant in most cases if self.linetype is not None: polyline['linetype'] = self.linetype return polyline