TA的每日心情 | 慵懒 2019-11-18 15:01 |
---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
請大佬幫忙除錯
*WARNING* (reader): a '(' at line 2 was still unclosed on EOF, ')' added
at line 69
*WARNING* (reader): a '(' at line 1 was still unclosed on EOF, ')' added
at line 69
procedure()
let((texts sym p uFc symBBox assemblyHeight)
;; Get unit conversion factor
if(car(axlDBGetDesignUnits()) == "mils" then
uFc = 1
else
uFc = 25.4 / 1000
)
;; Set visible layers
axlVisibleDesign(nil)
axlVisibleLayer("Ref Des/DISPLAY_Top" t)
axlVisibleLayer("Ref Des/DISPLAY_Bottom" t)
axlVisibleLayer("PACKAGE GEOMETRY/ASSEMBLY_TOP" t)
axlVisibleLayer("PACKAGE GEOMETRY/ASSEMBLY_BOTTOM" t)
axlVisibleUpdate(nil)
;; Select all reference designator texts
axlClearSelSet()
axlSetFindFilter(?enabled `("noall" "text") ?onButtons `("noall" "text"))
axlAddSelectAll()
;; Process each selected text
foreach(texts axlGetSelSet()
sym = texts->parent
when(sym && texts->text == sym->component->name
;; Get ASSEMBLY layer bounding box
symBBox = axlPolyFromDB(sym ?layer strcat("PACKAGE GEOMETRY/ASSEMBLY_" sym->side) ?noFill t ?union t)
when(symBBox
;; Calculate ASSEMBLY layer height and set text size to 70%
assemblyHeight = yCoord(cadr(symBBox)) - yCoord(car(symBBox))
p = axlGetParam("paramTextBlock:13")
p->width = assemblyHeight * 0.7 * 0.6 ;; 70% height with 0.6 aspect ratio
p->height = assemblyHeight * 0.7 ;; 70% of height
p->lineSpace = 0.0 * uFc
p->charSpace = 0.0 * uFc
p->photoWidth = max(1.0 * uFc, assemblyHeight * 0.7 * 0.05) ;; min 1mil
axlSetParam(p)
;; Modify text properties
axlDBChangeText(texts nil 13)
;; Rotate text to match component
axlTransformObject(texts ?angle sym->rotation - texts->rotation)
;; Handle upside-down text
when(texts->rotation >= 90 && texts->rotation < 270
axlTransformObject(texts ?angle 180)
)
;; Position text at ASSEMBLY layer center
let((assemblyCenter)
assemblyCenter = list(
(xCoord(car(symBBox)) + (xCoord(cadr(symBBox)) - xCoord(car(symBBox)))/2,
(yCoord(car(symBBox)) + (yCoord(cadr(symBBox)) - yCoord(car(symBBox)))/2
)
axlTransformObject(texts ?move axlMXYSub(assemblyCenter axlDBAltOrigin('center texts)))
) ;; End of inner let
) ;; End of when symBBox
) ;; End of when sym && texts->text
) ;; End of foreach
axlClearSelSet()
axlVisibleUpdate(t) ;; Final screen update
) ;; End of let
) ;; End of procedure
printf("mcenter command loaded. Use 'mcenter' to center reference designators (based on ASSEMBLY layer)\n")
|
|