Ejemplo n.º 1
0
    def __init__(self, design, operations, operation_index, sketch=None):
        super(Dialog, self).__init__()
        SketchListManager(design)
        self.optree = DraggableTreeWidget()
        self.optree.linklist(operations)
        self.sketchwidget = SketchListManager(design)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)
        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.optree)
        layout.addWidget(self.sketchwidget)
        layout.addLayout(layout2)

        self.setLayout(layout)

        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value == sketch:
                item.setSelected(True)

        try:
            self.optree.selectIndeces([operation_index])
        except NoOperation:
            pass
Ejemplo n.º 2
0
    def __init__(self,
                 cls,
                 design,
                 operations,
                 selectedoutput=None,
                 sketch=None):
        super(Dialog, self).__init__()
        self.design = design
        self.operations = [NullOp()] + operations
        self.cls = cls

        self.sketchwidget = SketchListManager(self.design)
        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value == sketch:
                item.setSelected(True)

        if selectedoutput is None:
            selectedoutput = [
                item.id for item in design.return_layer_definition().layers
            ]

        self.outputlayerselector = qg.QListWidget()
        self.outputlayerselector.setSelectionBehavior(
            qg.QListWidget.SelectRows)
        self.outputlayerselector.setSelectionMode(
            qg.QListWidget.MultiSelection)

        outputitems = [
            popupcad.filetypes.listwidgetitem.ListWidgetItem(
                item, self.outputlayerselector)
            for item in design.return_layer_definition().layers
        ]
        [
            item.setSelected(item.customdata.id in selectedoutput)
            for item in outputitems
        ]

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')
        buttonlayout = qg.QHBoxLayout()
        buttonlayout.addWidget(button1)
        buttonlayout.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.sketchwidget)
        layout.addWidget(qg.QLabel('Select Layers'))
        layout.addWidget(self.outputlayerselector)
        layout.addLayout(buttonlayout)
        self.setLayout(layout)

        button1.clicked.connect(self.accept)
        button2.clicked.connect(self.reject)
Ejemplo n.º 3
0
    def __init__(self, cls, design, sketch=None):
        super(Dialog, self).__init__()
        self.design = design
        self.cls = cls

        self.sketchwidget = SketchListManager(self.design)
        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value == sketch:
                item.setSelected(True)

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')
        buttonlayout = qg.QHBoxLayout()
        buttonlayout.addWidget(button1)
        buttonlayout.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.sketchwidget)
        layout.addLayout(buttonlayout)
        self.setLayout(layout)

        button1.clicked.connect(self.accept)
        button2.clicked.connect(self.reject)
Ejemplo n.º 4
0
    def build_dialog(self, design, prioroperations):

        self.prioroperations = prioroperations
        self.design = design

        #       operation/part | sketch to tile in | sheet to tile into
        #                  'Number of parts', 'Scale'
        #                       'x-gap', 'y-gap'
        #                       'Support offset'

        self.part = DraggableTreeWidget()
        self.part.linklist(prioroperations)
        # self.part.setCurrentItem()
        self.part.selectIndeces([(design.operation_index(self.part_opref_tp), 0)])

        self.release = DraggableTreeWidget()
        self.release.linklist(prioroperations)
        self.release.selectIndeces([(design.operation_index(self.release_opref_tp), 0)])

        self.sketch_to_tile = SketchListManager(design,name = 'Sketch of tile area')
        self.sketch_to_tile.refresh_list(selected_item = self.sketch_id_tp)

        self.sheet = DraggableTreeWidget()
        self.sheet.linklist(prioroperations)
        self.sheet.selectIndeces([(design.operation_index(self.sheet_opref_tp), 0)])

        #       operation/part | sketch to tile in | sheet to tile into
        layout_ops_sheet_sketch = qg.QHBoxLayout()
        layout_ops_sheet_sketch.addWidget(self.part)
        layout_ops_sheet_sketch.addWidget(self.release)
        layout_ops_sheet_sketch.addWidget(self.sketch_to_tile)
        layout_ops_sheet_sketch.addWidget(self.sheet)

        # layout_ops_sheet_sketch = qg.QHBoxLayout()
        # part_vbox = qg.QVBoxLayout()
        # part_vbox.addWidget(qg.QLabel('Part to tile'))
        # part_vbox.addWidget(self.part)
        # layout_ops_sheet_sketch.addLayout(part_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # rel_vbox = qg.QVBoxLayout()
        # rel_vbox.addWidget(qg.QLabel('Release cut (optional)'))
        # rel_vbox.addWidget(self.release)
        # layout_ops_sheet_sketch.addLayout(rel_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # sktch_vbox = qg.QVBoxLayout()
        # sktch_vbox.addWidget(self.sketch_to_tile)
        # layout_ops_sheet_sketch.addLayout(sktch_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # sht_vbox = qg.QVBoxLayout()
        # sht_vbox.addWidget(qg.QLabel('Sheet to tile into'))
        # sht_vbox.addWidget(self.release)
        # layout_ops_sheet_sketch.addLayout(sht_vbox)

        #       'Number of parts', 'Scale'
        number_of_parts_and_scale = qg.QHBoxLayout()

        number_of_parts_and_scale.addStretch()
        number_of_parts_and_scale.addWidget(qg.QLabel('Number of parts'))
        self.N = qg.QLineEdit()
        number_of_parts_and_scale.addWidget(self.N)

        number_of_parts_and_scale.addWidget(qg.QLabel('Scale'))
        self.scale = qg.QLineEdit()
        number_of_parts_and_scale.addWidget(self.scale)
        number_of_parts_and_scale.addStretch()

        #                       'x-gap', 'y-gap'
        xy_gap = qg.QHBoxLayout()
        xy_gap.addStretch()

        xy_gap.addWidget(qg.QLabel('X-gap'))
        self.x_gap = qg.QLineEdit()
        xy_gap.addWidget(self.x_gap)

        xy_gap.addWidget(qg.QLabel('Y-gap'))
        self.y_gap = qg.QLineEdit()
        xy_gap.addWidget(self.y_gap)
        xy_gap.addStretch()

        s_offset = qg.QHBoxLayout()
        s_offset.addStretch()
        s_offset.addWidget(qg.QLabel('Support offset'))
        self.support_offset = qg.QLineEdit()
        s_offset.addWidget(self.support_offset)
        s_offset.addStretch()

        # Button 1 and 2
        buttons = qg.QHBoxLayout()
        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        buttons.addWidget(button1)

        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)
        buttons.addWidget(button2)

        instructions = qg.QHBoxLayout()
        instructions.addStretch()
        instructions.addWidget(qg.QLabel("Part to tile | Release cut (optional) | "
                                                               "Bounding box sketch | Sheet to tile into"))
        instructions.addStretch()


        layout = qg.QVBoxLayout()
        layout.addLayout(instructions)
        layout.addLayout(layout_ops_sheet_sketch)
        layout.addLayout(number_of_parts_and_scale)
        layout.addLayout(xy_gap)
        layout.addLayout(s_offset)
        layout.addLayout(buttons)
        self.setLayout(layout)

        # set text of all boxes
        self.scale.setText(str(self.sc_tp))
        self.N.setText(str(self.N_tp))
        self.y_gap.setText(str(self.y_gap_tp))
        self.x_gap.setText(str(self.x_gap_tp))
        self.support_offset.setText(str(self.support_offset_tp))
