📄 del_unconn.il
字号:
;; callback for delete unconnected shapes confirmation form
;;
(defun _ducCallBack (form)
; determine which button has been pushed and act accordingly
(cond
((equal (get form 'curField) "duc_select_layer")
(_ducGetDeletable))
((equal (get form 'curField) "duc_yes")
(when _ducEligibleShapes (_ducDeleteCurrent)))
((equal (get form 'curField) "duc_no")
(when _ducEligibleShapes (_ducPopCurrent)))
((equal (get form 'curField) "duc_all")
(when _ducEligibleShapes (_ducDeleteAll)))
((equal (get form 'curField) "done")(_ducAbort))
) ; cond
; now, refresh the display so all this stuff REALLY happens
(axlFlushDisplay)
) ; _ducCallBack
;;
;; _ducDeleteCurrent
;;
;; function to delete the current head of the eligible shape list, and to
;; present the next one in the list for deletion
;;
(defun _ducDeleteCurrent ()
(let ((current (car _ducEligibleShapes)))
(setq _ducEligibleShapes (cdr _ducEligibleShapes))
; tell the user which shape was deleted
(axlMsgPut (list
"Unconnected Shape at (%g, %g), layer %s, net \"%s\" deleted."
0)
(caar (car current->segments)->startEnd)
(cadar (car current->segments)->startEnd)
current->layer current->net->name)
; delete it
(axlDeleteObject current)
; if the shape's layer was invisible before we presented it, blank it now
(_ducResetVisible)
; if there are any remaining shapes, present the next one. Otherwise,
; reset the deletable list
(cond ((car _ducEligibleShapes)
(_ducPresentShape (car _ducEligibleShapes)))
(t (_ducGetDeletable))
) ; cond
) ; let
) ; _ducDeleteCurrent
;;
;; _ducDeleteAll
;;
;; function to delete all shapes in current list. This does not mean ALL shapes,
;; rather all that remain in the list. All shapes that have been Popped off of ;; the list will not be deleted. Function highlights all shapes remaining,
;; makes all layers visible that are invisible (for each shape), then windows
;; out far enough to display them all
;;
(defun _ducDeleteAll ()
; retrieve the extents of ALL
(axlWindowBoxSet (expand_window (emiGetExtents _ducEligibleShapes) 2))
; set all invisible layers visible
(foreach current _ducEligibleShapes
(setq _ducWasInvisible
(cons (_ducMadeVisible current->layer) _ducWasInvisible))
) ; foreach
; highlight all
(foreach current _ducEligibleShapes
(axlHighlightObject current)
) ; foreach
; verify
(cond ((axlUIYesNo
(sprintf nil
"Delete these %d remaining unconnected shapes on current layer?"
(length _ducEligibleShapes)))
(foreach current _ducEligibleShapes
; tell the user which shape was deleted
(axlMsgPut (list
"Unconnected Shape at (%g, %g), layer %s, net \"%s\" deleted."
0)
(caar (car current->segments)->startEnd)
(cadar (car current->segments)->startEnd)
current->layer current->net->name)
; delete it
(axlDeleteObject current)
) ; foreach
; re-fetch remaining
(_ducGetDeletable)
) ; cond Yes
; otherwise, if Delete All rejected, return to the first one in the list
(t
; de-highlight all
(foreach current _ducEligibleShapes
(axlDehighlightObject current)
)
; reset visibility
(_ducResetVisible)
; and present the first one in the list again
(_ducPresentShape (car _ducEligibleShapes))
) ; cond No
) ; cond YesNo
) ; _ducDeleteAll
;;
;; _ducPopCurrent
;;
;; function to pop the current element off of the top of the list without
;; deleting it
;;
(defun _ducPopCurrent ()
; dehighlight it
(axlDehighlightObject (car _ducEligibleShapes))
; if the shape's layer was invisible before we presented it, blank it now
(_ducResetVisible)
; skip to the next object in the list
(setq _ducEligibleShapes (cdr _ducEligibleShapes))
; if there are any remaining, present the next one in the list for deletion. ; Otherwise, abort
(cond ((car _ducEligibleShapes)
(_ducPresentShape (car _ducEligibleShapes)))
(t (_ducGetDeletable))
) ; cond
) ; _ducPopCurrent
;;
;; _ducAbort
;;
;; function to abort the deletion function. Function brings down the open form,
;; and restores invisible layers if they were exposed
;;
(defun _ducAbort ()
; if there is an active, highlighted shape, unhighlight it
(when (car _ducEligibleShapes)
(axlDehighlightObject (car _ducEligibleShapes))
) ; when
; close the form
(axlFormClose _ducForm)
; if the shape's layer was invisible, restore it to invisible
(_ducResetVisible)
(axlFlushDisplay)
; finally, restore original window
(_ducResetWindow)
) ; _ducAbort
;;
;; _ducMadeVisible
;;
;; function to determine if a given shapes's layer is invisible. If so, function
;; makes that layer visible, and remembers that it was invisible so that another;; function can restore it to invisible later
;;
(defun _ducMadeVisible (layer)
(let ((layer_words (parseString layer "/"))
(madevisible nil)
layerp
)
; insure that the layer is visible
(setq layerp (axlGetParam
(strcat "paramLayerGroup:ETCH/paramLayer:"
(cadr layer_words))))
; if the layer is invisible, make it visible
(unless layerp->visible
(layerp->visible = t)
(axlSetParam layerp)
(setq madevisible layerp)
) ; unless
; return layer if invisible
madevisible
) ; let
) ; _ducMadeVisible
;;
;; _ducResetVisible
;;
;; function to restore the invisibility of the active shape's layer. If that
;; layer was invisible when we started, function will restore it to invisible.
;;
(defun _ducResetVisible ()
(foreach layer _ducWasInvisible
(when layer
; make it invisible
(layer->visible = nil)
(axlFlushDisplay)
; set it in the database
(axlSetParam layer)
) ; when
) ; foreach
(setq _ducWasInvisible nil)
) ; _ducResetVisible
;;
;; _ducResetWindow
;;
;; resets the window to the original window when the command began
;;
(defun _ducResetWindow ()
(axlWindowBoxSet _ducWindow)
) ; _ducResetWindow
;;
;; _ducFindAllShapes
;;
;; finds all shapes
;;
(defun _ducFindAllShapes ()
(let (selSet)
; clear the selection set
(axlClearSelSet)
; establish the find filter to find all shapes
(axlSetFindFilter ?enabled (list "noall" "SHAPES" "invisible")
?onButtons "all")
; add all shapes in the database to the selection set
(axlAddSelectAll)
; retrieve the desired shapes
(setq selSet (axlGetSelSet))
; clear those highlighted objects
(axlClearSelSet)
; return the selected shapes
selSet
) ; let
) ; _ducFindAllShapes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -