def Activated(self): living_hinge_part = FreeCAD.ActiveDocument.addObject( "Part::FeaturePython", "living_hinges") LivingHinges(living_hinge_part, selection.get_freecad_objects_list()[0]) vp = LivingHingesViewProvider(living_hinge_part.ViewObject) vp.setEdit(LivingHingesViewProvider) return
def hide_others(self): current_obj_list = selection.get_freecad_objects_list() object_list = [] if current_obj_list is None or len(current_obj_list) == 0: FreeCAD.Console.PrintError("No object selectionned\n") return objects = self.active_document.Objects for obj in objects: freecad_object = obj if freecad_object.ViewObject.isVisible( ) and freecad_object not in current_obj_list: freecad_object.ViewObject.hide()
def hide_others(self): FreeCAD.Console.PrintMessage("Hide others\n") current_obj_list = selection.get_freecad_objects_list() object_list = [] if current_obj_list is None or len(current_obj_list) == 0: FreeCAD.Console.PrintMessage("No object selectionned\n") return objects = self.active_document.Objects for obj in objects: freecad_object = obj if freecad_object.ViewObject.isVisible() and freecad_object not in current_obj_list: freecad_object.ViewObject.hide()
def add_parts(self): self.check_is_in_active_view() parts = selection.get_freecad_objects_list() last_index = None if not self.check_parts(parts): return for part in parts: try: item = self.partsList.append(part) last_index = self.model.append_part(item.name, item.label) except ValueError as e: FreeCAD.Console.PrintError(e) return self.force_selection(last_index)
def add_parts(self): self.check_is_in_active_view() parts = selection.get_freecad_objects_list() last_index = None if not self.check_parts(parts): return for part in parts: try: item = self.partsList.append(part) last_index = self.model.append_part(item.name, item.label) except ValueError as e: FreeCAD.Console.PrintMessage(e) return self.force_selection(last_index)
def add_same_parts(self): self.check_is_in_active_view() freecad_parts = selection.get_freecad_objects_list() index = None if len(freecad_parts) == 0 or not self.check_parts(freecad_parts): return try: item = self.partsList.append(freecad_parts[0]) index = self.model.append_part(item.name, item.label) for part in freecad_parts[1:]: sub_item = self.partsList.append_link(part, freecad_parts[0]) self.model.append_part(sub_item.name, sub_item.label, True) except ValueError as e: FreeCAD.Console.PrintError(e) return self.force_selection(index) return
def __init__(self): self.form = [] global_obj = selection.get_freecad_objects_list()[0] self.global_properties = GlobalLivingHingeWidget(global_obj) self.param_widget = QtGui.QWidget() self.param_widget.setWindowTitle("Global parameters") self.form.append(self.param_widget) self.params_vlayout = QtGui.QVBoxLayout(self.param_widget) global_box, grid = self.global_properties.get_group_box( self.param_widget) self.con_button = QtGui.QPushButton('Preview', self.param_widget) self.params_vlayout.addWidget(self.con_button) self.con_button.clicked.connect(self.preview) self.params_vlayout.addWidget(global_box) self.main_con_widget = QtGui.QWidget() self.main_con_widget.setWindowTitle("Living hinges") self.parts_vbox = QtGui.QVBoxLayout(self.main_con_widget) self.form.append(self.main_con_widget) self.con_button = QtGui.QPushButton('Add connection', self.main_con_widget) self.parts_vbox.addWidget(self.con_button) self.con_button.clicked.connect(self.add_connection) self.connection_vbox = QtGui.QVBoxLayout(self.param_widget) self.parts_vbox.addLayout(self.connection_vbox) self.connection_widget_list = [] self.document = FreeCAD.ActiveDocument link_clearance_widget = self.global_properties.get_widget( "link_clearance") link_clearance_widget.valueChanged.connect( self.update_connection_from_global_parameters) try: self.add_connection() except ValueError as err: FreeCAD.Console.PrintError(err) pass return
def add_same_parts(self): self.check_is_in_active_view() parts = selection.get_freecad_objects_list() index = None if len(parts) == 0 or not self.check_parts(parts): return try: item = self.partsList.append(parts[0]) index = self.model.append_part(item.name, item.label) for part in parts[1:]: item = self.partsList.append_link(part, parts[0]) self.model.append_part(item.name, item.label, True) except ValueError as e: FreeCAD.Console.PrintMessage(e) return self.force_selection(index) return