Ejemplo n.º 5
0
class Dialog(qg.QDialog):

    def __init__(self,design,prioroperations, tilepart = None):
        super(Dialog, self).__init__()

        if tilepart is not None:

            self.sheet_opref_tp = tilepart.sheet_opref
            self.release_opref_tp = tilepart.release_opref
            self.part_opref_tp = tilepart.part_opref
            self.sketch_bounding_box_tp = tilepart.sketch_bounding_box
            self.sketch_id_tp = tilepart.sketch_id
            self.sc_tp = tilepart.sc
            self.N_tp = tilepart.N
            self.x_gap_tp = tilepart.x_gap
            self.y_gap_tp = tilepart.y_gap
            self.support_offset_tp = tilepart.support_offset

        else:
            # define defaults
            self.sheet_opref_tp = None if len(design.operations) == 0 else design.operations[0].id
            self.release_opref_tp = None if len(design.operations) == 0 else design.operations[0].id
            self.part_opref_tp = None if len(design.operations) == 0 else design.operations[0].id

            sketchids = [id for key, id in enumerate(design.sketches)]
            self.sketch_id_tp = None if len(design.sketches) == 0 else design.sketches[sketchids[0]]

            self.sketch_bounding_box_tp = [(0,0),(0,0)]
            self.sc_tp = 1
            self.N_tp = 10
            self.x_gap_tp = 0
            self.y_gap_tp = 0
            self.support_offset_tp = 0

        self.build_dialog(design, prioroperations)

    def build_dialog(self, design, prioroperations):

        self.prioroperations = prioroperations
        self.design = design

        #       operation/part | sketch to tile in | sheet to tile into
        #                  'Number of parts', 'Scale'
        #                       'x-gap', 'y-gap'
        #                       'Support offset'

        self.part = DraggableTreeWidget()
        self.part.linklist(prioroperations)
        # self.part.setCurrentItem()
        self.part.selectIndeces([(design.operation_index(self.part_opref_tp), 0)])

        self.release = DraggableTreeWidget()
        self.release.linklist(prioroperations)
        self.release.selectIndeces([(design.operation_index(self.release_opref_tp), 0)])

        self.sketch_to_tile = SketchListManager(design,name = 'Sketch of tile area')
        self.sketch_to_tile.refresh_list(selected_item = self.sketch_id_tp)

        self.sheet = DraggableTreeWidget()
        self.sheet.linklist(prioroperations)
        self.sheet.selectIndeces([(design.operation_index(self.sheet_opref_tp), 0)])

        #       operation/part | sketch to tile in | sheet to tile into
        layout_ops_sheet_sketch = qg.QHBoxLayout()
        layout_ops_sheet_sketch.addWidget(self.part)
        layout_ops_sheet_sketch.addWidget(self.release)
        layout_ops_sheet_sketch.addWidget(self.sketch_to_tile)
        layout_ops_sheet_sketch.addWidget(self.sheet)

        # layout_ops_sheet_sketch = qg.QHBoxLayout()
        # part_vbox = qg.QVBoxLayout()
        # part_vbox.addWidget(qg.QLabel('Part to tile'))
        # part_vbox.addWidget(self.part)
        # layout_ops_sheet_sketch.addLayout(part_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # rel_vbox = qg.QVBoxLayout()
        # rel_vbox.addWidget(qg.QLabel('Release cut (optional)'))
        # rel_vbox.addWidget(self.release)
        # layout_ops_sheet_sketch.addLayout(rel_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # sktch_vbox = qg.QVBoxLayout()
        # sktch_vbox.addWidget(self.sketch_to_tile)
        # layout_ops_sheet_sketch.addLayout(sktch_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # sht_vbox = qg.QVBoxLayout()
        # sht_vbox.addWidget(qg.QLabel('Sheet to tile into'))
        # sht_vbox.addWidget(self.release)
        # layout_ops_sheet_sketch.addLayout(sht_vbox)

        #       'Number of parts', 'Scale'
        number_of_parts_and_scale = qg.QHBoxLayout()

        number_of_parts_and_scale.addStretch()
        number_of_parts_and_scale.addWidget(qg.QLabel('Number of parts'))
        self.N = qg.QLineEdit()
        number_of_parts_and_scale.addWidget(self.N)

        number_of_parts_and_scale.addWidget(qg.QLabel('Scale'))
        self.scale = qg.QLineEdit()
        number_of_parts_and_scale.addWidget(self.scale)
        number_of_parts_and_scale.addStretch()

        #                       'x-gap', 'y-gap'
        xy_gap = qg.QHBoxLayout()
        xy_gap.addStretch()

        xy_gap.addWidget(qg.QLabel('X-gap'))
        self.x_gap = qg.QLineEdit()
        xy_gap.addWidget(self.x_gap)

        xy_gap.addWidget(qg.QLabel('Y-gap'))
        self.y_gap = qg.QLineEdit()
        xy_gap.addWidget(self.y_gap)
        xy_gap.addStretch()

        s_offset = qg.QHBoxLayout()
        s_offset.addStretch()
        s_offset.addWidget(qg.QLabel('Support offset'))
        self.support_offset = qg.QLineEdit()
        s_offset.addWidget(self.support_offset)
        s_offset.addStretch()

        # Button 1 and 2
        buttons = qg.QHBoxLayout()
        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        buttons.addWidget(button1)

        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)
        buttons.addWidget(button2)

        instructions = qg.QHBoxLayout()
        instructions.addStretch()
        instructions.addWidget(qg.QLabel("Part to tile | Release cut (optional) | "
                                                               "Bounding box sketch | Sheet to tile into"))
        instructions.addStretch()


        layout = qg.QVBoxLayout()
        layout.addLayout(instructions)
        layout.addLayout(layout_ops_sheet_sketch)
        layout.addLayout(number_of_parts_and_scale)
        layout.addLayout(xy_gap)
        layout.addLayout(s_offset)
        layout.addLayout(buttons)
        self.setLayout(layout)

        # set text of all boxes
        self.scale.setText(str(self.sc_tp))
        self.N.setText(str(self.N_tp))
        self.y_gap.setText(str(self.y_gap_tp))
        self.x_gap.setText(str(self.x_gap_tp))
        self.support_offset.setText(str(self.support_offset_tp))

    def build_sketch_links(self):
        try:
            sketch_links = {}
            sketch_links['sketch_from']=[self.sketch_to_tile.itemlist.selectedItems()[0].value.id]
            return sketch_links
        except IndexError:
            return None

    def acceptdata(self):

        # get operation reference for part
        ii, jj = self.part.currentIndeces2()[0]
        opid = self.design.operations[ii].id
        part_opref = opid

        # get operation reference for sheet
        ii, jj = self.sheet.currentIndeces2()[0]
        opid = self.design.operations[ii].id
        sheet_opref = opid

        # get operation reference for release
        ii, jj = self.release.currentIndeces2()[0]
        opid = self.design.operations[ii].id
        release_opref = opid

        # get bounding box from the sketch
        tmp_sketch_id = self.sketch_to_tile.itemlist.selectedItems()[0].value.id
        sketch_bounding_box = self.design.sketches[tmp_sketch_id].output_csg()[0].bounds # may break if multiple sketches
        sketch_bounding_box = [geom/popupcad.csg_processing_scaling for geom in sketch_bounding_box]

        sketch_id = self.sketch_to_tile.itemlist.selectedItems()[0].value


        N = int(self.N.text())
        scale = float(self.scale.text())
        x_gap = float(self.x_gap.text())
        y_gap = float(self.y_gap.text())
        support_offset = float(self.support_offset.text())

        return part_opref, release_opref, sheet_opref, sketch_bounding_box, N, scale, \
               x_gap, y_gap, support_offset, sketch_id
