📄 del_unconn.il
字号:
; $Header: $
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; SKILL file
; del_unconn.il -- file containing function to delete unconnected etch shapes
;
; This module contains: expand_window
; _ducMain
; _ducGetDeletable
; _ducCallBack
; _ducDeleteCurrent
; _ducDeleteAll
; _ducPopCurrent
; _ducAbort
; _ducMadeVisible
; _ducResetVisible
; _ducResetWindow
;
;
;
;;
;; _ducMain
;;
;; Allegro command for deleting unconnected shapes. Function initiates global
;; variables, opens the form, and builds the initial list of shapes eligible
;; for deletion. Form opened is a blocking function, and returns control to
;; this function only upon its termination
;;
;; In addition to this file, you will need to download the .form file
;; which has also been downloaded into shareware.
;;
;; After installation into your local skill environment directory, type
;; "del unconn" to execute.
;;
axlCmdRegister( "del unconn" '_ducMain)
(defun _ducMain ()
(let (layer_name
(default_layer
(parseString (axlGetParam "paramDisplay")->activeLayer "/"))
)
; make a list of eligible shapes
(setq _ducEligibleShapes nil)
; indicate whether or not current shape's
; layer is visible
(setq _ducWasInvisible nil)
; remember the current window so we can return to it upon completion
; of the command
(setq _ducWindow (axlWindowBoxGet))
; open the form
(axlFormCreate '_ducForm "del_unconn.form" '("south" "outer")
'_ducCallBack nil)
; build the available subclass popup
(axlFormBuildPopup _ducForm "duc_select_layer"
(cons "All" (axlGetParam "paramLayerGroup:ETCH")->groupMembers))
; if the default class is etch, use the default subclass,
; otherwise, use the first ETCH subclass
(cond ((eq (strcmp (car default_layer) "ETCH") 0)
(setq layer_name (cadr default_layer))
) ; class eq ETCH
(t (setq layer_name
(car (axlGetParam "paramLayerGroup:ETCH")->groupMembers))
) ; else
) ; cond default layer
; set the default layer name into the form
(axlFormSetField _ducForm "duc_select_layer" layer_name)
; find all shapes, and display the first one
(_ducGetDeletable)
; and display the form
(axlFormDisplay _ducForm)
) ; let
) ; _ducMain
/*
#ifdef DOC_C
NAME
expand_window - Function to expand a window by an integral scaling factor
SYNOPSIS
expand_window(
l_window
x_factor
)
==> l_window
FUNCTION
The expand_window function expands the minimum and maximum points away
from the center of the window. The factor provided indicates how much
larger than the original window the final window should be. This function
does not provide for fractional or negative expansion.
NEEDS
l_window - list containing the min point and max point of the window. Function
does no checking for order, assumes that min is the first point
pair in the list and that the max is the second point. i.e.:
((minx miny)(maxx maxy))
x_factor - positive integral expansion factor.
RETURNS
expand_window - list containing expanded window points
NOTE
final window is not guaranteed to be within any limits
EXAMPLE
#endif
*/
;;
;; expand_window
;;
;; factor the size of a window
;;
;; basic function for all points is (F + 1)/2 * (point) - (F-1)/2 *opposite point
;; where F is the integer scaling factor
;;
(defun expand_window (window F)
(let ((x1 (caar window)) ; first item in first list
(y1 (cadar window)); second item in first list
(x2 (caadr window)) ; first item in second list
(y2 (cadadr window)); second item in second list
f1 f2 f3 f4)
(setq f1 (quotient (difference (times (plus F 1) x1)
(times (difference F 1) x2)) 2))
(setq f2 (quotient (difference (times (plus F 1) y1)
(times (difference F 1) y2)) 2))
(setq f3 (quotient (difference (times (plus F 1) x2)
(times (difference F 1) x1)) 2))
(setq f4 (quotient (difference (times (plus F 1) y2)
(times (difference F 1) y1)) 2))
(setq window (list (list f1 f2) (list f3 f4)))
window
) ; let
) ; expand_window
;;
;; _ducPresentShape
;;
;; support function for _ducMain - takes a provided shape,
;; windows in on it, and highlights it. Function also sets net and layer
;; fields in the form
;;
(defun _ducPresentShape (shape)
(let (window layer_words net_name)
; make layer visible if it is not
(setq _ducWasInvisible
(cons (_ducMadeVisible shape->layer) _ducWasInvisible))
; given shape extents, window in
(setq window shape->bBox)
(setq window (expand_window window 3))
; window in on it
(axlWindowBoxSet window)
; highlight the shape
(axlHighlightObject shape)
; set the fields in the form for net and layer
(setq layer_words (parseString shape->layer "/"))
(cond ((eq shape->net->name "")
(setq net_name "<none>"))
(t (setq net_name shape->net->name))
) ; cond
; fill in the required fields in the form
(axlFormSetField _ducForm "duc_layer" (cadr layer_words))
(axlFormSetField _ducForm "duc_net" net_name)
(axlFormSetInfo _ducForm "duc_count"
(sprintf nil "%d" (length _ducEligibleShapes)))
) ; let
) ; _ducPresentShape
;;
;; _ducGetDeletable
;;
;; function to process all unconnected shapes on current ETCH layer, present
;; them to the user, and determine if the user wants to delete said shape
;;
(defun _ducGetDeletable ()
(let ((shapes (_ducFindAllShapes))
(layer_wo_etch (axlFormGetField _ducForm "duc_select_layer"))
layer_words
)
; reset visibility in case previously viewed layer was invisible
(_ducResetVisible)
; reset the available list
(setq _ducEligibleShapes nil)
; walk all the shapes on the layout
(foreach shape shapes
; retrieve the subclass portion of the layer string for the shape
(setq layer_words (parseString shape->layer "/"))
; insure that the shape is an ETCH shape
(cond ((eq (strcmp "ETCH" (car layer_words)) 0)
; verify that the shape is not connected
(cond ((eq shape->connect nil)
; accept all etch shapes if wildcarded
(cond ((eq (strcmp layer_wo_etch "All") 0)
(setq _ducEligibleShapes
(cons shape _ducEligibleShapes))
) ; eq "*"
; accept specific layer match if no wildcard
((eq (strcmp
layer_wo_etch (cadr layer_words)) 0)
(setq _ducEligibleShapes
(cons shape _ducEligibleShapes))
) ; eq strmp
) ; cond layer name
) ; cond connect nil
) ; cond connect
) ; eq ETCH
) ; cond etch
) ; foreach shape
; if any eligible shapes exist
(cond (_ducEligibleShapes
; show the first shape to the user
(_ducPresentShape (car _ducEligibleShapes))
(axlFlushDisplay)
) ; cond _ducEligibleShapes
; if not eligible shapes, then say so
(t (axlMsgPut (list "No eligible shapes on layer %s." 2)
layer_wo_etch)
(axlFormSetInfo _ducForm "duc_count" "0")
(axlFormSetField _ducForm "duc_layer" "")
(axlFormSetField _ducForm "duc_net" "")
(_ducResetWindow)
) ; else
) ; cond
) ; let
t
) ; _ducGetDeletable
;;
;; _ducCallBack
;;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -