📄 cwidth.il
字号:
;###########################################################
;# #
;# Main Program lcb_changewidth #
;# #
;###########################################################
axlCmdRegister("cwidth" 'lcb_changewidth)
(defun lcb_changewidth (@optional (args ""))
prog( ()
;; Check for command line arguments
if(args != "" then
;; display help file
axlUIWPrint(nil "")
axlUIWPrint(nil " - Displaying INFO information. -")
cwidth_info_createInfo()
return()
); endif
dbaccuracy = nthelem(2 axlDBGetDesignUnits())
dbunits = nthelem(1 axlDBGetDesignUnits())
doagain = nil
l_swidth = nil
newwidth = nil
sourcewidth = nil
lwidthpopup = list(list("0" "0"))
LCB_getlayers()
curdrcs = axlDRCGetCount()
_createForm_changewidth(lpopstack)
changewidth_Form=axlFormCreate( (gensym) changewidth_form_file nil 'changewidth_Form_Action t)
axlFormDisplay(changewidth_Form)
axlFormBuildPopup(changewidth_Form "layers" lstackpopup)
axlFormBuildPopup(changewidth_Form "widths" lwidthpopup)
axlUIWPrint(changewidth_Form "** Current DRCS: %n **" curdrcs)
axlUIWPrint(nil "** Current DRCS: %n **" curdrcs)
if(isFile(changewidth_form_file)
deleteFile(changewidth_form_file)
);endif
); end prog
); end defun
;###########################################################
;# #
;# End of Main Program lcb_changewidth #
;# #
;###########################################################
;###########################################################
;# #
;# changewidth_Form_Action #
;# #
;###########################################################
(defun changewidth_Form_Action (changewidth_Form)
(case changewidth_Form->curField
("layers"
layername = changewidth_Form->curValue
axlFormSetField(changewidth_Form "widths" "")
LCB_formupdate()
)
("widths"
sourcewidth = evalstring(changewidth_Form->curValue)
if(l_swidth then
axlDehighlightObject(l_swidth)
axlFlushDisplay()
l_swidth = list()
); endif
fnumaccuracy = dbaccuracy + 1
tol = expt(10 -fnumaccuracy)
l_swidth = setof(sw layerclinesegs abs(sw->width - sourcewidth) < tol)
axlHighlightObject(l_swidth)
axlFlushDisplay()
axlUIWPrint(nil "** Selected %n Cline Segments. **" length(l_swidth))
axlUIWPrint(changewidth_Form "Selected %n Segments." length(l_swidth))
)
("newsegwidth" newwidth = changewidth_Form->curValue
)
("done" ;; Change Width
if(newwidth != sourcewidth then
newlist = list()
doagain = nil
LCB_changeWidth()
if(doagain then
axlUIWPrint(nil " -- Trying to change remaining Csegs. --")
axlFormSetField(changewidth_Form "widths" sourcewidth)
axlFormSetField(changewidth_Form "layers" "")
axlFormSetField(changewidth_Form "layers" layername)
LCB_getwidth(layername)
l_swidth = setof(sw layerclinesegs sw->width == sourcewidth)
LCB_changeWidth()
); endif
if(totdrcs != 0 && !doagain then
sprintf(errmsg "\nFinal DRC's are: %n\n" axlDRCGetCount())
axlUIWPrint(nil "--> Final DRC's are: %n" axlDRCGetCount())
axlUIConfirm(errmsg)
else
axlUIWPrint(nil "No DRC's created.")
axlUIWPrint(nil "--> Total DRC's are: %n" axlDRCGetCount())
); endif
l_swidth = nil
axlUIWPrint(nil "- Done -")
axlUIWPrint(changewidth_Form " - Done -")
else
axlUIWPrint(nil "*** Source Segment Width and New Segment Width are the same! Try again.")
axlUIWPrint(changewidth_Form "Source Width & New Width are the same! Try again.")
); end source==new
)
("info" axlUIWPrint(changewidth_Form "Info Button")
cwidth_info_createInfo()
)
("close"
if(l_swidth then
axlDehighlightObject(l_swidth)
axlFlushDisplay()
); endif
axlCancelEnterFun()
axlFormClose(changewidth_Form)
axlUIWPrint(nil "- Change Width Form closed. -")
); end close
); end case
);end defun
;###########################################################
;# #
;# End of changewidth_Form_Action #
;# #
;###########################################################
;###########################################################
;# #
;# LCB_changeWidth #
;# #
;###########################################################
(defun LCB_changeWidth ()
if(l_swidth && newwidth && sourcewidth then
if(!doagain then
totdrcs = 0
else
doagain = nil
); endif
segcount = length(l_swidth)
axlUIWPrint(nil "** Changing %n Seg Widths, please wait...** " segcount)
axlUIWPrint(changewidth_Form "Changing %n Seg Widths, please wait..." segcount)
;; Go through each segment
foreach(one l_swidth
;axlDBRefreshId(one)
;; Get netname
netname = one->net->name
;; Get startEnd
endpoints = one->startEnd
;; Get layer name to be sure
t_layer = one->layer
;; Get seg width
oldsegwidth = one->width
;; Change width and dehighlight
;; Dbid may be removed
if(t_layer then
axlDehighlightObject(one)
axlFlushDisplay()
;; Remove the existing trace.
; Somehow when creating a new cline seg with axlDBCreateLine
; it creates a single new segment without having to delete the original.
;; Remove the original existing trace anyway.
if(! axlDeleteObject(one) then
axlUIWPrint(nil "** Error. Unable to delete Cline Segment, %L" one)
); endif
;; Add new trace at new width
if(createdline = axlDBCreateLine(endpoints newwidth t_layer netname nil) then
newline = nthelem(1 nthelem(1 createdline))
if(nthelem(2 createdline) then
;; DRC created. Increment counter.
totdrcs++
); endif
newlist = cons(newline newlist)
else
axlUIWPrint(nil "*** Error. Unable to change width from %L to %L on net %s on layer %s." oldsegwidth newwidth netname t_layer)
); endif
else
; Probably deleted a tee and this dbid was removed.
axlUIWPrint(nil " -- DBID removed. Probably due to tee removal. --")
doagain = t
); endif
); end foreach
l_swidth = newlist
;; Trying to reset the popup.
axlFormSetField(changewidth_Form "widths" "")
LCB_formupdate()
else
axlUIWPrint(nil "** Cline Segments not selected, try again. **")
axlUIWPrint(changewidth_Form "** Cline Segments not selected, try again. **")
); endif
); end defun
;###########################################################
;# #
;# End of LCB_changeWidth #
;# #
;###########################################################
;###########################################################
;# #
;# LCB_getwidth #
;# #
;###########################################################
(defun LCB_getwidth (lname)
prog( ()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -