|
本帖最后由 yneda 于 2013-12-3 10:19 编辑
版主你好,关于text to line的问题,我找到了一个用宏来实现的方法,但是调试时有一个问题,解决不了,麻烦你有时间帮忙看看,谢谢了,正好这几天没项目,一直在纠结这个问题。
;下面是代码,主要功能是把refdes 转换成Line,最终要得到 list(dibd_refdes list(line_segs)),但没完全写完,因为转换的时候就出错了。
alist = list(dibd_refdes1 dibd_refdes2)
TestMain(alist)
procedure(TestMain(o_dbidText)
let((p tmpDbidText )
p = axlVisibleGet()
axlVisibleDesign(nil)
axlVisibleLayer("MANUFACTURING/DETAILS" t)
foreach(item o_dbidText
tmpDbidText = fnText2Text(item "MANUFACTURING/DETAILS") ;在新层里copy一个text,这样在bBox框选Text to Line的时候,防止多选。
fnText2Line(tmpDbidText "DETAILS");把新创建的text,在同层转换成Line
axlDeleteObject(tmpDbidText );删除刚创建的临时Text
);end foreach
axlVisibleSet(p)
axlShell("redraw")
t
);end let
);end procedure
procedure(fnText2Text(dbid_Text t_layer)
let((myorient ret text xy block rotation isMirrored justify)
text = dbid_Text->text
xy = dbid_Text->xy
block = dbid_Text->textBlock
rotation = dbid_Text->rotation
isMirrored = dbid_Text->isMirrored
justify = dbid_Text->justify
myorient = make_axlTextOrientation(?textBlock text, ?rotation rotation, ?mirrored isMirrored, ?justify justify)
ret = caar(axlDBCreateText(text, xy, myorient, t_layer, nil))
);end let
);end procedure
procedure(fnText2Line(dbid_Text t_sublayer)
let((x1 y1 x2 y2 row1 row2 row3 row4 row5 row6 row7 row8 row9 row10 row11)
x1 = caar(dbid_Text->bBox)
y1 = cadar(dbid_Text->bBox)
x2 = caadr(dbid_Text->bBox)
y2 = cadadr(dbid_Text->bBox)
row1 = "create detail; "
row2 = sprintf(nil "FORM mini subclass %s; " t_sublayer)
row3 = "FORM mini scale_factor 1.00; "
row4 = "FORM mini filled_pads YES; "
row5 = "FORM find all_off; "
row6 = "FORM find text YES; "
row7 = sprintf(nil "pick %L %L; " x1 y1)
row8 = sprintf(nil "pick %L %L; " x2 y2)
row9 = sprintf(nil "pick %L %L; " x1 y1)
row10 = sprintf(nil "prepopup %L %L; " x1 y1)
row11 ="Done"
axlShell(strcat(row1 row2 row3 row4 row5 row6 row7 row8 row9 row10 row11))
t
);end let
);end procedure
;调试的结果是,第一次循环到dibd_refdes1没问题,但到了dibd_refdes2的时候,提示axlDBCreateText这个函数运行错误,text = nil,所只转换了一个,不知道错在那里,或者有没有其它方法来转换,求指点,谢谢!
|
|