[源代码}-sym的place_bound_top中心创建ref
;PACKAGE GEOMETRY/DISPLAY_TOP层sym的place_bound_top中心创建ref(defun assembly ()
; converts to current database units
; ----------------------------------
min_width = axlMKSConvert(129 "MILS")
text_offset = axlMKSConvert(18 "MILS")
; creates table
; -------------
reftable = makeTable("retfable" nil)
; defines text blocks
; -------------------
rotate_no = make_axlTextOrientation(
?textBlock "2", ?rotation 0.,
?mirrored nil, ?justify "center")
rotate_yes = make_axlTextOrientation(
?textBlock "2", ?rotation 270.,
?mirrored nil, ?justify "center")
; deletes text on package geometry/display_top
; --------------------------------------------
drain()
axlClearSelSet()
vis_list = axlVisibleGet()
axlVisibleDesign(nil)
axlVisibleLayer("PACKAGE GEOMETRY/DISPLAY_TOP" t)
axlSetFindFilter(?enabled list("noall" "text")
?onButtons list("noall" "text"))
axlAddSelectAll()
axlDeleteObject(axlGetSelSet())
; selects symbols
; ---------------
axlClearSelSet()
axlVisibleDesign(nil)
axlVisibleLayer("PACKAGE GEOMETRY/ASSEMBLY_TOP" t)
axlSetFindFilter(?enabled list("noall" "symbols")
?onButtons list("noall" "symbols"))
axlAddSelectAll()
axlVisibleSet(vis_list)
symbol_db_list = axlGetSelSet()
axlClearSelSet()
foreach(symbol_db symbol_db_list
refdes = symbol_db->refdes
mir = symbol_db->isMirrored
; checks if symbol is mirrored
; ----------------------------
if( eq(mir nil) then
children_db_list = symbol_db->children
; checks if symbol has attached shapes
; ------------------------------------
if( neq(children_db_list nil) then
foreach(children_db children_db_list
isShape = children_db->objType
shape_layer = children_db->layer
if( equal(isShape "shape") then
; checks if shape is on package geometry/place_bound_top
; ------------------------------------------------------
if( equal(shape_layer "PACKAGE GEOMETRY/PLACE_BOUND_TOP") then
boundary = children_db->bBox
ref_exists = reftable
; checks if shape already exists for refdes
; -----------------------------------------
if( equal(ref_exists nil) then
; adds refdes/boundary box to table
; ---------------------------------
reftable = boundary
else
; calculates maximum size box
; ----------------------------
old_boundary = reftable
old_llx = caar(old_boundary)
old_urx = caadr(old_boundary)
old_ury = cadadr(old_boundary)
old_lly = cadar(old_boundary)
boundary = children_db->bBox
llx = caar(boundary)
urx = caadr(boundary)
ury = cadadr(boundary)
lly = cadar(boundary)
llx = min(llx old_llx)
urx = max(urx old_urx)
ury = max(ury old_ury)
lly = min(lly old_lly)
boundary = list(llx:lly urx:ury)
reftable = boundary
) ; end of if ref exists
) ; end of package geometry
) ; end of is shape
) ; end of foreach
) ; end of if children
) ; end or if mir
) ; end of foreach symbol_db
; reads each refdes/boundary box pair
; -----------------------------------
foreach( refdes reftable
if( neq(refdes nil) then
boundary = reftable
llx = caar(boundary)
urx = caadr(boundary)
ury = cadadr(boundary)
lly = cadar(boundary)
width = urx-llx
refpos_x = (width/2)+llx
height = ury-lly
refpos_y = (height/2)+lly
; if width > 129 mils text is at 0 degrees
; ----------------------------------------
if((width > min_width) then
refpos_y = refpos_y - text_offset
refpos = refpos_x:refpos_y
axlDBCreateText(refdes , refpos , rotate_no ,
"package geometry/display_top" )
else
; if width <= 129 mils text is at 270 degrees
; -------------------------------------------
refpos_x = refpos_x - text_offset
refpos = refpos_x:refpos_y
axlDBCreateText(refdes , refpos , rotate_yes ,
"package geometry/display_top" ))
) ; end of if
) ;end of foreach
axlVisibleLayer("PACKAGE GEOMETRY/DISPLAY_TOP" t)
) ; end of function assembly
; registers command assembly with Allegro
; ---------------------------------------
axlCmdRegister( "assembly" `assembly)
这个能不能弄说明,意义何在 发电机 发表于 2018-1-18 18:29
这个能不能弄说明,意义何在
学习代码, 楼主 SKILL学的怎么样 哦 原来是这样啊 楼主是高手不 謝謝分享
路过,谢谢!
页:
[1]