def drawLine(self, p1, p2): if self.draw: l = rs.AddLine(p1, p2) rs.ObjectColor(l, self.color) rs.ObjectPrintWidth(l, self.weight) return l else: pass
def _moveTowards(self, vector): if self._penDown: newLocation = self._location.Origin + vector line = rs.AddLine(self._location.Origin, newLocation) rs.ObjectColor(line, self._color) rs.ObjectPrintColor(line, self._color) rs.ObjectPrintWidth(line, self._lineweight) self._location.Translate(vector)
def checkCurveIntegrity(objs): layers = [] selection = [] delete_objs = [] for i, obj in enumerate(objs): if rs.IsCurve(obj): layer_name = rs.ObjectLayer(obj) # check for disconnected endpoints if (re.search('contour', layer_name, re.IGNORECASE) or re.search('Pocket', layer_name, re.IGNORECASE)) and not rs.IsCurveClosed(obj): selection.append(obj) appendLayer(layers, obj) delete_objs.append(rs.AddPoint(rs.CurveStartPoint(obj))) delete_objs.append(rs.AddPoint(rs.CurveEndPoint(obj))) rs.Command("'_printDisplay _state _on _Enter") for i in range(0, 3): temp_circle = rs.AddCircle(rs.WorldXYPlane(), 80.0 * i + 1) rs.MoveObject(temp_circle, rs.CurveStartPoint(obj)) rs.ObjectPrintWidth(temp_circle, 2.0) delete_objs.append(temp_circle) if len(selection) > 0: rs.SelectObjects(selection) rs.ZoomSelected() redraw() # when an object is found on > 0 layers, prompt for proceed if len(layers) > 0: msg = "See selection: curves and contours should always be closed:\n" for layer in layers: msg = msg + "- " + layer + " \n" msg = msg + '\n Do you want to proceed?' rs.DeleteObjects(delete_objs) if rs.MessageBox(msg, 1) != 1: # do not proceed with export return False # else return True
def set_spcf(self, obj): rs.ObjectColor(obj, self.color()) rs.ObjectPrintColor(obj, self.color()) rs.ObjectPrintWidth(obj, self.weight())
def _drawLine(self, endPoint): """Draw a line from the turtle's current position to `endPoint`.""" line = rs.AddLine(self._pose.Origin, endPoint) rs.ObjectColor(line, self.color) rs.ObjectPrintColor(line, self.color) rs.ObjectPrintWidth(line, self.width)