📄 rename_ref_des.il
字号:
; Set the pop up and the tracking form field
; ##########################################
axlUIPopupSet(Rename_Popup)
axlFormSetField(Rename_Tracking_Form "Next_Number_Field" New_Name)
; Select the ref des to rename
; ############################
axlSetFindFilter(?enabled '(noall text) ?onButtons '(noall text))
Text=car(axlGetSelSet(axlSingleSelectPoint())); This variable represent the ref des to be renamed
; Check if Reset, Done, or Oops were pushed
; #########################################
if(Oops_On == nil then
if(Finished == nil then
; Check if any text was selected
; ##############################
if(Text != nil then
; Add to the tally lists
; #####################
Oops_List=cons(Text->text Oops_List)
New_Name_List=cons(New_Name New_Name_List)
Next_Number=Next_Number+1
X_Y_Loc_List=cons(Text->xy X_Y_Loc_List)
; Determine where the ref des actually is located
; ###############################################
X_Loc=car(car(X_Y_Loc_List))
Y_Loc=car(cdr(car(X_Y_Loc_List)))
; Dehighlight the selected component, write and replay the script
; ###############################################################
axlDehighlightObject(Text->parent)
Script_File=outfile("./Rename_Ref_Des.scr" "w")
fprintf(Script_File "setwindow pcb\ntext edit\n")
fprintf(Script_File "pick %f %f\ntext %s\n" X_Loc Y_Loc New_Name)
fprintf(Script_File "done\n")
close(Script_File)
axlShell("replay ./Rename_Ref_Des.scr")
shell("rm ./Rename_Ref_Des.scr")
; Check if you got them all
; #########################
if((Next_Number-Start_Number)+1 == Last_Number then
Reset_Rename_Prefix_Routine()
); end if (Next_Number-Start_Number)+1 == Last_Number
; Increment the new ref des and update the tracking form
; ######################################################
New_Name=sprintf(dummy "%s%d" upperCase(New_Prefix) Next_Number)
axlFormSetField(Rename_Tracking_Form "Next_Number_Field" New_Name)
); end if Text != nil
else; if Finished == nil
axlUIPopupSet(nil)
); end if Finished == nil
else; if Oops_On == nil
; Check if there is anything to Oops
; ##################################
if(Oops_List==nil then
axlUIConfirm("Nothing to Oops")
Finished=nil
Oops_On=nil
else; if Oops_List==nil
; Get the component at the top of Oops list
; #########################################
axlClearSelSet()
axlCancelEnterFun()
axlSetFindFilter(?enabled '(noall symbols) ?onButtons '(noall symbols))
Oppsed_Component=car(axlGetSelSet(axlSingleSelectName("SYMBOL" car(New_Name_List))))
axlClearSelSet()
; If it is a matching prefix component re-highlight it
; ####################################################
if(car(Oops_List)&& rexMatchp(Pattern car(Oops_List)) then
axlHighlightObject(Oppsed_Component)
); end if car(Oops_List)&& rexMatchp(Pattern car(Oops_List))
; Determine where the Oops'd ref des was actually located
; #######################################################
X_Loc=car(car(X_Y_Loc_List))
Y_Loc=car(cdr(car(X_Y_Loc_List)))
; Write and replay the rename script
; ##################################
Script_File=outfile("./Rename_Ref_Des.scr" "w")
fprintf(Script_File "setwindow pcb\ntext edit\n")
fprintf(Script_File "pick %f %f\ntext %s\n" X_Loc Y_Loc car(Oops_List))
fprintf(Script_File "done\n")
close(Script_File)
axlShell("replay ./Rename_Ref_Des.scr")
shell("rm ./Rename_Ref_Des.scr")
; Update the tally lists
; ######################
Oops_List=cdr(Oops_List)
X_Y_Loc_List=cdr(X_Y_Loc_List)
New_Name=car(New_Name_List)
Next_Number=Next_Number-1
New_Name_List=cdr(New_Name_List)
; Reset the Oops_on and Finished variables
; ########################################
Oops_On=nil
Finished=nil
); end if Oops_List == nil
); end if Oops_On==nil
); end while Finished=nil
);end Interactive_Rename_Routine
; Define the rename tracking form
; ###############################
defun(Rename_Tracking_Form_Routine ()
Rename_Tracking_Form=outfile("./Rename_Tracking_Form.form" "w")
fprintf(Rename_Tracking_Form "FILE_TYPE=FORM_DEFN VERSION=2\n")
fprintf(Rename_Tracking_Form "FORM\n")
fprintf(Rename_Tracking_Form "FIXED\n")
fprintf(Rename_Tracking_Form "HEADER \"Tracking\"\n")
fprintf(Rename_Tracking_Form "PORT 17 3\n")
fprintf(Rename_Tracking_Form "TILE\n")
fprintf(Rename_Tracking_Form "TEXT \"Next Number\"\n")
fprintf(Rename_Tracking_Form "TLOC 3 1\n")
fprintf(Rename_Tracking_Form "ENDTEXT\n")
fprintf(Rename_Tracking_Form "FIELD Next_Number_Field\n")
fprintf(Rename_Tracking_Form "FLOC 1 3\n")
fprintf(Rename_Tracking_Form "STRFILLIN 12 30\n")
fprintf(Rename_Tracking_Form "ENDFIELD\n")
fprintf(Rename_Tracking_Form "ENDTILE\n")
fprintf(Rename_Tracking_Form "ENDFORM\n")
close(Rename_Tracking_Form)
); end defun Rename_Tracking_Form
; Define "Reset" for the popup
; ############################
defun(Reset_Rename_Prefix_Routine ()
; Stop the select function
; ########################
Finished=t
axlClearSelSet()
axlCancelEnterFun()
; De-highlight any components still highlighted
; #############################################
axlSetFindFilter(?enabled '(noall symbols) ?onButtons '(noall symbols))
Component_List=axlGetSelSet(axlAddSelectName("SYMBOL" sprintf(dummy "%s*" Match_Prefix)))
axlClearSelSet()
axlDehighlightObject(Component_List)
; Update the tally lists
; ######################
Oops_List=nil
New_Name_List=nil
X_Y_Loc_List=nil
Start_Number=Next_Number
; Close the tracking form
; #######################
axlFormClose(Rename_Tracking_Form)
shell("rm ./Rename_Tracking_Form.form")
Form=axlFormCreate( (gensym) "Rename_Ref_Des_Form.form" '(e inner) 'Rename_Form_Action t)
; Display the rename form and set the fields
; ##########################################
axlFormDisplay(Form)
axlFormSetField(Form "Match_Prefix_Field" upperCase(Match_Prefix))
axlFormSetField(Form "New_Prefix_Field" upperCase(New_Prefix))
axlFormSetField(Form "Start_Number_field" Start_Number)
axlShell("redisplay")
); defun end Reset_Rename_Prefix_Routine
; Define "Oops" for the popup
; ###########################
defun(Rename_Oops_Routine ()
; Stop the select function
; ########################
axlCancelEnterFun()
Finished=t
; Let the rename routine know you want to Oops
; ############################################
Oops_On=t
); end defun Rename_Oops_Routine
; Define "Done" for the popup
; ###########################
defun(Rename_Done_Routine ()
; Stop the select function
; ########################
Finished=t
axlCancelEnterFun()
; De-highlight any components still highlighted
; #############################################
axlClearSelSet()
axlSetFindFilter(?enabled '(noall symbols) ?onButtons '(noall symbols))
Component_List=axlGetSelSet(axlAddSelectName("SYMBOL" sprintf(dummy "%s*" Match_Prefix)))
axlClearSelSet()
axlDehighlightObject(Component_List)
; Update the tally lists
; ######################
Oops_List=nil
New_Name_List=nil
X_Y_Loc_List=nil
; Close the tracking form
; #######################
axlFormClose(Rename_Tracking_Form)
shell("rm ./Rename_Tracking_Form.form")
shell("rm ./Rename_Ref_Des_Form.form")
axlShell("redisplay")
); end defun Rename_Done_Routine
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -