⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autosilkutils.il

📁 skill语言在Cadence平台二次开发中大量使用
💻 IL
📖 第 1 页 / 共 5 页
字号:
;============================================================================
; Copyright Tait Electronics Ltd., 2004. All rights reserved.
;
; Program Name: autosilkUtils.il
;
; Author:	Dave Elder, PCB Design Manager,
;		Tait Electronics, Christchurch, New Zealand
;		dave.elder@tait.co.nz
;
; Tested on:	Allegro v14.2, v15.1, 15.2 (s014+)
;
; Purpose:
;	1/ ASU_start - loads user interface form.
;	2/ ASU_copySilkShapesToAutoSilk
;	   - Copies silk shape objects from Board and Package Geometry layers to AutoSilk.
;	   - Checks silk to pin and via soldermask spacings.
;	3/ ASU_checkSpacings
;	   - Check text and shapes for DRCs over soldermask on pins, vias and shapes.
;
; Usage:	To run the routine within Allegro type: "silkutils".
;
; History:
;
;  1.0	02-Sep-03 DE	Re-created for general release.
;  7.0	11-Feb-04 DE	New general release.
;  7.19	20-Jul-04 DE	ICU 2004 CD Release.
;  7.20	27-Jul-04 DE	Update for 15.2.
;  7.27 04-Aug-04 DE	Added Reference Designator check.
;  8.0	06-Aug-04 DE	Added Move Symbol and Right Button Rotate on both move buttons.
;  8.03 01-Sep-04 DE	Pre-ICU 2004 Release 1
;  8.04 02-Sep-04 DE	Pre-ICU 2004 Release 2
;  8.05 03-Sep-04 DE	Pre-ICU 2004 Release 3
;  8.07 03-Sep-04 DE	ICU 2004 Actual demonstration version
;  8.08 27-Sep-04 DE	Fixed windows cancel button crash problem.
;  8.09	05-Oct-04 DE	Fixed bug with line end identification. Enabled trimming of multi-segment lines and arcs.
;  8.10	14-Dec-04 DE	Updated DRCbrowse_getDRCID for integer DRC dbids.
;  8.11	07-Feb-05 DE	Use cancel instead of Quit to ensure that Windows Close button works.
;  8.12	30-Mar-05 DE	Sourcelink Update Release
;
;============================================================================