Ejemplo n.º 6
0
    def __init__(self,design,prioroperations,placeop = None):
        super(Dialog, self).__init__()

        if placeop is None:
            self.placeop=TransformInternal(None,None,TransformInternal.transformtypes.scale,TransformInternal.transformtypes.scale,0,False,1.,1.)
        else:
            self.placeop = placeop

        self.prioroperations = prioroperations
        self.design = design

        self.operation_list = DraggableTreeWidget()
        self.operation_list.linklist(prioroperations)

        self.sketchwidget_from = SketchListViewer(design,name = 'From Line')
        self.sketchwidget_to = SketchListManager(design,name = 'To Lines')

        self.radiobox_scale_x = qg.QRadioButton('Scale X')
        self.radiobox_custom_x = qg.QRadioButton('Custom X')
        self.radiobox_scale_y = qg.QRadioButton('Scale Y')
        self.radiobox_custom_y = qg.QRadioButton('Custom Y')

        self.x_scale_option = qg.QButtonGroup()
        self.x_scale_option.addButton(self.radiobox_scale_x)
        self.x_scale_option.addButton(self.radiobox_custom_x)

        self.y_scale_option = qg.QButtonGroup()
        self.y_scale_option.addButton(self.radiobox_scale_y)
        self.y_scale_option.addButton(self.radiobox_custom_y)

#        custom_layout = qg.QVBoxLayout()
        self.scalex = qg.QLineEdit()
        self.scaley = qg.QLineEdit()

        templayout1 = qg.QHBoxLayout()
        templayout1.addStretch()
        templayout1.addWidget(self.radiobox_scale_x)
        templayout1.addWidget(self.radiobox_custom_x)
        templayout1.addWidget(self.scalex)
        templayout1.addStretch()
        templayout2 = qg.QHBoxLayout()
        templayout2.addStretch()
        templayout2.addWidget(self.radiobox_scale_y)
        templayout2.addWidget(self.radiobox_custom_y)
        templayout2.addWidget(self.scaley)
        templayout2.addStretch()

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        layout5.addWidget(self.flip)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(popupcad.gui_negative_infinity, popupcad.gui_positive_infinity)
        self.sb.setSingleStep(1)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout3 = qg.QHBoxLayout()
        layout3.addWidget(self.sketchwidget_from)
        layout3.addWidget(self.sketchwidget_to)

        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Operations'))
        layout.addWidget(self.operation_list)
#        layout.addWidget(qg.QLabel('Sketch'))
        layout.addLayout(layout3)
        layout.addLayout(templayout1)
        layout.addLayout(templayout2)
        layout.addLayout(layout5)
        layout.addLayout(layout4)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.radiobox_scale_x.setChecked(False)
        self.radiobox_custom_x.setChecked(False)
        self.radiobox_scale_y.setChecked(False)
        self.radiobox_custom_y.setChecked(False)

        if self.placeop.transformtype_x == TransformInternal.transformtypes.scale:
            self.radiobox_scale_x.setChecked(True)
        elif self.placeop.transformtype_x == TransformInternal.transformtypes.custom:
            self.radiobox_custom_x.setChecked(True)

        if self.placeop.transformtype_y == TransformInternal.transformtypes.scale:
            self.radiobox_scale_y.setChecked(True)
        elif self.placeop.transformtype_y == TransformInternal.transformtypes.custom:
            self.radiobox_custom_y.setChecked(True)

        if self.placeop.sketch_links is not None:
            sketch_from = self.design.sketches[self.placeop.sketch_links['sketch_from'][0]]
            sketch_to = self.design.sketches[self.placeop.sketch_links['sketch_to'][0]]

            for ii in range(self.sketchwidget_from.itemlist.count()):
                item = self.sketchwidget_from.itemlist.item(ii)
                if item.value == sketch_from:
                    item.setSelected(True)
    
            for ii in range(self.sketchwidget_to.itemlist.count()):
                item = self.sketchwidget_to.itemlist.item(ii)
                if item.value == sketch_to:
                    item.setSelected(True)

        if self.placeop.operation_links is not None:
            id, jj = self.placeop.operation_links['from'][0]
            ii = design.operation_index(id)
            self.operation_list.selectIndeces([(ii, jj)])

        self.scalex.setText(str(self.placeop.scalex))
        self.scaley.setText(str(self.placeop.scaley))
        self.flip.setChecked(self.placeop.flip)
        self.sb.setValue(self.placeop.shift)
        self.sketchwidget_from.items_updated.connect(lambda:self.sketchwidget_to.refresh_list(retain_selection=True))
        self.sketchwidget_to.items_updated.connect(lambda:self.sketchwidget_from.refresh_list(retain_selection=True))
Ejemplo n.º 7
0
    def __init__(self, design, sketches, layers, operations, jointop=None,sketch = None):
        super(MainWidget, self).__init__()
        self.design = design
        self.sketches = sketches
        self.layers = layers
        self.operations = operations

        self.operation_list = DraggableTreeWidget()
        self.operation_list.linklist(self.operations)

        self.fixed = DraggableTreeWidget()
        self.fixed.linklist(self.operations)

        self.table = Table(JointRow(self.get_sketches, self.get_layers),Delegate)
        table_control= TableControl(self.table, self)


        self.sketchwidget = SketchListManager(self.design,name='Contact Points Sketch')
        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value == sketch:
                item.setSelected(True)

        button_ok = qg.QPushButton('Ok')
        button_cancel = qg.QPushButton('Cancel')

        button_ok.clicked.connect(self.accept)
        button_cancel.clicked.connect(self.reject)
                
        sublayout1 = qg.QHBoxLayout()
        sublayout1_1 = qg.QVBoxLayout()
        sublayout1_2 = qg.QVBoxLayout()
        sublayout1_3 = qg.QVBoxLayout()

        sublayout1_1.addWidget(qg.QLabel('Device'))
        sublayout1_1.addWidget(self.operation_list)
        sublayout1_2.addWidget(qg.QLabel('Fixed Region'))
        sublayout1_2.addWidget(self.fixed)
        sublayout1_3.addWidget(self.sketchwidget)

        sublayout1.addLayout(sublayout1_1)
        sublayout1.addLayout(sublayout1_2)
        sublayout1.addLayout(sublayout1_3)

        sublayout2 = qg.QHBoxLayout()
        sublayout2.addStretch()
        sublayout2.addWidget(button_ok)
        sublayout2.addWidget(button_cancel)
        sublayout2.addStretch()

        layout = qg.QVBoxLayout()
        layout.addLayout(sublayout1)
        layout.addWidget(table_control)
        layout.addLayout(sublayout2)
        
        self.setLayout(layout)

        if jointop is not None:
            try:
                op_ref, output_ii = jointop.operation_links['parent'][0]
                op_ii = design.operation_index(op_ref)
                self.operation_list.selectIndeces([(op_ii, output_ii)])
            except(IndexError, KeyError):
                pass

            try:
                fixed_ref, fixed_output_ii = jointop.operation_links[
                    'fixed'][0]
                fixed_ii = design.operation_index(fixed_ref)
                self.fixed.selectIndeces([(fixed_ii, fixed_output_ii)])
            except(IndexError, KeyError):
                pass

            for item in jointop.joint_defs:
                sketch = self.design.sketches[item.sketch]
                joint_layer = self.design.return_layer_definition().getlayer(
                    item.joint_layer)
                sublaminate_layers = [self.design.return_layer_definition().getlayer(
                    item2) for item2 in item.sublaminate_layers]
                self.table.row_add(
                    sketch,
                    joint_layer,
                    sublaminate_layers,
                    item.width,
                    item.stiffness,
                    item.damping,
                    item.preload_angle,
                    item.limit_negative,
                    item.limit_positive)            
        else:
            self.table.row_add_empty()

        self.table.resizeColumnsToContents()
        self.table.reset_min_width()
        self.table.setHorizontalScrollBarPolicy(qc.Qt.ScrollBarAlwaysOff)
