|
zs_king 发表于 2022-06-20 19:33:18
我有 。修改字号里的字体大小加上居中。 代码里弄得是Assembly层,修改对应名字可以改成Silk。。。
关注公众号 SkillCodeShare ,有更多实用Skill。。
(procedure zs_ChangeAsmRefTextSize()
(prog (vst txts blk1Par textOrientation sym_x sym_y xy)
vst = axlVisibleGet()
axlVisibleDesign(nil)
axlVisibleLayer("REF DES/ASSEMBLY_TOP" t)
axlVisibleLayer("REF DES/ASSEMBLY_BOTTOM" t)
axlSetFindFilter(?enabled list("noall" "text") ?onButtons list("noall" "text"))
txts = axlGetSelSet((axlAddSelectAll))
(when txts
blk1Par = axlGetParam("paramTextBlock:1")
blk1Par->width = axlMKS2UU("10 mils")
blk1Par->height = axlMKS2UU("16 mils")
blk1Par->lineSpace = axlMKS2UU("2 mils")
blk1Par->photoWidth = axlMKS2UU("2 mils")
blk1Par->charSpace = axlMKS2UU("2 mils")
axlSetParam(blk1Par)
setof(p1 txts axlDBCloak('zs_ChangeAsmRefTextSizeOne(p1)))
);end when
axlVisibleSet(vst)
)
);end procedure
;
;
;
(procedure zs_ChangeAsmRefTextSizeOne(text)
(prog (sym_x sym_y txtOffset halfTextHeight textHeight xy textOrientation)
foreach(childid, text->parent->children
when(childid->layer == " ACKAGE GEOMETRY/PLACE_BOUND_TOP" || childid->layer == " ACKAGE GEOMETRY/PLACE_BOUND_BOTTOM"
sym_x = (xCoord(car(childid->bBox)) + xCoord(cadr(childid->bBox))) / 2.0
sym_y = (yCoord(car(childid->bBox)) + yCoord(cadr(childid->bBox))) / 2.0
);when childid
);end foreach childid
textHeight = axlGetParam("paramTextBlock:1")->height
txtOffset = if(car(parseString(text->layer, "/")) == "COMPONENT VALUE" then textHeight * 1.3 else 0)
halfTextHeight = textHeight / 2.0
case(text->rotation
(0.0, sym_y = sym_y - halfTextHeight - txtOffset)
(90.0, sym_x = sym_x + halfTextHeight + txtOffset)
(180.0, sym_y = sym_y + halfTextHeight + txtOffset)
(270.0, sym_x = sym_x - halfTextHeight - txtOffset)
)
xy = list(sym_x, sym_y)
textOrientation = make_axlTextOrientation(?textBlock 1, ?rotation text->rotation, ?mirrored text ->isMirrored, ?justify "CENTER")
if(axlDBCreateText(text->text, xy, textOrientation, text->layer, text->parent)
then axlDeleteObject(text)
else axlMsgPut(strcat("Update Failed on ", text))
)
)
);end procedure
感谢分享
|
“来自电巢APP”
|