コード例 #1
0
def stack_selectDimensioningPoint(event, referer, elementXML, elementParms,
                                  elementViewObject):
    viewInfo = selectionOverlay.DrawingsViews_info[elementViewObject.Name]
    if len(d.selections) == 0:
        if isinstance(referer, selectionOverlay.PointSelectionGraphicsItem):
            d.selections.append(
                PointSelection(elementParms, elementXML, viewInfo))
            d.selections[-1].condensed_args = True
            selectionOverlay.hideSelectionGraphicsItems(lambda gi: isinstance(
                gi, selectionOverlay.LineSelectionGraphicsItem))
        else:
            d.selections.append(
                LineSelection(elementParms, elementXML, viewInfo))
            linearDimension_parallels_hide_non_parallel(
                elementParms, elementViewObject)
        d.viewScale = 1 / elementXML.rootNode().scaling()
    else:
        if isinstance(referer, selectionOverlay.PointSelectionGraphicsItem):
            d.selections.append(
                PointSelection(elementParms, elementXML, viewInfo))
            d.selections[-1].condensed_args = True
        else:
            d.selections.append(
                LineSelection(elementParms, elementXML, viewInfo))
        if len(d.selections) == 2:
            previewDimension.initializePreview(
                d, linearDimension_stack_preview,
                linearDimension_stack_clickHandler)
コード例 #2
0
def stack_selectDimensioningPoint( event, referer, elementXML, elementParms, elementViewObject ):
    if d.stage == 0:
        if isinstance(referer,selectionOverlay.PointSelectionGraphicsItem):
            d.reference_type = 'point'
            d.selections = [[elementParms['x'], elementParms['y']]]
            selectionOverlay.hideSelectionGraphicsItems(
                lambda gi: isinstance(gi,  selectionOverlay.LineSelectionGraphicsItem)
                )
        else:
            d.reference_type = 'line'
            d.selections = [[ elementParms[k] for k in [ 'x1', 'y1', 'x2', 'y2' ] ]]
            linearDimension_parallels_hide_non_parallel( elementParms, elementViewObject)
        d.stage = 1
        d.viewScale = 1 / elementXML.rootNode().scaling()
    else:
        if isinstance(referer,selectionOverlay.PointSelectionGraphicsItem):
            d.selections.append( [elementParms['x'], elementParms['y']] )
        else:
            d.selections.append( [ elementParms[k] for k in [ 'x1', 'y1', 'x2', 'y2' ] ] )
        if len(d.selections) == 2:
            previewDimension.initializePreview( d, linearDimension_stack_preview, linearDimension_stack_clickHandler )
コード例 #3
0
def stack_selectDimensioningPoint( event, referer, elementXML, elementParms, elementViewObject ):
    viewInfo = selectionOverlay.DrawingsViews_info[elementViewObject.Name]
    if len(d.selections) == 0:
        if isinstance(referer, selectionOverlay.PointSelectionGraphicsItem):
            d.selections.append( PointSelection( elementParms, elementXML, viewInfo ) )
            d.selections[-1].condensed_args = True
            selectionOverlay.hideSelectionGraphicsItems(
                lambda gi: isinstance(gi, selectionOverlay.LineSelectionGraphicsItem)
                )
        else:
            d.selections.append( LineSelection( elementParms, elementXML, viewInfo ) )
            linearDimension_parallels_hide_non_parallel( elementParms, elementViewObject)
        d.viewScale = 1 / elementXML.rootNode().scaling()
    else:
        if isinstance(referer, selectionOverlay.PointSelectionGraphicsItem):
            d.selections.append( PointSelection( elementParms, elementXML, viewInfo ) )
            d.selections[-1].condensed_args = True
        else:
            d.selections.append( LineSelection( elementParms, elementXML, viewInfo ) )
        if len(d.selections) == 2:
            previewDimension.initializePreview(d, linearDimension_stack_preview, linearDimension_stack_clickHandler)
コード例 #4
0
def selectFun(  event, referer, elementXML, elementParms, elementViewObject ):
    if not isinstance(referer,selectionOverlay.LineSelectionGraphicsItem):
        x,y = elementParms['x'], elementParms['y']
        d.args = [[x, y]]
        d.stage = 1
        d.dimScale = elementXML.rootNode().scaling()
        debugPrint(3, 'center selected at x=%3.1f y=%3.1f scale %3.1f' % (x,y, d.dimScale))
        selectionOverlay.hideSelectionGraphicsItems()
        previewDimension.initializePreview( d, centerLine_preview , centerLine_clickHandler)
    else:
        if d.stage == 0:
            d.line1 = [ elementParms[k] for k in [ 'x1', 'y1', 'x2', 'y2' ] ]
            d.stage = 1
            linearDimension_parallels_hide_non_parallel( elementParms, elementViewObject)
        else:
            x1, y1, x2, y2 = d.line1
            x3, y3, x4, y4 = [ elementParms[k] for k in [ 'x1', 'y1', 'x2', 'y2' ] ]
            d.args = [[0.25*(x1 + x2 + x3 + x4), 0.25*(y1 + y2 + y3 + y4)]]
            d.stage = 1
            d.dimScale = elementXML.rootNode().scaling()
            selectionOverlay.hideSelectionGraphicsItems()
            previewDimension.initializePreview( d, centerLine_preview , centerLine_clickHandler)
コード例 #5
0
def selectFun(  event, referer, elementXML, elementParms, elementViewObject ):
    viewInfo = selectionOverlay.DrawingsViews_info[elementViewObject.Name]
    d.viewScale = elementXML.rootNode().scaling()
    # center line
    if isinstance(referer,selectionOverlay.PointSelectionGraphicsItem):
        d.selections = [ PointSelection( elementParms, elementXML, viewInfo, condensed_args=True ) ]
        selectionOverlay.hideSelectionGraphicsItems()
        previewDimension.initializePreview( d, centerLine_preview , centerLine_clickHandler)
    elif isinstance(referer,selectionOverlay.LineSelectionGraphicsItem):
        if len(d.selections) == 0:
            d.selections = [ TwoLineSelection() ]
            linearDimension_parallels_hide_non_parallel( elementParms, elementViewObject)
            for gi in selectionOverlay.graphicItems:
                if isinstance(gi,  selectionOverlay.PointSelectionGraphicsItem):
                    gi.hide()
        d.selections[0].addLine(  elementParms, elementXML, viewInfo )
        if len(d.selections[0].lines) == 2:
            selectionOverlay.hideSelectionGraphicsItems()
            previewDimension.initializePreview( d, centerLine_preview , centerLine_clickHandler)
    else: #centerlines selection overlay
        d.selections = [ CircularArcSelection( elementParms, elementXML, viewInfo, output_mode = 'xy' ) ]
        selectionOverlay.hideSelectionGraphicsItems()
        previewDimension.initializePreview( d, centerLine_preview , centerLine_clickHandler)