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 wireset 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 globalset 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 blockset 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 pageset 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 pageset 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 pageset 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 partset 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 wireset 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 $lFlatNetset lNetName [DboTclHelper_sMakeCString]$lFlatNet GetName $lNetName#get the next flat net of designset 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 $lUPropset lName [DboTclHelper_sMakeCString]set lValue [DboTclHelper_sMakeCString]$lUProp GetName $lName$lUProp GetStringValue $lValue#get the next user property on the objectset 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 nameset lName [DboTclHelper_sMakeCString]$lDProp GetName $lName#get the locationset lLocation [$lDProp GetLocation $lStatus]#get the rotationset lRot [$lDProp GetRotation $lStatus]#get the fontset lFont [DboTclHelper_sMakeLOGFONT]set lStatus [$lDProp GetFont $::DboLib_DEFAULT_FONT_PROPERTY $lFont]#get the colorset lColor [$lDProp GetColor $lStatus]#get the next display property on the objectset 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 0set 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 0set lY 0set 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 propertyset 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]

Cadence OrCAD Capture TCL/TK脚本实例相关推荐

  1. Cadence OrCAD Capture TCL/TK脚本——DboGlobal

    DboGlobalSymbol DboGlobal_SetMirror DboGlobal_GetPinType DboGlobal_SetName DboGlobal_GetGlobalSymbol ...

  2. 1.TCL/TK脚本学习——入门基础

    1.TCL/TK脚本学习--入门基础 Tcl/Tk有两个主要程序.是 tclsh 和 wish.前者是 Tcl 外壳,常用于为外壳脚本提供执行环境.Wish 类似于 tclsh,它是针对窗口化的 GU ...

  3. 最详细的Cadence OrCAD Capture自带元件库的介绍

    最详细的Cadence OrCAD Capture自带元件库的介绍本章节将介绍Cadence OrCAD Capture 软件自带的各类元件库的分类,方便大家在设计时能够快速的选择元件. 1 2 3 ...

  4. Tcl/Tk脚本中执行Shell脚本

    在Tcl/Tk脚本中执行Shell命令 set n 0 set x "*"while {$n < 10} {puts $xset x "$x"*set n ...

  5. Cadence OrCAD Capture CIS数据库和Altium Designer数据库的搭建与配置

    [前言] Hello,大家好,今天星仔想跟大家分享Cadence OrCAD Capture CIS和Altium Designer本地数据库的搭建与配置,下面是系统和软件的版本信息: 1.操作系统: ...

  6. Cadence OrCAD Capture CIS 输出带属性的PDF原理图

    1.准备工作 需要安装虚拟打印机,推荐Adobe PDF.安装完成后,可以看到打印机列表里多了一个虚拟打印机,记住这个打印机的名称"Adobe PDF",后面会用到. 2.修改配置 ...

  7. TCL/TK脚本应用tclkit工具打包

    工具下载: 1:tclkit http://equi4.com/tclkit/download.html 2:sdx.kit http://equi4.com/pub/sk/sdx.kit 打包过程: ...

  8. NAMD 中计算水分子沿某一放向的平均值 (tcl/tk 脚本输出数据, awk 求某一列平均值)

    .conf 文件里面 写入输出速度的 参数 veldcdfreq 500 run MD mv r3.veldcd r3vel.dcd vmd .psf r3vel.dcd 执行脚本 输出 veloci ...

  9. Cadence OrCAD capture SCH package

    在excel 中将要建立的封装进行标号 Pin重新排序调整 将excel中的内容复制到capture中 save 配置好的 打开封装调整位置,将模拟信号,数字信号,JTAG ,电源VCC和电源GND重 ...

  10. Cadence Orcad Capture元件位号自动编号的2种方法图文教程及视频演示

      

最新文章

  1. Linux-Copy On Write写时复制机制初探
  2. 专访厦门第二医院影像科主任郭岗:基于 IBM 推出的 AI 集成解决方案,如何给医生减负增效?...
  3. 【Servlet3.0新特性】第03节_文件上传
  4. Nginx跨域问题的原因分析
  5. css3 的 calc()函数在布局中的使用----头部高度固定,页面正好占满一屏
  6. jQuery css详解
  7. 数据库设计器无法打开方法
  8. ES11新特性_绝对全局对象globalThis---JavaScript_ECMAScript_ES6-ES11新特性工作笔记067
  9. printf参数的问题
  10. Framework Ventures联合创始人:未来两年DeFi TVL将提升10倍
  11. 大家都是怎么过催收的生活?
  12. 【数字信号】基于matlab GUI简易电子琴(英文版)【含Matlab源码 873期】
  13. 对外汉语偏误语料库_BCC语料库
  14. 高频量化交之李庆:在华尔街狼共舞的岁
  15. 「C/C++经典项目开发」黑客远程桌面监控手机摄像头系统
  16. TCL嵌入式测试技术在Comware V7系统中的应用
  17. 机器视觉应该先看什么书?
  18. 闲聊人工智能产品经理(AIPM)—人工智能产品经理工作流程
  19. 遗传算法占用计算机空间,遗传算法
  20. STOP:0x0000007E蓝屏软件故障处理一例

热门文章

  1. 【深入浅出】Java中 this关键字的四种用法
  2. TMS320C6678+Kintex-7开发板——DSP程序固化操作手册
  3. 如何把Mysql卸载干净?(亲测有效)
  4. IT人员必学最基础知识(一)——总括
  5. 《穿越计算机的迷雾》 李忠 (确实写得非常好,赞一个)
  6. AD14如何设置指定线路与敷铜之间的安全距离
  7. php实现mkv视频播放,mkv怎么合并视频文件
  8. android加密打包,(爱加密系列教程二十)Xamarin开发Android应用、如何打包apk(转载)...
  9. h5的table表格边框线问题解决方案
  10. Django 实现文件下载