Ejemplo n.º 8
0
    def __init__(self, design, prioroperations, placeop=None):
        super(Dialog, self).__init__()

        if placeop is None:
            self.placeop = TransformExternal(
                None, None, None, None, TransformExternal.transformtypes.scale,
                TransformExternal.transformtypes.scale, 0, False, 1., 1.)
        else:
            self.placeop = placeop

        self.prioroperations = prioroperations
        self.design = design

        self.designwidget = DesignListManager(design)

        self.operation_list = DraggableTreeWidget()
        self.operation_list.linklist(prioroperations)

        self.sketchwidget_from = SketchListViewer(design, name='From Line')
        self.sketchwidget_to = SketchListManager(design, name='To Lines')

        self.radiobox_scale_x = qg.QRadioButton('Scale X')
        self.radiobox_custom_x = qg.QRadioButton('Custom X')
        self.radiobox_scale_y = qg.QRadioButton('Scale Y')
        self.radiobox_custom_y = qg.QRadioButton('Custom Y')

        self.x_scale_option = qg.QButtonGroup()
        self.x_scale_option.addButton(self.radiobox_scale_x)
        self.x_scale_option.addButton(self.radiobox_custom_x)

        self.y_scale_option = qg.QButtonGroup()
        self.y_scale_option.addButton(self.radiobox_scale_y)
        self.y_scale_option.addButton(self.radiobox_custom_y)

        self.scalex = qg.QLineEdit()
        self.scaley = qg.QLineEdit()

        templayout1 = qg.QHBoxLayout()
        templayout1.addStretch()
        templayout1.addWidget(self.radiobox_scale_x)
        templayout1.addWidget(self.radiobox_custom_x)
        templayout1.addWidget(self.scalex)
        templayout1.addStretch()
        templayout2 = qg.QHBoxLayout()
        templayout2.addStretch()
        templayout2.addWidget(self.radiobox_scale_y)
        templayout2.addWidget(self.radiobox_custom_y)
        templayout2.addWidget(self.scaley)
        templayout2.addStretch()

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        layout5.addWidget(self.flip)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(popupcad.gui_negative_infinity,
                         popupcad.gui_positive_infinity)
        self.sb.setSingleStep(1)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout3 = qg.QHBoxLayout()
        layout3.addWidget(self.sketchwidget_from)
        layout3.addWidget(self.sketchwidget_to)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.designwidget)
        layout.addWidget(qg.QLabel('Operations'))
        layout.addWidget(self.operation_list)
        layout.addLayout(layout3)
        layout.addLayout(templayout1)
        layout.addLayout(templayout2)
        layout.addLayout(layout5)
        layout.addLayout(layout4)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.radiobox_scale_x.setChecked(False)
        self.radiobox_custom_x.setChecked(False)
        self.radiobox_scale_y.setChecked(False)
        self.radiobox_custom_y.setChecked(False)

        if self.placeop.transformtype_x == TransformExternal.transformtypes.scale:
            self.radiobox_scale_x.setChecked(True)
        elif self.placeop.transformtype_x == TransformExternal.transformtypes.custom:
            self.radiobox_custom_x.setChecked(True)

        if self.placeop.transformtype_y == TransformExternal.transformtypes.scale:
            self.radiobox_scale_y.setChecked(True)
        elif self.placeop.transformtype_y == TransformExternal.transformtypes.custom:
            self.radiobox_custom_y.setChecked(True)

        self.designwidget.itemlist.itemSelectionChanged.connect(
            self.loadoperations)

        if self.placeop.sketch_links is not None:
            sketch_to = self.design.sketches[
                self.placeop.sketch_links['sketch_to'][0]]

            for ii in range(self.sketchwidget_to.itemlist.count()):
                item = self.sketchwidget_to.itemlist.item(ii)
                if item.value == sketch_to:
                    item.setSelected(True)

        self.loadoperations()

        try:
            subdesign = design.subdesigns[
                self.placeop.design_links['subdesign'][0]]
            for ii in range(self.designwidget.itemlist.count()):
                item = self.designwidget.itemlist.item(ii)
                if item.value == subdesign:
                    item.setSelected(True)

            if self.placeop.subopref is not None:
                id, jj = self.placeop.subopref
                ii = subdesign.operation_index(id)
                self.operation_list.selectIndeces([(ii, jj)])

            sketch_from = subdesign.sketches[self.placeop.sub_sketch_id]
            for ii in range(self.sketchwidget_from.itemlist.count()):
                item = self.sketchwidget_from.itemlist.item(ii)
                if item.value == sketch_from:
                    item.setSelected(True)
        except TypeError:
            pass

        self.scalex.setText(str(self.placeop.scalex))
        self.scaley.setText(str(self.placeop.scaley))
        self.flip.setChecked(self.placeop.flip)
        self.sb.setValue(self.placeop.shift)
Ejemplo n.º 9
0
class Dialog(qg.QDialog):

    def __init__(self,design,prioroperations,placeop = None):
        super(Dialog, self).__init__()

        if placeop is None:
            self.placeop=TransformInternal(None,None,TransformInternal.transformtypes.scale,TransformInternal.transformtypes.scale,0,False,1.,1.)
        else:
            self.placeop = placeop

        self.prioroperations = prioroperations
        self.design = design

        self.operation_list = DraggableTreeWidget()
        self.operation_list.linklist(prioroperations)

        self.sketchwidget_from = SketchListManager(design)
        self.sketchwidget_to = SketchListManager(design)

        self.radiobox_scale_x = qg.QRadioButton('Scale X')
        self.radiobox_custom_x = qg.QRadioButton('Custom X')
        self.radiobox_scale_y = qg.QRadioButton('Scale Y')
        self.radiobox_custom_y = qg.QRadioButton('Custom Y')

        self.x_scale_option = qg.QButtonGroup()
        self.x_scale_option.addButton(self.radiobox_scale_x)
        self.x_scale_option.addButton(self.radiobox_custom_x)

        self.y_scale_option = qg.QButtonGroup()
        self.y_scale_option.addButton(self.radiobox_scale_y)
        self.y_scale_option.addButton(self.radiobox_custom_y)

#        custom_layout = qg.QVBoxLayout()
        self.scalex = qg.QLineEdit()
        self.scaley = qg.QLineEdit()

        templayout1 = qg.QHBoxLayout()
        templayout1.addStretch()
        templayout1.addWidget(self.radiobox_scale_x)
        templayout1.addWidget(self.radiobox_custom_x)
        templayout1.addWidget(self.scalex)
        templayout1.addStretch()
        templayout2 = qg.QHBoxLayout()
        templayout2.addStretch()
        templayout2.addWidget(self.radiobox_scale_y)
        templayout2.addWidget(self.radiobox_custom_y)
        templayout2.addWidget(self.scaley)
        templayout2.addStretch()

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        layout5.addWidget(self.flip)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(-100, 100)
        self.sb.setSingleStep(1)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Operations'))
        layout.addWidget(self.operation_list)
