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

📄 ch_text_overlap.il

📁 Allegro常用skill
💻 IL
📖 第 1 页 / 共 2 页
字号:
    if(refdes_component then
        allselcom = nil
    	cnt = 0
	axlSetFindFilter(?enabled '(noall shapes) ?onButtons '(noall shapes))

    	foreach(txt alltexts refdes_overlap_component(txt))
        axlHighlightObject( allselcom)     
    	axlMsgPut("Total of refdes on %s component : %d" layer cnt)
    )
    if(barcode_overlap then      
    	axlSetFindFilter(?enabled '(noall pins vias text) ?onButtons '(noall pins vias text ))

        allselcom = nil
    	cnt = 0
    	foreach(txt alltexts  	; i=0 j=0 k=0 n=0 ++i txt = nthelem(i alltexts)
	   if(txt->text == "BAR  CODE" then 
	   	barcode_overlap_atom(txt)
	   )
    	)
        axlHighlightObject( allselcom)     
    	axlMsgPut("Bar code overlaps other item.")
    	
    	Going_On=axlGetParam("paramLayerGroup:PACKAGE GEOMETRY/paramLayer:SILKSCREEN_TOP")

    	Going_On->visible=nil

    	axlSetParam(Going_On)  	
    	Going_On=axlGetParam("paramLayerGroup:PACKAGE GEOMETRY/paramLayer:SILKSCREEN_BOTTOM")

    	Going_On->visible=nil

    	axlSetParam(Going_On)  	
    	Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:SILKSCREEN_%s" layer))

    	Going_On->visible=t

    	axlSetParam(Going_On)   
    
    	axlUIWRedraw(nil)
    	axlClearSelSet()
   
    )
) 

(defun barcode_overlap_atom (txt)
(prog ()

    bars = txt->parent->name
    barx = txt->parent->name
    if(txt->layer == strcat( "PACKAGE GEOMETRY/SILKSCREEN_" layer) 
    || (txt->layer != strcat( "PACKAGE GEOMETRY/SILKSCREEN_" layer) 
    && index(barx "X") == "X") then
	if(axlSingleSelectBox(get_bar_code_box(txt)) != nil then
	    allboxes = axlGetSelSet() 
	    axlClearSelSet()
	    have = nil
	    foreach(item allboxes ;++k item = nthelem(k allboxes)
	        if(txt->text != item->text && (item->objType != "via" 
	        || item->testPoint != nil)  then
	            allselcom = cons(item allselcom)
	       	    allselcom = cons(txt->parent allselcom)
		    have = t
		)
	    )
	    if(have then ++cnt add_loc_text(txt))
	)    
    )
))

(defun refdes_overlap_component ( txt)
(prog ()
let( (item allbox)

    if(txt->layer == strcat( "REF DES/SILKSCREEN_" layer) then 
	if(axlSingleSelectBox(getbox(txt)) != nil then
	    allboxes = axlGetSelSet() 
	    axlClearSelSet()
	    have = nil
	    foreach(item allboxes ;++k item = nthelem(k allboxes)
	        if(item->objType == "shape" && 
	        item->layer == strcat( "PACKAGE GEOMETRY/PLACE_BOUND_" layer) then
	            allselcom = cons(item allselcom)
	       	    allselcom = cons(txt allselcom)
	       	    have = t
		)
	    )
	    if(have then ++cnt add_loc_text(txt))
	)	    
    )					
)))

(defun text_overlap_text ( txt)
(prog ()
let( (item allbox)
	
	if(txt->layer == strcat( "REF DES/SILKSCREEN_" layer) 
	|| txt->layer == strcat( "PACKAGE GEOMETRY/SILKSCREEN_" layer) then 	    
	    if(axlSingleSelectBox(getbox(txt)) != nil then
	    	allboxes = axlGetSelSet() 
		axlClearSelSet()
		allbox = nil
		foreach(item allboxes	;++n item = nthelem(n allboxes)
		    if(item->text != txt->text then
		        allbox = cons(item allbox)
		    )		    
		)
		have = nil
	    	foreach(item allbox ;++k item = nthelem(k allbox)
		    if(item->objType == "text" then
		        if(text_on_text(txt item) != nil then 
		        allseltext = cons(item allseltext)
		    	allseltext = cons(txt allseltext)
		    	have = t
		        )
		    )
		)
		if(have then ++cnt add_loc_text(txt))
	    )	    
	)					
)))