axlCmdRegister("silkutils" 'ASU_start ?cmdType "interactive")

defun( ASU_start (@optional (txtSpacing, axlMKSConvert(10, "mils")), shpSpacing, lineSpacing, spacingUnits)
 let((preset, version, release, releaseType, releaseNumber, analyse, unitsList, units, designProperties, formFile
      p, x, y, grpLen, tabLen, y1, form, defaultFilm, nonCuFilms, filmPairs, vias, viaResist)
  preset = boundp('ASU_thisDesign) && ASU_thisDesign == axlCurrentDesign()
  defvar(ASU_version, 8.12)
  defvar(ASU_versionWarning)
  version = axlVersion('version)
  release = axlVersion('release)
  releaseType = lowerCase(substring(release, 1, 1)), releaseNumber = readNumberString(substring(release, 2))
  cond(
    (version == 15.2 && (releaseType != "s" || releaseNumber < 14)
      ASU_versionWarning = "WARNING: Will not fully work on releases prior to s014"
    )
    (version >= 14.2, ASU_versionWarning = "This utility should work for PSD14.2 to SPB15.2")
    (t, ASU_versionWarning = "WARNING: Not been tested for releases prior to 14.2")
  )
  if(preset then
    analyse = axlUIYesNo("Re-Analyse Design?")
   else
    analyse = t
    defvar(ASU_thisDesign, axlCurrentDesign())
    defvar(ASU_checktext, t)
    defvar(ASU_checktextloc, t)
    defvar(ASU_quickChk)
    defvar(ASU_checklines, t)
    defvar(ASU_checkshapes, t)
    defvar(ASU_checkPins, t)
    defvar(ASU_solderedpadsChk)
    defvar(ASU_checkVias, t)
    defvar(ASU_checksmShps, t)
    defvar(ASU_shapescopyCheck, t)
    defvar(ASU_checktop, t)
    defvar(ASU_checkbottom, t)
    defvar(ASU_TOPfilm)
    defvar(ASU_BOTTOMfilm)
    defvar(ASU_AUTOSILK)
    defvar(ASU_SILKSCREEN)
    defvar(ASU_ASSEMBLY)
    defvar(ASU_autosilkChkClasses, '("ASU_AUTOSILK", ("MANUFACTURING", t)))
    defvar(ASU_silkChkClasses
      '("ASU_SILKSCREEN", ("BOARD GEOMETRY", t), ("PACKAGE GEOMETRY", t), ("COMP VALUE", t), ("DEV TYPE", t), ("REF DES", t), ("TOLERANCE", t), ("USER PART", t))
    )
    defvar(ASU_assyChkClasses
      '("ASU_ASSEMBLY", ("BOARD GEOMETRY", t), ("PACKAGE GEOMETRY", t), ("COMP VALUE", nil), ("DEV TYPE", nil), ("REF DES", t), ("TOLERANCE", nil), ("USER PART", nil))
    )
    defvar(ASU_subclasses, '("silkscreenlayer", "autosilklayer", "assemblylayer"))
    defvar(ASU_chkSubclass)
    defvar(ASU_soldermaskClasses, '("BOARD GEOMETRY", "PACKAGE GEOMETRY", "PIN", "VIA CLASS"))
    defvar(ASU_userClass)
    defvar(ASU_userSubclass)
    defvar(ASU_drcMsgs)
  )
  when(analyse
    defvar(ASU_allChkClasses, '("MANUFACTURING")); Required to enable check box if user copies shapes to this Autosilk layer
    ASU_allChkClasses = ASU_analyseDesign(ASU_allChkClasses, ASU_autosilkChkClasses, ASU_silkChkClasses, ASU_assyChkClasses)
  )
  unless(preset, defvar(ASU_tickedClasses, ASU_allChkClasses))
  unitsList = AFn_getDesignUnits()
  units = car(unitsList)
  defvar(ASU_designUnits, units)
  defvar(ASU_precision, cadr(unitsList))
  when(stringp(txtSpacing), txtSpacing = atof(txtSpacing))
  when(stringp(shpSpacing), shpSpacing = atof(shpSpacing))
  when(stringp(lineSpacing), lineSpacing = atof(lineSpacing))
  when(spacingUnits; Required when parsing values from a menu as they are strings.
    txtSpacing = axlMKSConvert(txtSpacing, spacingUnits, units)
    shpSpacing = axlMKSConvert(shpSpacing, spacingUnits, units)
    lineSpacing = axlMKSConvert(lineSpacing, spacingUnits, units)
  )
  axlDBRefreshId(nil)
  designProperties = axlDBGetDesign() ->prop
  txtSpacing = designProperties ->ASU_TXTSPACING || txtSpacing
  shpSpacing = designProperties ->ASU_SHPSPACING || shpSpacing
  lineSpacing = designProperties ->ASU_LINESPACING || lineSpacing
  when(stringp(txtSpacing), txtSpacing = atof(txtSpacing))
  when(stringp(shpSpacing), shpSpacing = atof(shpSpacing))
  when(stringp(lineSpacing), lineSpacing = atof(lineSpacing))
  unless(shpSpacing, shpSpacing = txtSpacing)
  unless(lineSpacing, lineSpacing = shpSpacing)

  grpLen = 3 + max(length(ASU_allChkClasses), length(ASU_subclasses), 2) * 2
  tabLen = 29 + grpLen
  x = 1, y = 0
  ;formFile = strcat(getWorkingDir(), "/ASU_temp.form")
  formFile = "ASU_temp.form"
  p = outfile(formFile "w")
  AFn_formHeader(p, 43, sprintf(nil, "Soldermask Clearance Check v%2.2f", ASU_version))
  AFn_formPopupDefine(p, "TOPFILMPOP", '("topfilm"))
  AFn_formPopupDefine(p, "BOTTOMFILMPOP", '("bottomfilm"))
  AFn_formPopupDefine(p, "UCLASS")
  AFn_formPopupDefine(p, "USUBCLASS")
  AFn_formMessage(p, "chkProgress", ?level 0, ?msgString "Checking %s %s...")
  AFn_formMessage(p, "drcsFound", ?level 0, ?msgString "%d DRCs found")
  AFn_formMessage(p, "drcsCreated", ?level 0, ?msgString "%d shapes copied. %d DRCs created")
  AFn_formMessage(p, "shpsCopied", ?level 0, ?msgString "%d shapes copied. No checks performed")
  AFn_formText(p, ASU_versionWarning, x + 1, y ?label "versionwarning"), y = y + 2
  AFn_formThumbnail(p, "taitlogo", x + 37, 0, 5, 3)
  AFn_formTabSetDispatch(p, x, y, 42, tabLen)
  AFn_formTab(p, "Setup"), y = 0
  AFn_formGroup(p, "Spacing Constraints", x, y, 39, 14)
  y = y + 2, AFn_formChecklistItem(p, "text", x + 2, y, "Text Spacing")
  AFn_formRealFillin(p, "txtspc", 6, 6, x + 19, y, ?value txtSpacing, ?decimalPlaces ASU_precision, ?minVal 0, ?units units)
  AFn_formButton(p, "txtspcHelp", "?", x + 33, y, 3, 3)
  y = y + 2, AFn_formChecklistItem(p, "quickchk", x + 6, y, "Faster Text Check")
  AFn_formButton(p, "quickchkHelp", "?", x + 33, y, 3, 3)
  y = y + 2, AFn_formChecklistItem(p, "shapes", x + 2, y, "Shape Spacing")
  AFn_formRealFillin(p, "shpspc", 6, 6, x + 19, y, ?value shpSpacing, ?decimalPlaces ASU_precision, ?minVal 0, ?units units)
  AFn_formButton(p, "shpspcHelp", "?", x + 33, y, 3, 3)
  y = y + 2, AFn_formChecklistItem(p, "lines", x + 2, y, "Line Spacing")
  AFn_formRealFillin(p, "linespc", 6, 6, x + 19, y, ?value lineSpacing, ?decimalPlaces ASU_precision, ?minVal 0, ?units units)
  AFn_formButton(p, "linespcHelp", "?", x + 33, y, 3, 3)
  
  y = y + 3, AFn_formChecklistItem(p, "textloc", x + 2, y, "Reference Designator Locations")
  AFn_formButton(p, "textlocHelp", "?", x + 33, y, 3, 3)
  
  y = y + 3, AFn_formGroup(p, "Solder Mask Objects to be Checked", x, y, 39, 11)
  y = y + 2, AFn_formChecklistItem(p, "pins", x + 2, y, "Check to Solder Mask Pads on Pads")
  AFn_formButton(p, "pinsHelp", "?", x + 33, y, 3, 3)
  y = y + 2, AFn_formChecklistItem(p, "solderedpads", x + 6, y, "Check to Soldered Pads Only")
  AFn_formButton(p, "solderedpadsHelp", "?", x + 33, y, 3, 3)

  y = y + 2, AFn_formChecklistItem(p, "vias", x + 2, y, "Check to Solder Mask Pads on Vias")
  AFn_formButton(p, "viasHelp", "?", x + 33, y, 3, 3)
  y = y + 2, AFn_formChecklistItem(p, "smShps", x + 2, y, "Check to Solder Mask Shapes")
  AFn_formButton(p, "smShpsHelp", "?", x + 33, y, 3, 3)
  y = y + 3, AFn_formGroup(p, "AutoSilk Layers Shapes Copying", x, y, 39, 7)
  y = y + 2, AFn_formChecklistItem(p, "shapescopyCheck", x + 2, y, "Check Spacings on Objects Selected Above")
  y = y + 2, AFn_formButton(p, "copy", "Copy Geometry Layer Shapes to AutoSilk", x + 2, y, 30, 3)
  AFn_formEndTab(p)
  
  AFn_formTab(p, "Check"), y = 0
  when(axlGetParam("artwork") && (sort(axlGetParam("artwork") ->groupMembers, nil) != '("BOTTOM" "TOP"))
    AFn_formGroup(p, "Use Films", x, y, 38, 9)
    y = y + 2, AFn_formChecklistItem(p, "usefilms", x + 1, y, "Use films to determine checked layers" ?radioLabel "chktype")
    y = y + 2, AFn_formText(p, "Top:", x + 1, y), AFn_formPop(p, "TOPfilm", "TOPFILMPOP", x + 9, y, 20)
    y = y + 2, AFn_formText(p, "Bottom:", x + 1, y), AFn_formPop(p, "BOTTOMfilm", "BOTTOMFILMPOP", x + 9, y, 20)
    y++
  )
  y = y + 2, AFn_formGroup(p, "Use Silk Layers", x, y, 38, grpLen + 5); 4
  y = y + 2
  AFn_formChecklistItem(p, "usesilk", x + 1, y, "Auto suggested layer selection" ?radioLabel "chktype")
  y = y + 1, y1 = y
  AFn_formGroup(p, "Classes", x + 1, y1, 21, 2 + length(ASU_allChkClasses) * 2)
  foreach(chkClass, ASU_allChkClasses, y1 = y1 + 2, AFn_formChecklistItem(p, chkClass, x + 2, y1, axlPPrint(chkClass)))
  AFn_formGroup(p, "Subclasses", x + 23, y, 14, 2 + length(ASU_subclasses) * 2)
  foreach(subclass, ASU_subclasses
    y = y + 2, AFn_formChecklistItem(p, subclass, x + 24, y, axlPPrint(substring(subclass, 1, strlen(subclass) - 5)) ?radioLabel "chklayer")
  )

  y = max(y1, y) + 2
  AFn_formText(p, "Check sides:", x + 2, y)
  AFn_formChecklistItem(p, "checktop", x + 14, y, "Top")
  AFn_formChecklistItem(p, "checkbottom", x + 22, y, "Bottom")
  
  y = y + 3, AFn_formGroup(p, "User selection", x, y, 38, 9)
  y = y + 2, AFn_formChecklistItem(p, "useother", x + 1, y, "Select user layer to check" ?radioLabel "chktype")
  y = y + 2, AFn_formText(p, "Class:", x + 1, y), AFn_formPop(p, "userclass", "UCLASS", x + 9, y, 20)
  y = y + 2, AFn_formText(p, "Subclass:", x + 1, y)
  AFn_formPop(p, "usersubclass", "USUBCLASS", x + 9, y, 20 ?options "ownerdrawn")
  y = y + 4, AFn_formButton(p, "checkWindow", "Check in Window", x + 3, y, 15, 3)
  AFn_formButton(p, "checkAll", "Check All", x + 22, y, 15, 3)
  AFn_formEndTab(p)
  AFn_formEndTabSet(p)
  y = tabLen + 3
  AFn_formButton(p, "viewLog", "View Log", x + 2, y, 9, 3)
  AFn_formButton(p, "cancel", "Quit", x + 15, y, 9, 3)
  AFn_formButton(p, "asuhelp", "Help", x + 28, y, 9, 3)
  AFn_formEnd(p)
  close(p)
  
  defvar(ASU_startForm, axlFormCreate('form, formFile, '(E INNER), 'ASU_formAction, nil))
  axlGRPDrwInit(form, "taitlogo", 'tait_logoThumbnail)
  when(substring(ASU_versionWarning, 1, 7) == "WARNING", axlFormColorize(form, "versionwarning", 'text, 'red))
  axlFormSetField(form, "quickchk", ASU_quickChk)
  axlFormSetField(form, "solderedpads", ASU_solderedpadsChk)
  axlFormSetField(form, "shapescopyCheck", ASU_shapescopyCheck)
  foreach(side, '("TOP", "BOTTOM")
    defaultFilm = nil
    foreach(filmName, axlGetParam("artwork") ->groupMembers
      foreach(layer, axlGetParam(strcat("artwork:", filmName)) ->groupMembers
	and(index(layer, strcat("_", side)), index(layer, "SILK"), defaultFilm = filmName)
      )
    )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -