当前位置:网站首页>Cadence OrCAD Capture TCL/TK脚本实例
Cadence OrCAD Capture TCL/TK脚本实例
2022-07-21 11:19:00 【U.2 SSD】
Cadence OrCAD Capture TCL/TK脚本实例
- 获取当前Session
- 创建新的Session
- 获取Session的设计
- 遍历Session中所有的设计
- 获取设计中的原理图
- 遍历设计中的所有原理图
- 获取原理图中的页
- 遍历原理图中所有页
- 遍历原理图页中所有元件实例
- 遍历原理图页中所有的```wire```
- 遍历原理图页中的所有全局变量
- 遍历原理图页的所有``Title-Block``
- 遍历原理图页的所有端口
- 遍历原理图页的所有```Off-Page```
- 遍历原理图页的所有```Graphics```
- 遍历元件实例的所有引脚
- 遍历```wire```的所有别名
- 遍历设计的所有```Flat Net```
- 遍历任一对象的所有用户属性
- 遍历任一对象的所有显示属性
- 改变对象的显示属性
- 遍历对象的所有有效属性
- 获取元件实例的属性
- 获取```Wire```属性
获取当前Session
set lSession $::DboSession_s_pDboSession
DboSession -this $lSession
创建新的Session
set lSession [DboTclHelper_sCreateSession]
获取Session的设计
set lStatus [DboState]
# 指定设计路径名称
# set pDesignPath d:/spb163/tools/capture/samples/fulladd.dsn
set lDesignPath [DboTclHelper_sMakeCString $pDesignPath]
set lDesign [$lSession GetDesignAndSchematics $lDesignPath $lStatus]
遍历Session中所有的设计
set lDesignsIter [$lSession NewDesignsIter $lStatus]
#get the first design
set lDesign [$lDesignsIter NextDesign $lStatus]
set lNullObj NULL
while { $lDesign!= $lNullObj} {
#placeholder: do your processing on $lDesign
#get the next design
set lDesign [$lDesignsIter NextDesign $lStatus]
}
delete_DboSessionDesignsIter $lDesignsIter
获取设计中的原理图
# set pSchematicName SCHEMATIC1 EXAMPLE
set lSchematicName [DboTclHelper_sMakeCString $pSchematicName]
set lSchematic [$lDesign GetSchematic $lSchematicName $lStatus]
遍历设计中的所有原理图
set lSchematicIter [$lDesign NewViewsIter $lStatus $::IterDefs_SCHEMATICS]
#get the first schematic view
set lView [$lSchematicIter NextView $lStatus]
set lNullObj NULL
while { $lView != $lNullObj} {
#dynamic cast from DboView to DboSchematic
set lSchematic [DboViewToDboSchematic $lView]
#placeholder: do your processing on $lSchematic
#get the next schematic view
set lView [$lSchematicIter NextView $lStatus]
}
delete_DboLibViewsIter $lSchematicIter
获取原理图中的页
# set pPageName PAGE1 EXAMPLE
set lPageName [DboTclHelper_sMakeCString $pPageName]
set lPage [$lSchematic GetPage $lPageName $lStatus]
遍历原理图中所有页
set lPagesIter [$lSchematic NewPagesIter $lStatus]
#get the first page
set lPage [$lPagesIter NextPage $lStatus]
set lNullObj NULL
while {$lPage!=$lNullObj} {
#placeholder: do your processing on $lPage
#get the next page
set lPage [$lPagesIter NextPage $lStatus]
}
delete_DboSchematicPagesIter $lPagesIter
遍历原理图页中所有元件实例
set lPartInstsIter [$lPage NewPartInstsIter $lStatus]
#get the first part inst
set lInst [$lPartInstsIter NextPartInst $lStatus]
while {$lInst!=$lNullObj} {
#dynamic cast from DboPartInst to DboPlacedInst
set lPlacedInst [DboPartInstToDboPlacedInst $lInst]
if {$lPlacedInst != $lNullObj} {
#placeholder: do your processing on $lPlacedInst
}
#get the next part inst
set lInst [$lPartInstsIter NextPartInst $lStatus]
}
delete_DboPagePartInstsIter $lPartInstsIter
遍历原理图页中所有的wire
set lWiresIter [$lPage NewWiresIter $lStatus]
#get the first wire
set lWire [$lWiresIter NextWire $lStatus]
set lNullObj NULL
while {$lWire != $lNullObj} {
set lObjectType [$lWire GetObjectType]
if {$lObjectType == $::DboBaseObject_WIRE_SCALAR} {
#placeholder: do your processing on Wire scalar $lWire
} elseif {$lObjectType == $::DboBaseObject_WIRE_BUS} {
#placeholder: do your processing on Wire Bus $lWire
}
#get the next wire
set lWire [$lWiresIter NextWire $lStatus]
}
delete_DboPageWiresIter $lWiresIter
遍历原理图页中的所有全局变量
set lGlobalsIter [$lPage NewGlobalsIter $lStatus]
#get the first global
set lGlobal [$lGlobalsIter NextGlobal $lStatus]
while { $lGlobal!=$lNullObj } {
#placeholder: do your processing on $lGlobal
#get the next global
set lGlobal [$lGlobalsIter NextGlobal $lStatus]
}
delete_DboPageGlobalsIter $lGlobalsIter
遍历原理图页的所有Title-Block
set lTitleBlocksIter [$lPage NewTitleBlocksIter $lStatus]
#get the first title block
set lTitle [$lTitleBlocksIter NextTitleBlock $lStatus]
while {$lTitle!=$lNullObj} {
#placeholder: do your processing on $lTitle
#get the next title block
set lTitle [$lTitleBlocksIter NextTitleBlock $lStatus]
}
delete_DboPageTitleBlocksIter $lTitleBlocksIter
遍历原理图页的所有端口
set lPortsIter [$lPage NewPortsIter $lStatus]
#get the first port of the page
set lPort [$lPortsIter NextPort $lStatus]
while {$lPort!=$lNullObj} {
#placeholder: do your processing on $lPort
#get the next port of the page
set lPort [$lPortsIter NextPort $lStatus]
}
delete_DboPagePortsIter $lPortsIter
遍历原理图页的所有Off-Page
set lOffPagesIter [$lPage NewOffPageConnectorsIter $lStatus $::IterDefs_ALL]
#get the first off-page of the page
set lOffPage [$lOffPagesIter NextOffPageConnector $lStatus]
while {$lOffPage!=$lNullObj} {
#placeholder: do your processing on $lOffPage
#get the next off-page of the page
set lOffPage [$lOffPagesIter NextOffPageConnector $lStatus]
}
delete_DboPageOffPageConnectorsIter $lOffPagesIter
遍历原理图页的所有Graphics
set lCommentsIter [$lPage NewCommentGraphicsIter $lStatus]
#get the first graphics of the page
set lGraphic [$lCommentsIter NextCommentGraphic $lStatus]
while {$lGraphic!=$lNullObj} {
set lType [$lGraphic GetObjectType]
if {$lType == $::DboBaseObject_GRAPHIC_BOX_INST} {
set lBoxInst [DboGraphicInstanceToDboGraphicBoxInst $lGraphic]
#placeholder: do your processing on $lBoxInst
} elseif {$lType == $::DboBaseObject_GRAPHIC_LINE_INST} {
set lLineInst [DboGraphicInstanceToDboGraphicLineInst $lGraphic]
#placeholder: do your processing on $lLineInst
} elseif {$lType == $::DboBaseObject_GRAPHIC_ELLIPSE_INST} {
set lEllipseInst [DboGraphicInstanceToDboGraphicEllipseInst $lGraphic]
#placeholder: do your processing on $lEllipseInst
} elseif {$lType == $::DboBaseObject_GRAPHIC_ARC_INST} {
set lArcInst [DboGraphicInstanceToDboGraphicArcInst $lGraphic]
#placeholder: do your processing on $lArcInst
} elseif {$lType == $::DboBaseObject_GRAPHIC_POLYLINE_INST} {
set lPolylineInst [DboGraphicInstanceToDboGraphicPolylineInst $lGraphic]
#placeholder: do your processing on $lPolylineInst
} elseif {$lType == $::DboBaseObject_GRAPHIC_POLYGON_INST} {
set $lPolygonInst [DboGraphicInstanceToDboGraphicPolygonInst $lGraphic]
#placeholder: do your processing on $lPolygonInst
} elseif {$lType == $::DboBaseObject_GRAPHIC_BITMAP_INST} {
set lBitMapInst [DboGraphicInstanceToDboGraphicBitMapInst $lGraphic]
#placeholder: do your processing on $lBitMapInst
} elseif {$lType == $::DboBaseObject_GRAPHIC_COMMENTTEXT_INST} {
set lTextInst [DboGraphicInstanceToDboGraphicCommentTextInst $lGraphic]
#placeholder: do your processing on $lTextInst
}
#get the next graphics of the page
set lGraphic [$lCommentsIter NextCommentGraphic $lStatus]
}
delete_DboPageCommentGraphicsIter $lCommentsIter
遍历元件实例的所有引脚
set lIter [$lInst NewPinsIter $lStatus]
set lNullObj NULL
#get the first pin of the part
set lPin [$lIter NextPin $lStatus]
while {$lPin !=$lNullObj } {
#placeholder: do your processing on $lPin
#get the next pin of the part
set lPin [$lIter NextPin $lStatus]
}
delete_DboPartInstPinsIter $lIter
遍历wire
的所有别名
set lAliasIter [$lWire NewAliasesIter $lStatus]
#get the first alias of wire
set lAlias [$lAliasIter NextAlias $lStatus]
while { $lAlias!=$lNullObj} {
#placeholder: do your processing on $lAlias
#get the next alias of wire
set lAlias [$lAliasIter NextAlias $lStatus]
}
delete_DboWireAliasesIter $lAliasIter
遍历设计的所有Flat Net
set lFlatNetsIter [$pDesign NewFlatNetsIter $lStatus]
#get the first flat net of design
set lFlatNet [$lFlatNetsIter NextFlatNet $lStatus]
while {$lFlatNet!=$lNullObj} {
#placeholder: do your processing on $lFlatNet
set lNetName [DboTclHelper_sMakeCString]
$lFlatNet GetName $lNetName
#get the next flat net of design
set lFlatNet [$lFlatNetsIter NextFlatNet $lStatus]
}
delete_DboDesignFlatNetsIter $lFlatNetsIter
遍历任一对象的所有用户属性
set lPropsIter [$lObject NewUserPropsIter $lStatus]
set lNullObj NULL
#get the first user property on the object
set lUProp [$lPropsIter NextUserProp $lStatus]
while {$lUProp !=$lNullObj } {
#placeholder: do your processing on $lUProp
set lName [DboTclHelper_sMakeCString]
set lValue [DboTclHelper_sMakeCString]
$lUProp GetName $lName
$lUProp GetStringValue $lValue
#get the next user property on the object
set lUProp [$lPropsIter NextUserProp $lStatus]
}
delete_DboUserPropsIter $lPropsIter
遍历任一对象的所有显示属性
set lPropsIter [$lObject NewDisplayPropsIter $lStatus]
set lNullObj NULL
#get the first display property on the object
set lDProp [$lPropsIter NextProp $lStatus]
while {$lDProp !=$lNullObj } {
#placeholder: do your processing on $lDProp
#get the name
set lName [DboTclHelper_sMakeCString]
$lDProp GetName $lName
#get the location
set lLocation [$lDProp GetLocation $lStatus]
#get the rotation
set lRot [$lDProp GetRotation $lStatus]
#get the font
set lFont [DboTclHelper_sMakeLOGFONT]
set lStatus [$lDProp GetFont $::DboLib_DEFAULT_FONT_PROPERTY $lFont]
#get the color
set lColor [$lDProp GetColor $lStatus]
#get the next display property on the object
set lDProp [$lPropsIter NextProp $lStatus]
}
delete_DboDisplayPropsIter $lPropsIter
改变对象的显示属性
proc ConvertUserToDoc { pPage pUser } {
set lDocDouble [expr "[$pPage GetPhysicalGranularity] * $pUser + 0.5"]
set lDoc [expr "round($lDocDouble)"]
return $lDoc
}
proc AddDisplayProperty {} {
# Get the selected objects
set lSelObjs1 [GetSelectedObjects]
set lObj1 [lindex $lSelObjs1 0]
set lPropNameCStr [DboTclHelper_sMakeCString "ASSEMBLY"]
set lPropValueCStr [DboTclHelper_sMakeCString "NC"]
set lStatus [$lObj1 SetEffectivePropStringValue $lPropNameCStr $lPropValueCStr]
set varNullObj NULL
set pDispProp [$lObj1 GetDisplayProp $lPropNameCStr $lStatus]
set lStatus [DboState]
if { $pDispProp == $varNullObj } {
set rotation 0
set logfont [DboTclHelper_sMakeLOGFONT]
set color $::DboValue_DEFAULT_OBJECT_COLOR
#set displocation [DboTclHelper_sMakeCPoint [expr $xlocation] [expr
$ylocation]]
if {[catch {set lPickPosition [GetLastMouseClickPointOnPage]} lResult] } {
set lX 0
set lY 0
set displocation [DboTclHelper_sMakeCPoint $intX $intY]
} else {
set page [$lObj1 GetOwner]
set lX [ConvertUserToDoc $page [lindex $lPickPosition 0]]
set lY [ConvertUserToDoc $page [lindex $lPickPosition 1]]
set displocation [DboTclHelper_sMakeCPoint $lX $lY]
}
set pNewDispProp [$lObj1 NewDisplayProp $lStatus $lPropNameCStr $displocation
$rotation $logfont $color]
#DO_NOT_DISPLAY = 0,
#VALUE_ONLY = 1,
#NAME_AND_VALUE = 2,
#NAME_ONLY = 3,
#BOTH_IF_VALUED = 4,
$pNewDispProp SetDisplayType $::DboValue_NAME_AND_VALUE
} else {
$pDispProp SetDisplayType $::DboValue_NAME_ONLY
}
}
遍历对象的所有有效属性
set lPropsIter [$lObject NewEffectivePropsIter $lStatus]
set lNullObj NULL
#create the input/output parameters
set lPrpName [DboTclHelper_sMakeCString]
set lPrpValue [DboTclHelper_sMakeCString]
set lPrpType [DboTclHelper_sMakeDboValueType]
set lEditable [DboTclHelper_sMakeInt]
#get the first effective property
set lStatus [$lPropsIter NextEffectiveProp $lPrpName $lPrpValue $lPrpType $lEditable]
while {[$lStatus OK] == 1} {
#placeholder: do your processing for $lPrpName $lPrpValue $lPrpType $lEditable
#get the next effective property
set lStatus [$lPropsIter NextEffectiveProp $lPrpName $lPrpValue $lPrpType $lEditable]
}
delete_DboEffectivePropsIter $lPropsIter
获取元件实例的属性
#get the name
set lName [DboTclHelper_sMakeCString]
$lInst GetName $lName
#get the location point
set lLocation [$lInst GetLocation $lStatus]
#get the location x
set lStartx [DboTclHelper_sGetCPointX $lLocation]
#get the location y
set lStarty [DboTclHelper_sGetCPointY $lLocation]
#get the source library name
set lLibName [DboTclHelper_sMakeCString]
$lInst GetSourceLibName $lLibName
#get the device designator
set lDeviceDesignator [DboTclHelper_sMakeCString]
$lInst GetReferenceDesignator $lDeviceDesignator
#get the rotation
set lRot [$lInst GetRotation $lStatus]
#get the contents lib name
set lContentsLibName [DboTclHelper_sMakeCString]
$lInst GetContentsLibName $lContentsLibName
#get the contents view name
set lContentsViewName [DboTclHelper_sMakeCString]
$lInst GetContentsViewName $lContentsViewName
#get the contents view type
set lType [$lInst GetContentsViewType $lStatus]
#get the primitive type
set lPrimitiveType [$lInst GetIsPrimitiveProp $lStatus]
#get the part value
set lValue [DboTclHelper_sMakeCString]
$lInst GetPartValue $lValue
#get the reference
set lReferenceName [DboTclHelper_sMakeCString]
$lInst GetReference $lReferenceName
#get the bounding box on the page
set lBBox [$lInst GetOffsetBoundingBox $lStatus]
#get the top-left of the bbox
set lTopLeft [DboTclHelper_sGetCRectTopLeft $lBBox]
#get the bottom-right of the bbox
set lBottomRight [DboTclHelper_sGetCRectBottomRight $lBBox]
#get the x1
set lStartx [DboTclHelper_sGetCPointX $lTopLeft]
#get the y1
set lStarty [DboTclHelper_sGetCPointY $lTopLeft]
#get the x2
set lEndx [DboTclHelper_sGetCPointX $lBottomRight]
#get the y2
set lEndy [DboTclHelper_sGetCPointY $lBottomRight]
获取Wire
属性
#get the name
set lName [DboTclHelper_sMakeCString]
$lWire GetName $lName
#get the net name
set lNetName [DboTclHelper_sMakeCString]
$lWire GetNetName $lNetName
#get the start point
set lStart [$lWire GetStartPoint $lStatus]
set lStartx [DboTclHelper_sGetCPointX $lStart]
set lStarty [DboTclHelper_sGetCPointY $lStart]
#get the end point
set lEnd [$lWire GetEndPoint $lStatus]
set lEndx [DboTclHelper_sGetCPointX $lEnd]
set lEndy [DboTclHelper_sGetCPointY $lEnd]
#get the color
set lColor [$lWire GetColor $lStatus]
#get the net
set lNet [$lWire GetNet $lStatus]
边栏推荐
猜你喜欢
The pit trodden by real people tells you to avoid the 10 mistakes that novices in automated testing often make
Seaborn draws box chart and line chart
乘数科技云管控平台适配阿里云PolarDB,共促云原生数据库生态繁荣
Idea建文件夹时,文件夹的空文件夹的展开与重叠
从浏览器上传、下载Excel文件到数据库
Field injection is not recommended怎么处理
如何搭建一个好的知识库管理系统?
Compilation Principle Experiment 1 -- principle and implementation of lexical analysis program design
阿里程序员,工作6年,真实薪资曝光
百度副总裁李硕:AI能深入场景创造真价值,从传感器到大屏仅是数字化开始...
随机推荐
Application of DC distribution system products at the end of data center
How to make the full-color LED display screen energy-saving and environmental protection?
SCA在得物DevSecOps平台上应用
NFTScan 与 Port3 在 NFT 数据领域达成战略合作
servlet写webapp时,用filter拦截实现登陆验证
TCL/TK分组和替换规则
代码管理(新手)
Li Shuo, vice president of Baidu: AI can go deep into the scene and create real value. From sensors to large screens, it is just the beginning of digitalization
MySQL终章
Luogu - changing classrooms - (probability expectation +dp)
[39题] 牛客深度学习专项题
Cesium使用czml来实现动态路线
Part 101 blind box smart contract (erc1155)
Application of SCA on devsecops platform
How to build a good knowledge base management system?
关于动态申请二位数组的问题
Idea建文件夾時,文件夾的空文件夾的展開與重疊
湘潭市党政代表团莅临麒麟信安调研考察
Field injection is not recommended怎么处理
eBPF验证器