def execute(self, context): # Get Selected item. selection = utils.get_current_selection() button = PART_BUILDER.build_item("U_SWITCHPRESS") # Snap to selection. if selection: SNAPPER.snap_objects(button, selection) utils.zero_scale(button) # Select new item. utils.select(button) return {"FINISHED"}
def execute(self, context): # Get Selection selection = utils.get_current_selection() if self.part_id in PRESET_BUILDER.get_presets(): new_item = PRESET_BUILDER.build_preset(self.part_id) else: # Build item new_item = PART_BUILDER.build_item(self.part_id) if selection: SNAPPER.snap_objects(new_item, selection) return {"FINISHED"}
def execute(self, context): # Get Selected item. target = utils.get_current_selection() if target["ObjectID"] not in [ "U_POWERLINE", "U_PIPELINE", "U_PORTALLINE" ]: ShowMessageBox( message="Make sure you have a powerline item selected.", title="Split") return {"FINISHED"} # Perform split. power.split(target, target["ObjectID"]) return {"FINISHED"}
def duplicate(self): """Snaps one object to another based on selection.""" selected_objects = bpy.context.selected_objects if not selected_objects: ShowMessageBox(message="Make sure you have an item selected.", title="Duplicate") return # Get Selected item. target = utils.get_current_selection() # Part if "ObjectID" in target: object_id = target["ObjectID"] userdata = target["UserData"] # Build Item. new_item = PART_BUILDER.build_item(object_id, userdata=userdata) # Snap. SNAPPER.snap_objects(new_item, target) if "PresetID" in target: preset_id = target["PresetID"] # Build Item. new_item = PRESET_BUILDER.build_preset(preset_id) # Snap. SNAPPER.snap_objects(new_item, target)