EDA365电子工程师网

标题: 如何获得一个零件的坐标,是在TOP还是BOTTOm层,并移动到这个零件? [打印本页]

作者: miatiger    时间: 2010-9-19 22:46
标题: 如何获得一个零件的坐标,是在TOP还是BOTTOm层,并移动到这个零件?
如题,想编写一个skill,输入零件的名称时,能自动定位到这个零件!
作者: oday    时间: 2010-9-20 11:06
你如果想要通过输入零件的名称就能定位到这个零件,Allegro自带的查找功能就有,你要获得一个零件的坐标,器件的xy属性就是,判断器件是在TOP还是BOTTOM层,如果器件的isMirrored属性为t,说明器件在Bottom层。。。
作者: miatiger    时间: 2010-9-20 17:52
谢谢oday,我知道了坐标,如何移动到这颗零件的位置?我用axlZoomToDbid是可以,但是会放的很大,比如zoomin一颗电阻,会将电阻放大到整个屏幕,我想要的效果是,不改屏幕的放大,缩小,只是将零件定位到屏幕的中心,就像show elements再点零件的坐标得效果一样
作者: langexie    时间: 2010-9-21 08:53
比如元件的坐标是:4310.00 3195.00
axlShell("zoom center 4310.00 3195.00")
作者: oday    时间: 2010-9-21 13:55
比如pop_xy就是你取得的器件坐标,那么通过axlWindowBoxSet重新设置窗口的box,就可以将窗口定位到这个器件                       
                        pop_x = xCoord( pop_xy)                                                                                       
                        pop_y = yCoord( pop_xy)                                                                       
                                llx = pop_x - 500                                                                               
                                lly = pop_y - 400
                                urx = pop_x + 500
                                ury = pop_y + 400
                                window_bbox = list( llx:lly urx:ury)
                                axlWindowBoxSet( window_bbox)
作者: miatiger    时间: 2010-9-21 15:31
回复 5# oday

非常感谢!下面的是我查找symbol的代码.最开始的时候总是不知道各种dbid对应的属性有哪些,还有没弄清楚axlSelectByName函数的返回值是什么,结果

怎样都得不到symbo的属性,后来仔细看了algroskill.pdf才知道.
我最开始的时候是这样用的:
SymbolId= axlSelectByName("REFDES"  sSymbolName)
然后判断SymbolId->isMirrored 是否为t,结果总是nil,后来才发现axlSelectByName返回的是list,要用car函数取出里面的dbid才可以.

之后我会再修改zoom部分的代码.
  procedure( ex_FindSymbol(bHighMode sSymbolName)

if(sSymbolName == "" then

printf("Please type the symbol name")

return(nil))



SymbolList = axlSelectByName("REFDES"  sSymbolName)

SymbolId = car(SymbolList)



if(SymbolId != nil then

if(SymbolId->isMirrored then

ex_layer_bot()

else

ex_layer_top())



printf("Find Symbol %s\n" sSymbolName)

axlZoomToDbid(SymbolId  t)

axlHighlightObject(SymbolId bHighMode)

else

printf("%s is not found" sSymbolName)

);if

);procedure  

defun( ex_layer_top ()
    ;layerlist=axlGetParam("paramLayerGroup:etch")->groupMembers

;CurrentSel = axlGetSelSet()



axlVisibleDesign(nil)



axlVisibleLayer("board geometry/outline" t)

axlVisibleLayer("package keepin/all" t)

axlVisibleLayer("package geometry/silkscreen_top" t)



sTemp = strcat("pin/" axlConductorTopLayer())

axlVisibleLayer(sTemp t)

sTemp = strcat("etch/" axlConductorTopLayer())

axlVisibleLayer(sTemp t)

sTemp = strcat("via class/" axlConductorTopLayer())

axlVisibleLayer(sTemp t)

axlVisibleUpdate(t)



;axlHighlightObject(CurrentSel nil)
)

defun( ex_layer_bot ()


axlVisibleDesign(nil)



axlVisibleLayer("board geometry/outline" t)

axlVisibleLayer("package keepin/all" t)

axlVisibleLayer("package geometry/silkscreen_bottom" t)



sTemp = strcat("pin/" axlConductorBottomLayer())

axlVisibleLayer(sTemp t)

sTemp = strcat("etch/" axlConductorBottomLayer())

axlVisibleLayer(sTemp t)

sTemp = strcat("via class/" axlConductorBottomLayer())

axlVisibleLayer(sTemp t)



axlVisibleUpdate(t)
)


贴一下symbol的所有属性

Table 2-17 Symbol Attributes
Attribute Name   Type             Description

children            l_dbid/nil         List of figures other than pins making up symbol
component       dbid                Component owner of symbol
definition          dbid                Symbol definition
isMirrored         t/nil                t = symbol is mirrored
mirrorType       string             Type of mirror.
name               string             Symbol name
objType           string             Type of object, in this case "symbol"
parent             dbid               Design (no other parent possible for symbols)
pins                l_dbid/nil         List of pins
refdes             string/nil         Reference designator
rotation          float Symbol     rotation
作者: zgl846    时间: 2012-4-6 14:00
谢谢楼主分享哦,加油啊 bjbdf466zgl




欢迎光临 EDA365电子工程师网 (https://bbs.elecnest.cn/) Powered by Discuz! X3.2