(defun text_on_pad (txt)
(prog ()
let( (item allbox)
	
    	if(txt->layer == strcat( "REF DES/SILKSCREEN_" layer) 
    	|| txt->layer == strcat( "PACKAGE GEOMETRY/SILKSCREEN_" layer) then 	    
	    if(axlSingleSelectBox(getbox(txt)) != nil then
	    	allboxes = axlGetSelSet() 
		axlClearSelSet()
		allbox = nil
		foreach(item allboxes	;++n item = nthelem(n allboxes)
		    if(item->text != txt->text then
		        allbox = cons(item allbox)
		    )		    
		)
		have = nil
	    	foreach(item allbox ;++k item = nthelem(k allbox)
		    if(item->objType == "pin" then
			;allselpad = cons(txt allselpad)
			axlHighlightObject(list(txt item))
			have = t
		    )
		)
		if(have then ++cnt add_loc_text(txt))
	    )	    
	)					
)))

(defun text_on_testpoints (txt)
(prog ()
let( (item allbox)
	
    	if(txt->layer == strcat( "REF DES/SILKSCREEN_" layer) 
    	|| txt->layer == strcat( "PACKAGE GEOMETRY/SILKSCREEN_" layer) then 	    
	    if(axlSingleSelectBox(getbox(txt)) != nil then
	    	allboxes = axlGetSelSet() 
		axlClearSelSet()
		allselvia = nil
		have = nil
	    	foreach(item allboxes ;++k item = nthelem(k allbox)
		    if(layer == "BOTTOM" && item->objType == "via" && item->testPoint != nil then 
			allselvia = cons(txt allselvia)
		        axlHighlightObject(list(item txt))
		        have = t
		    )		    
		)
		if(have then ++cnt add_loc_text(txt))
	    )	    
	)					
)))

(defun get_bar_code_box (txt)
(prog ()
    if(txt->text == "BAR  CODE"  then  
    	box = txt->parent->bBox	
    	bleft   = car( nth(0 box)) - clearance
    	btop    = cadr(nth(1 box)) + clearance	
    	bright  = car( nth(1 box)) + clearance
    	bbottom = cadr(nth(0 box)) - clearance    
    	return(list(bleft:btop bright:bbottom)) 
    )
    return(nil)
))

(defun getbox (txt)
(prog ()
    loff = 3 toff = 0 roff = -4 boff = 16
    left = car(nth(0 txt->bBox)) - clearance
    top = cadr(nth(1 txt->bBox)) + clearance	
    right = car(nth(1 txt->bBox)) + clearance
    bottom = cadr(nth(0 txt->bBox)) - clearance
;    boff = round((top - bottom)/5)+3
    if(layer == "TOP" then
    	case(round(txt->rotation)
    	    (0
    	    	boff = round(abs(top - bottom)/5)+3
    	     	left = left + loff 	top = top + toff 	
    	    	right = right + roff  	bottom = bottom + boff
    	  	t 
    	    )
    	    (90
    	    	boff = round(abs(right - left)/5)+3
    	     	left = left - toff 	top = top + roff 	
    	    	right = right - boff  	bottom = bottom + loff
    	  	t 
    	    )
    	    (180
    	    	boff = round(abs(top - bottom)/5)+3
    	     	left = left - roff 	top = top - boff 	
    	    	right = right - loff  	bottom = bottom - toff
    	  	t 
    	    )
    	    (270
    	    	boff = round(abs(right - left)/5)+3
    	     	left = left + boff 	top = top - loff 	
    	    	right = right + toff  	bottom = bottom - roff
    	  	t 
    	    )
    	)
    )	    
    if(layer == "BOTTOM" then
    	case(round(txt->rotation)
    	    (0
    	    	boff = round(abs(top - bottom)/5)+3
    	     	left = left - roff 	top = top + toff 	
    	    	right = right - loff  	bottom = bottom + boff
    	  	t 
    	    )
    	    (90
    	    	boff = round(abs(right - left)/5)+3
    	     	left = left - toff 	top = top - loff 	
    	    	right = right - boff  	bottom = bottom - roff
    	  	t 
    	    )
    	    (180
    	    	boff = round(abs(top - bottom)/5)+3
    	     	left = left + loff 	top = top - boff 	
    	    	right = right + roff  	bottom = bottom - toff
    	  	t 
    	    )
    	    (270
    	    	boff = round(abs(right - left)/5)+3
    	     	left = left + boff 	top = top + roff 	
    	    	right = right + toff  	bottom = bottom + loff
    	  	t 
    	    )	    	    
    	);case	    
    )
    return(list(left:top right:bottom))		   
))     