#        layout.addWidget(qg.QLabel('Sketch'))
        layout.addWidget(self.sketchwidget_from)
        layout.addWidget(self.sketchwidget_to)
        layout.addLayout(templayout1)
        layout.addLayout(templayout2)
        layout.addLayout(layout5)
        layout.addLayout(layout4)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.radiobox_scale_x.setChecked(False)
        self.radiobox_custom_x.setChecked(False)
        self.radiobox_scale_y.setChecked(False)
        self.radiobox_custom_y.setChecked(False)

        if self.placeop.transformtype_x == TransformInternal.transformtypes.scale:
            self.radiobox_scale_x.setChecked(True)
        elif self.placeop.transformtype_x == TransformInternal.transformtypes.custom:
            self.radiobox_custom_x.setChecked(True)

        if self.placeop.transformtype_y == TransformInternal.transformtypes.scale:
            self.radiobox_scale_y.setChecked(True)
        elif self.placeop.transformtype_y == TransformInternal.transformtypes.custom:
            self.radiobox_custom_y.setChecked(True)

        if self.placeop.sketch_links is not None:
            sketch_from = self.design.sketches[self.placeop.sketch_links['sketch_from'][0]]
            sketch_to = self.design.sketches[self.placeop.sketch_links['sketch_to'][0]]

            for ii in range(self.sketchwidget_from.itemlist.count()):
                item = self.sketchwidget_from.itemlist.item(ii)
                if item.value == sketch_from:
                    item.setSelected(True)
    
            for ii in range(self.sketchwidget_to.itemlist.count()):
                item = self.sketchwidget_to.itemlist.item(ii)
                if item.value == sketch_to:
                    item.setSelected(True)

        if self.placeop.operation_links is not None:
            id, jj = self.placeop.operation_links['from'][0]
            ii = design.operation_index(id)
            self.operation_list.selectIndeces([(ii, jj)])

        self.scalex.setText(str(self.placeop.scalex))
        self.scaley.setText(str(self.placeop.scaley))
        self.flip.setChecked(self.placeop.flip)
        self.sb.setValue(self.placeop.shift)
        self.sketchwidget_from.items_updated.connect(lambda:self.sketchwidget_to.refresh_list(retain_selection=True))
        self.sketchwidget_to.items_updated.connect(lambda:self.sketchwidget_from.refresh_list(retain_selection=True))
        
    def build_sketch_links(self):
        try:
            sketch_links = {}
            sketch_links['sketch_from']=[self.sketchwidget_from.itemlist.selectedItems()[0].value.id]
            sketch_links['sketch_to']=[self.sketchwidget_to.itemlist.selectedItems()[0].value.id]
            return sketch_links
        except IndexError:
            return None

    def acceptdata(self):
        if self.radiobox_scale_x.isChecked():
            transformtype_x = TransformInternal.transformtypes.scale
        elif self.radiobox_custom_x.isChecked():
            transformtype_x = TransformInternal.transformtypes.custom

        if self.radiobox_scale_y.isChecked():
            transformtype_y = TransformInternal.transformtypes.scale
        elif self.radiobox_custom_y.isChecked():
            transformtype_y = TransformInternal.transformtypes.custom

        ii, jj = self.operation_list.currentIndeces2()[0]
        opid = self.design.operations[ii].id
        opref = opid, jj
        operation_links = {'from':[opref]}
        sketch_links = self.build_sketch_links()
        
        shift = self.sb.value()
        flip = self.flip.isChecked()
        scale_x = float(self.scalex.text())
        scale_y = float(self.scaley.text())
                      
        return sketch_links, operation_links,transformtype_x, transformtype_y, shift, flip, scale_x, scale_y
Ejemplo n.º 10
0
class Dialog(qg.QDialog):
    def __init__(self, design, prioroperations, placeop=None):
        super(Dialog, self).__init__()

        if placeop is None:
            self.placeop = TransformInternal(
                None, None, TransformInternal.transformtypes.scale,
                TransformInternal.transformtypes.scale, 0, False, 1., 1.)
        else:
            self.placeop = placeop

        self.prioroperations = prioroperations
        self.design = design

        self.operation_list = DraggableTreeWidget()
        self.operation_list.linklist(prioroperations)

        self.sketchwidget_from = SketchListViewer(design, name='From Line')
        self.sketchwidget_to = SketchListManager(design, name='To Lines')

        self.radiobox_scale_x = qg.QRadioButton('Scale X')
        self.radiobox_custom_x = qg.QRadioButton('Custom X')
        self.radiobox_scale_y = qg.QRadioButton('Scale Y')
        self.radiobox_custom_y = qg.QRadioButton('Custom Y')

        self.x_scale_option = qg.QButtonGroup()
        self.x_scale_option.addButton(self.radiobox_scale_x)
        self.x_scale_option.addButton(self.radiobox_custom_x)

        self.y_scale_option = qg.QButtonGroup()
        self.y_scale_option.addButton(self.radiobox_scale_y)
        self.y_scale_option.addButton(self.radiobox_custom_y)

        #        custom_layout = qg.QVBoxLayout()
        self.scalex = qg.QLineEdit()
        self.scaley = qg.QLineEdit()

        templayout1 = qg.QHBoxLayout()
        templayout1.addStretch()
        templayout1.addWidget(self.radiobox_scale_x)
        templayout1.addWidget(self.radiobox_custom_x)
        templayout1.addWidget(self.scalex)
        templayout1.addStretch()
        templayout2 = qg.QHBoxLayout()
        templayout2.addStretch()
        templayout2.addWidget(self.radiobox_scale_y)
        templayout2.addWidget(self.radiobox_custom_y)
        templayout2.addWidget(self.scaley)
        templayout2.addStretch()

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        layout5.addWidget(self.flip)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(popupcad.gui_negative_infinity,
                         popupcad.gui_positive_infinity)
        self.sb.setSingleStep(1)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout3 = qg.QHBoxLayout()
        layout3.addWidget(self.sketchwidget_from)
        layout3.addWidget(self.sketchwidget_to)

        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Operations'))
        layout.addWidget(self.operation_list)
        #        layout.addWidget(qg.QLabel('Sketch'))
        layout.addLayout(layout3)
        layout.addLayout(templayout1)
        layout.addLayout(templayout2)
        layout.addLayout(layout5)
        layout.addLayout(layout4)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.radiobox_scale_x.setChecked(False)
        self.radiobox_custom_x.setChecked(False)
        self.radiobox_scale_y.setChecked(False)
        self.radiobox_custom_y.setChecked(False)

        if self.placeop.transformtype_x == TransformInternal.transformtypes.scale:
            self.radiobox_scale_x.setChecked(True)
        elif self.placeop.transformtype_x == TransformInternal.transformtypes.custom:
            self.radiobox_custom_x.setChecked(True)

        if self.placeop.transformtype_y == TransformInternal.transformtypes.scale:
            self.radiobox_scale_y.setChecked(True)
        elif self.placeop.transformtype_y == TransformInternal.transformtypes.custom:
            self.radiobox_custom_y.setChecked(True)

        if self.placeop.sketch_links is not None:
            sketch_from = self.design.sketches[
                self.placeop.sketch_links['sketch_from'][0]]
            sketch_to = self.design.sketches[
                self.placeop.sketch_links['sketch_to'][0]]

            for ii in range(self.sketchwidget_from.itemlist.count()):
                item = self.sketchwidget_from.itemlist.item(ii)
                if item.value == sketch_from:
                    item.setSelected(True)

            for ii in range(self.sketchwidget_to.itemlist.count()):
                item = self.sketchwidget_to.itemlist.item(ii)
                if item.value == sketch_to:
                    item.setSelected(True)

        if self.placeop.operation_links is not None:
            id, jj = self.placeop.operation_links['from'][0]
            ii = design.operation_index(id)
            self.operation_list.selectIndeces([(ii, jj)])

        self.scalex.setText(str(self.placeop.scalex))
        self.scaley.setText(str(self.placeop.scaley))
        self.flip.setChecked(self.placeop.flip)
        self.sb.setValue(self.placeop.shift)
        self.sketchwidget_from.items_updated.connect(
            lambda: self.sketchwidget_to.refresh_list(retain_selection=True))
        self.sketchwidget_to.items_updated.connect(
            lambda: self.sketchwidget_from.refresh_list(retain_selection=True))

    def build_sketch_links(self):
        try:
            sketch_links = {}
            sketch_links['sketch_from'] = [
                self.sketchwidget_from.itemlist.selectedItems()[0].value.id
            ]
            sketch_links['sketch_to'] = [
                self.sketchwidget_to.itemlist.selectedItems()[0].value.id
            ]
            return sketch_links
        except IndexError:
            return None

    def acceptdata(self):
        if self.radiobox_scale_x.isChecked():
            transformtype_x = TransformInternal.transformtypes.scale
        elif self.radiobox_custom_x.isChecked():
            transformtype_x = TransformInternal.transformtypes.custom

        if self.radiobox_scale_y.isChecked():
            transformtype_y = TransformInternal.transformtypes.scale
        elif self.radiobox_custom_y.isChecked():
            transformtype_y = TransformInternal.transformtypes.custom

        ii, jj = self.operation_list.currentIndeces2()[0]
        opid = self.design.operations[ii].id
        opref = opid, jj
        operation_links = {'from': [opref]}
        sketch_links = self.build_sketch_links()

        shift = self.sb.value()
        flip = self.flip.isChecked()
        scale_x = float(self.scalex.text())
        scale_y = float(self.scaley.text())

        return sketch_links, operation_links, transformtype_x, transformtype_y, shift, flip, scale_x, scale_y
Ejemplo n.º 11
0
    def __init__(self,
                 design,
                 prioroperations,
                 sketch=None,
                 subdesign=None,
                 subopref=None,
                 transformtype_x=None,
                 transformtype_y=None,
                 shift=0,
                 flip=False,
                 scalex=1.,
                 scaley=1.):
        super(Dialog, self).__init__()

        if transformtype_x is None:
            self.transformtype_x = PlaceOperation8.transformtypes.scale
        else:
            self.transformtype_x = transformtype_x

        if transformtype_y is None:
            self.transformtype_y = PlaceOperation8.transformtypes.scale
        else:
            self.transformtype_y = transformtype_y

        self.prioroperations = prioroperations
        self.design = design

        self.designwidget = DesignListManager(design)

        self.optree = DraggableTreeWidget()

        self.sketchwidget = SketchListManager(design)

        self.radiobox_scale_x = qg.QRadioButton('Scale X')
        self.radiobox_custom_x = qg.QRadioButton('Custom X')
        self.radiobox_scale_y = qg.QRadioButton('Scale Y')
        self.radiobox_custom_y = qg.QRadioButton('Custom Y')

        self.x_scale_option = qg.QButtonGroup()
        self.x_scale_option.addButton(self.radiobox_scale_x)
        self.x_scale_option.addButton(self.radiobox_custom_x)

        self.y_scale_option = qg.QButtonGroup()
        self.y_scale_option.addButton(self.radiobox_scale_y)
        self.y_scale_option.addButton(self.radiobox_custom_y)

        #        custom_layout = qg.QVBoxLayout()
        self.scalex = qg.QLineEdit()
        self.scaley = qg.QLineEdit()
        self.scalex.setText(str(scalex))
        self.scaley.setText(str(scaley))
        #        custom_layout.addWidget(self.scalex)
        #        custom_layout.addWidget(self.scaley)

        templayout1 = qg.QHBoxLayout()
        templayout1.addStretch()
        templayout1.addWidget(self.radiobox_scale_x)
        templayout1.addWidget(self.radiobox_custom_x)
        templayout1.addWidget(self.scalex)
        templayout1.addStretch()
        templayout2 = qg.QHBoxLayout()
        templayout2.addStretch()
        templayout2.addWidget(self.radiobox_scale_y)
        templayout2.addWidget(self.radiobox_custom_y)
        templayout2.addWidget(self.scaley)
        templayout2.addStretch()

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        self.flip.setChecked(flip)
        layout5.addWidget(self.flip)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(popupcad.gui_negative_infinity,
                         popupcad.gui_positive_infinity)
        self.sb.setSingleStep(1)
        self.sb.setValue(shift)
        layout4.addWidget(self.sb)

        #        layout3 = qg.QHBoxLayout()
        #        layout3.addWidget(self.lineedit)
        #        layout3.addWidget(button3)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        #        layout.addWidget(qg.QLabel('Design'))
        layout.addWidget(self.designwidget)
        layout.addWidget(qg.QLabel('Sub-Design Operations'))
        layout.addWidget(self.optree)
        #        layout.addWidget(qg.QLabel('Sketch'))
        layout.addWidget(self.sketchwidget)
        layout.addLayout(templayout1)
        layout.addLayout(templayout2)
        layout.addLayout(layout5)
        layout.addLayout(layout4)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.radiobox_scale_x.setChecked(False)
        self.radiobox_custom_x.setChecked(False)
        self.radiobox_scale_y.setChecked(False)
        self.radiobox_custom_y.setChecked(False)

        if self.transformtype_x == PlaceOperation8.transformtypes.scale:
            self.radiobox_scale_x.setChecked(True)
        elif self.transformtype_x == PlaceOperation8.transformtypes.custom:
            self.radiobox_custom_x.setChecked(True)

        if self.transformtype_y == PlaceOperation8.transformtypes.scale:
            self.radiobox_scale_y.setChecked(True)
        elif self.transformtype_y == PlaceOperation8.transformtypes.custom:
            self.radiobox_custom_y.setChecked(True)

        self.designwidget.itemlist.itemSelectionChanged.connect(
            self.loadoperations)

        for ii in range(self.designwidget.itemlist.count()):
            item = self.designwidget.itemlist.item(ii)
            if item.value == subdesign:
                item.setSelected(True)

        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value == sketch:
                item.setSelected(True)

        self.loadoperations()
        try:
            if subopref is not None:
                id, jj = subopref
                if subdesign is not None:
                    ii = subdesign.operation_index(id)
                    self.optree.selectIndeces([(ii, jj)])
        except NoOperation:
            pass