(defun text_on_text (text item)
(prog ()
(let (tt1 tt2 left top right bottom lt tp rt bm )

    tt2 = getbox(item)
    lt  = car(nth(0 tt2))
    tp  = cadr(nth(0 tt2))	
    rt  = car(nth(1 tt2))
    bm  = cadr(nth(1 tt2))
    
    tt1    = getbox(text)
    left   = car(nth(0 tt1))
    top    = cadr(nth(0 tt1))	
    right  = car(nth(1 tt1))
    bottom = cadr(nth(1 tt1))
    
    if(lt>=left && lt<=right && tp<=top && tp>=bottom return(t) )
    if(lt>=left && lt<=right && bm<=top && bm>=bottom return(t) )
    if(rt>=left && rt<=right && bm<=top && bm>=bottom return(t) )
    if(rt>=left && rt<=right && tp<=top && tp>=bottom return(t) )
	
    return(nil)    
)))

(defun unselect_object ()
(let (allsel)
    axlSetFindFilter(?enabled '(noall shapes pins vias text) ?onButtons '(noall shapes pins vias text))

   ; axlSetFindFilter(?enabled '(all) ?onButtons '(all))

    allsel = axlGetSelSet(axlAddSelectAll())

    axlClearSelSet()

    axlSetFindFilter(?enabled '(noall symbols) ?onButtons '(noall symbols))

    allsel = axlGetSelSet(axlAddSelectAll())

    axlClearSelSet()

))

(defun turn_on_layer ( layer)
    axlVisibleDesign(nil)
    	
    Going_On=axlGetParam("paramLayerGroup:BOARD GEOMETRY/paramLayer:OUTLINE")

    Going_On->visible=t

    axlSetParam(Going_On)


    Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:VIA CLASS/paramLayer:%s" layer))

    if(layer == "BOTTOM" then
    	Going_On->visible=t

    else
    	Going_On->visible=nil
    )    
    axlSetParam(Going_On)
   

    Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:PIN/paramLayer:%s" layer))

    Going_On->visible=t

    axlSetParam(Going_On)
    
    Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:SILKSCREEN_%s" layer))

    Going_On->visible=t

    axlSetParam(Going_On)  	
    Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:REF DES/paramLayer:SILKSCREEN_%s" layer))

    Going_On->visible=t

    axlSetParam(Going_On)


    Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:PLACE_BOUND_%s" layer))

    Going_On->visible = refdes_component
    axlSetParam(Going_On)
    	    
   
    axlUIWRedraw(nil)
    axlClearSelSet()

)

(defun init_loc_text ()
    location = makeTable("loc" 0)
    num = 0    
)

(defun add_loc_text (item)  	
    if(item != nil then		;i = 0 i++ item = nthelem(i alltexts)
    	++num    	  
    	x = nthelem(1 item->xy) 
    	y = nthelem(2 item->xy)
    	location[num] = sprintf(dummy "%s,%f,%f" item->text x y)
    )
)

(defun location_text ( location)
    viewx = 400
    viewy = 300

    if(tablep(location) == t && length(location) > 0 then 
    	if(num < length(location) then 
    	    ++num 
    	else 
    	    num = 1
    	)    	     
        lst = parseString(location[num] ",")
    	refdes = sprintf(dummy " %d/%d : %s" num length(location) nthelem(1 lst))
    	x = atoi(nthelem(2 lst))
    	y = atoi(nthelem(3 lst))
    	;Display the refdes on the interface.
    	axlFormSetField(form "next_view" refdes)
	axlWindowBoxSet(list(x-viewx:y-viewy x+viewx:y+viewy))
    )
)
(defun location_prv ( location)
    viewx = 400
    viewy = 300

    if(tablep(location) == t && length(location) > 0 then 
    	if(num > 1 then 
    	   --num 
    	else 
    	   num = length(location)
    	)    	     
        lst = parseString(location[num] ",")
    	refdes = sprintf(dummy " %d/%d : %s" num length(location) nthelem(1 lst))
    	x = atoi(nthelem(2 lst))
    	y = atoi(nthelem(3 lst))
    	;Display the refdes on the interface.
    	axlFormSetField(form "next_view" refdes)
	axlWindowBoxSet(list(x-viewx:y-viewy x+viewx:y+viewy))
    )
)

⌨️ 快捷键说明

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