Ejemplo n.º 12
0
    def __init__(self, design, prioroperations, placeop=None):
        super(Dialog, self).__init__()

        if placeop is None:
            self.placeop = TransformExternal(
                None,
                None,
                None,
                None,
                TransformExternal.transformtypes.scale,
                TransformExternal.transformtypes.scale,
                0,
                False,
                1.0,
                1.0,
            )
        else:
            self.placeop = placeop

        self.prioroperations = prioroperations
        self.design = design

        self.designwidget = DesignListManager(design)

        self.operation_list = DraggableTreeWidget()
        self.operation_list.linklist(prioroperations)

        self.sketchwidget_from = SketchListManager(design)
        self.sketchwidget_to = SketchListManager(design)

        self.radiobox_scale_x = qg.QRadioButton("Scale X")
        self.radiobox_custom_x = qg.QRadioButton("Custom X")
        self.radiobox_scale_y = qg.QRadioButton("Scale Y")
        self.radiobox_custom_y = qg.QRadioButton("Custom Y")

        self.x_scale_option = qg.QButtonGroup()
        self.x_scale_option.addButton(self.radiobox_scale_x)
        self.x_scale_option.addButton(self.radiobox_custom_x)

        self.y_scale_option = qg.QButtonGroup()
        self.y_scale_option.addButton(self.radiobox_scale_y)
        self.y_scale_option.addButton(self.radiobox_custom_y)

        self.scalex = qg.QLineEdit()
        self.scaley = qg.QLineEdit()

        templayout1 = qg.QHBoxLayout()
        templayout1.addStretch()
        templayout1.addWidget(self.radiobox_scale_x)
        templayout1.addWidget(self.radiobox_custom_x)
        templayout1.addWidget(self.scalex)
        templayout1.addStretch()
        templayout2 = qg.QHBoxLayout()
        templayout2.addStretch()
        templayout2.addWidget(self.radiobox_scale_y)
        templayout2.addWidget(self.radiobox_custom_y)
        templayout2.addWidget(self.scaley)
        templayout2.addStretch()

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel("Flip Layers"))
        self.flip = qg.QCheckBox()
        layout5.addWidget(self.flip)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel("Shift Layers"))
        self.sb = qg.QSpinBox()
        self.sb.setRange(-100, 100)
        self.sb.setSingleStep(1)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton("Ok")
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton("Cancel")
        button2.clicked.connect(self.reject)

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.designwidget)
        layout.addWidget(qg.QLabel("Operations"))
        layout.addWidget(self.operation_list)
        layout.addWidget(self.sketchwidget_from)
        layout.addWidget(self.sketchwidget_to)
        layout.addLayout(templayout1)
        layout.addLayout(templayout2)
        layout.addLayout(layout5)
        layout.addLayout(layout4)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.radiobox_scale_x.setChecked(False)
        self.radiobox_custom_x.setChecked(False)
        self.radiobox_scale_y.setChecked(False)
        self.radiobox_custom_y.setChecked(False)

        if self.placeop.transformtype_x == TransformExternal.transformtypes.scale:
            self.radiobox_scale_x.setChecked(True)
        elif self.placeop.transformtype_x == TransformExternal.transformtypes.custom:
            self.radiobox_custom_x.setChecked(True)

        if self.placeop.transformtype_y == TransformExternal.transformtypes.scale:
            self.radiobox_scale_y.setChecked(True)
        elif self.placeop.transformtype_y == TransformExternal.transformtypes.custom:
            self.radiobox_custom_y.setChecked(True)

        self.designwidget.itemlist.itemSelectionChanged.connect(self.loadoperations)

        if self.placeop.sketch_links is not None:
            sketch_to = self.design.sketches[self.placeop.sketch_links["sketch_to"][0]]

            for ii in range(self.sketchwidget_to.itemlist.count()):
                item = self.sketchwidget_to.itemlist.item(ii)
                if item.value == sketch_to:
                    item.setSelected(True)

        self.loadoperations()

        try:
            subdesign = design.subdesigns[self.placeop.design_links["subdesign"][0]]
            for ii in range(self.designwidget.itemlist.count()):
                item = self.designwidget.itemlist.item(ii)
                if item.value == subdesign:
                    item.setSelected(True)

            if self.placeop.subopref is not None:
                id, jj = self.placeop.subopref
                ii = subdesign.operation_index(id)
                self.operation_list.selectIndeces([(ii, jj)])

            sketch_from = subdesign.sketches[self.placeop.sub_sketch_id]
            for ii in range(self.sketchwidget_from.itemlist.count()):
                item = self.sketchwidget_from.itemlist.item(ii)
                if item.value == sketch_from:
                    item.setSelected(True)
        except TypeError:
            pass

        self.scalex.setText(str(self.placeop.scalex))
        self.scaley.setText(str(self.placeop.scaley))
        self.flip.setChecked(self.placeop.flip)
        self.sb.setValue(self.placeop.shift)