找回密码
 注册
关于网站域名变更的通知
查看: 7671|回复: 36
打印 上一主题 下一主题

dxdesigner 自由导出symbol的vb脚本

  [复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2019-1-18 16:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
本帖最后由 linguohua 于 2019-1-18 19:32 编辑
8 `+ \$ S: E/ o3 v. _; K
  1. ' Export symbol to local file system, then you can import to your center library.
    7 N% f* t% W% O1 `5 [2 y
  2. ' ReAssembly by:lgh
    8 }! {1 U: d7 f- A

  3. ( }& p! a$ j0 ]0 v4 H0 r
  4. ' Usage:4 G/ {& c: ]) W8 f; F; N3 h
  5. ' In the dxdesigner Application window, make sure your toolbars$ }+ L# U# z0 Q% K( `. V
  6. ' has the "Command" toolbar,
    4 b# s: B9 `' W. [, p' z' }
  7. ' then select your symbol which you would like to export, and
    . M9 D- X, I0 J' ]- f$ R/ E
  8. ' type the follow line in the "Command" toolbar:
    0 F  H9 d8 O+ Q1 l& H, c7 M
  9. ' run dxdSymExport.vbs5 _# s! b0 N4 g# j5 z7 m
  10. ' then the selected symbols will be exported to target directory* q* U) y- }- X% _8 h

  11. 2 d* C0 b) R" z3 a
  12. Option Explicit  g* o6 G1 I/ C/ l. S5 J' W0 ?/ y; b
  13. ' Used to populate  Object browser in script editor
      a8 J1 h" J3 w5 F. e+ E5 R
  14. ' set vdapp = CreateObject("Viewdraw.Application")
    % [1 {* g# Y& y3 }+ a

  15. : F" \3 h6 o7 z
  16. Dim targetDir
    # F6 b% a+ W1 j4 Z7 l7 @0 y
  17. ' please set the target directory to where you want
    8 j6 Q7 R- x; G( T- I0 d
  18. targetDir = "D:\\dxdSymbolExport"! O% B  t7 i3 h) k0 C( I
  19. 5 T( R- x2 E7 q5 [
  20. ' Run on an open document.
    - p: Y  `( |. v( M
  21. Dim vdapp,vddoc,vdview
    : ?) Q, f7 k% w8 K6 l

  22. * F) s) }% C' j, @" e  Q. @* }
  23. ' **** Use the code within the asterisk area for an open drawing ****
    9 m6 g% R* X/ n1 \! l
  24. Set vdapp = GetObject (,"ViewDraw.Application")" o0 {0 y+ g: d5 E3 F3 t' |) N
  25. Scripting.AddTypeLibrary("ViewDraw.Application")
    6 i; T5 q7 s+ r! C5 G- e
  26. Set vddoc = vdapp.ActiveDocument% j& i5 i2 m$ z0 d0 P4 y
  27. Set vdview = vdapp.ActiveView3 t3 M/ w# j. t/ O2 u, \4 L
  28. ' ************* End of open drawing code *********************
    % A4 p9 S% F* O' d3 B+ `

  29. ) L8 r* J! q  P8 y& p
  30. ' Get attributes on selected part
    & D7 [1 s6 s) M$ {, P
  31. Dim SymbolName, Comp, SymbolBlock,exportResult! Y" Z* g/ v, c& U
  32. / Q% [2 j4 }! M6 J4 Z* Q3 N
  33. 'Create a collection using the Query method, of the7 A9 d5 L# c2 A4 H/ N! m0 |  [
  34. 'components which are selected on the schematic0 x: v' z- ~. x
  35. For Each Comp in vdview.Query(VDM_COMP, VD_Selected)
    2 }" i. D! G; V) h! c5 ~7 `3 o
  36. ! p) o! X4 i$ x' H) K( a' p4 O
  37.         Set SymbolBlock = Comp.SymbolBlock
      J1 Z1 j5 ~) l3 r; k
  38.         If SymbolBlock Is Nothing Then
    + D8 n; P% @% O6 A5 K/ A1 E4 G9 o
  39.                 'Has no SymbolBlock: m( I+ }. Y# Z* s* Z3 x
  40.         else
    6 w6 {) e4 |% b& y) ^
  41.                 SymbolName = SymbolBlock.GetName(FULL_PATH_NAME) & ".1": K! Y* ^1 n' Z: o
  42.                 'MsgBox SymbolName: V+ S% ]/ {9 p, N) }
  43. 7 I, P2 V% m4 N, @1 }9 t
  44.                 'DO export!: B$ G. b1 z) N$ o0 W) I! l" @
  45.                 exportResult = vdapp.ExportSymbol(SymbolName, targetDir)
    ( M7 u; \& V4 s: s1 W, j2 S
  46. 2 }# v% U0 |/ _! _( W1 \' |: w$ n0 m
  47.                 If exportResult Then; l. A* e0 j- R: }% c5 j
  48.                         ' nothing to do
    - b3 e; r9 }7 ~% b$ Q
  49.                 Else
    5 l% K0 N7 r$ g
  50.                         MsgBox "Export failed": Z/ g$ Q2 G, t$ u' W
  51.                         Exit For
    / {* ^5 T" S) d. ^( t! e2 V* w
  52.                 End If
    & r6 X; P$ f2 i  [" K  r1 ~) o0 [
  53.         End If ' SymbolBlock is nothing
    ; l' ?- X$ k( M/ X

  54. 9 U- Q) {4 b  P$ d" b+ `/ k
  55. Next
    : O1 \7 V9 o( _/ Y2 s, L
复制代码

( `- U% X; y; p  ]6 X: N/ ?# O8 g* b# T4 v
把上面代码保存成一个vbs后缀名文件,在dxdesigner中,选择一个或者多个你需要导出的符号,在dxdesigner的命令行输入框那键入:run xxx.vbs即可,其中xxx是你刚保存的vbs文件名。
, P5 F( p& ?9 u! o% E8 s3 [' j- Q# Y/ w9 r7 D6 x
必要时修改一下上面代码中的导出路径,targetDir = "D:\\dxdSymbolExport" ,修改为你需要的路径。
1 B' p3 O" {2 m0 |" y
: V/ Q' c$ B3 C弄这个脚本的目的是,为了从没有中心库的dxdesigner项目提取symbol,导出,然后导入到我自己的中心库中。- L  \8 Y! A+ a; L) h
备注:代码是我写的,没有版权问题。+ ^3 N. Y5 Y: E: m( O/ s  l: [
( @9 \  w! c: ]3 [1 [
; [' T+ K" O1 Z2 T/ H& q8 M
5 Z( B( Y2 l+ k* x0 G
, \( @1 ~1 l- f3 t9 l3 ], Y

评分

参与人数 4威望 +10 收起 理由
sun_tree + 2 EDA365有你更精彩!
WIN9 + 1 赞一个!
彭水飞 + 5
cat12620 + 2 EDA365有你更精彩!

查看全部评分

该用户从未签到

推荐
发表于 2022-1-18 13:14 | 只看该作者
Export Symobl.zip (128.66 KB, 下载次数: 38)
7 f+ U* I8 P' w# k1 T- h: M1 y5 e7 r7 _6 ?. |$ Q& U
整理了一下,供大家使用!
6 Q) [0 L  T# g  w

该用户从未签到

推荐
 楼主| 发表于 2019-12-18 15:27 | 只看该作者
刘鹏鹏 发表于 2019-12-17 16:22) S0 e6 P; E0 m' e/ P' ]
请问要怎么操作,可否指导下;
" V* p  Y- v3 \
可以参考这个连接:https://communities.mentor.com/thread/11946,步骤大概如下:4 r7 ?* O; G0 H) g0 m$ d- w$ e
How to extract symbols from schematics?
8 ~9 P! H* M$ _& ~( z. _
Since the symbols are cached in DxDesigner project use the following steps to extract symbols from one schematic for use in a new design.
Export the schematic in EDIF format
Open a design in DxDesigner
Use the menu File > Export > EDIF Schematic... to open the EDIF Interfaces dialog box
In the Schematic/Symbol field enter the schematic name
Check the Convert Design Hierarchically option
Check the Map attributes to properties option
Click the OK button and review the Output results window for any issues
Import the EDIF schematic into new DxDesigner project
In DxDesigner create a new project
Use the menu File > Import > EDIF Schematic to open the EDIF Interfaces dialog box
In the Inputfield enter the path to EDIF Schematic (.eds) file produced above
Click the OK button and review the Output results window for any issues
All of the symbols will be written to the [local symbols] of the new project
Extract the symbols from schematics
While still in DxDesigner, select the menu View > DxDataBook to see the created symbols
Select the CL Viewtab near the bottom of the DxDataBook window
Next select the Symbol View tab to view the [local symbols] library
Expand [local symbols] and select all the symbols using the mouse
Right mouse button on a selected item and choose Export Symbol(s)
In the Browse For Folder dialog navigate to a location where you want to write the ASCII symbol files
Click the OK button and confirm that the ASCII symbols have been written
( H2 B8 S. ^. w1 H' \1 [- s
总之,目的就是为了:先把symbol转成local symbol,然后才可以右键菜单导出symbol。

0 C/ m! l% y6 ?# L4 _! ^* \9 P, t6 I; J7 y

该用户从未签到

推荐
 楼主| 发表于 2019-12-18 15:17 | 只看该作者
三朵云 发表于 2019-12-17 16:449 F! R" X- K! X
@linguohua  会写脚本的大神,膜拜ing0 Q' X8 }; a: r: A5 ~  X
请问有提取net长度和其他好用的脚本么?
$ t+ s. b, b4 z/ C* n1 q( u5 bMentor 帮助文件里,有脚 ...
, \/ a3 p& f1 X
兄弟,一般情况下,如果有很多错误,可能是运行环境有问题了。需要把具体的错误和对应具体的脚步内容贴上来看看。
: z2 p: T, p  f7 D4 o9 {另外悲惨的是,我已经不用EE了(公司不让用,只能用盗版allegro),可能不能有效率的给您提供帮助了。  J; P% t) l7 F( V9 {+ d
  • TA的每日心情
    奋斗
    2019-11-20 15:07
  • 签到天数: 1 天

    [LV.1]初来乍到

    2#
    发表于 2019-1-21 09:49 | 只看该作者
    这个不错,测试下效果,感谢楼主。

    该用户从未签到

    3#
    发表于 2019-1-21 10:01 | 只看该作者
    Good, 还可以使用EDIF一次性导出所有Symbol

    点评

    请问要怎么操作,可否指导下;  详情 回复 发表于 2019-12-17 16:22
    如何快速和Part对应起来我觉得还得继续努力下。  详情 回复 发表于 2019-1-21 10:10
  • TA的每日心情
    奋斗
    2019-11-20 15:07
  • 签到天数: 1 天

    [LV.1]初来乍到

    4#
    发表于 2019-1-21 10:10 | 只看该作者
    老吴PCB 发表于 2019-1-21 10:01+ u' V+ R; G2 x8 y$ X9 O
    Good, 还可以使用EDIF一次性导出所有Symbol
    . d' Y8 k" p8 T8 f' @. X1 L
    如何快速和Part对应起来我觉得还得继续努力下。
    4 R* h/ b5 Z, H8 O  M) |

    该用户从未签到

    6#
    发表于 2019-1-25 13:36 | 只看该作者
    这个不错 ,谢谢分享!

    该用户从未签到

    7#
    发表于 2019-1-27 16:46 | 只看该作者
    感谢,非常好用,从OrCAD导入的原理图可以用这个脚本提取了,有点问题是Pin Number的信息没有一并提取出来

    该用户从未签到

    8#
    发表于 2019-1-27 16:49 | 只看该作者

      V6 U! W/ E+ N- u1 ?( Y1 F

    点评

    哈哈,这个我看看能否改进一下哈。你附加一个简单的示例工程给我,我来尝试改好,再把脚本更新一下。工程可以发到我邮箱是。  详情 回复 发表于 2019-1-27 22:34

    该用户从未签到

    9#
     楼主| 发表于 2019-1-27 22:34 | 只看该作者

    + |9 y" K5 ^( U9 N6 _" g9 m: X. k哈哈,这个我看看能否改进一下哈。你附加一个简单的示例工程给我,我来尝试改好,再把脚本更新一下。工程可以发到我邮箱是lghchinaidea@gmail.com

    点评

    楼主,能否提供下插件,小弟实在是对软件不感冒,不太会搞这些。又给你发邮件,不胜感激。  详情 回复 发表于 2019-12-17 16:21
    邮箱不行呀,QQ和163都发不过去,难道是谷歌在抵制 QQ 和 163 ?  详情 回复 发表于 2019-1-29 10:32
    已发送,请查收  详情 回复 发表于 2019-1-29 10:08

    该用户从未签到

    10#
    发表于 2019-1-29 10:08 | 只看该作者
    linguohua 发表于 2019-1-27 22:34
    # e$ F) Q" O; w  }% F$ g- @哈哈,这个我看看能否改进一下哈。你附加一个简单的示例工程给我,我来尝试改好,再把脚本更新一下。工程 ...
    6 }$ F  T' @( _& V9 q
    已发送,请查收
    - n- p' l! L! q' E
    # f, \' f2 `  j3 U( ?

    该用户从未签到

    11#
    发表于 2019-1-29 10:32 | 只看该作者
    本帖最后由 WIN9 于 2019-1-29 10:46 编辑 , \" y, x! i( d2 A0 x+ f
    linguohua 发表于 2019-1-27 22:348 u2 V& S4 M& A
    哈哈,这个我看看能否改进一下哈。你附加一个简单的示例工程给我,我来尝试改好,再把脚本更新一下。工程 ...

    " a2 Y* k% t0 G7 p) @1 l- v邮箱不行呀,QQ和163都发不过去,难道是谷歌在抵制 QQ 和 163 ?
    " D! l# G4 g" u1 V: i& I
    . C! W( M5 |5 ^% a: {& s' I# t" D# U/ p( K) W2 e  A/ I. N2 B

    该用户从未签到

    12#
    发表于 2019-1-29 10:41 | 只看该作者
    8 C. e6 T0 t& l

    ( D% v9 |* k5 O 6 a9 h; z9 H! S& f6 J$ {

    点评

    抱歉兄弟,耽误了您时间了. 要不你作为附件发到这个帖子上来.  详情 回复 发表于 2019-1-29 22:08

    该用户从未签到

    13#
     楼主| 发表于 2019-1-29 22:08 | 只看该作者
    # p* y  r4 a7 [0 L2 n1 n
    抱歉兄弟,耽误了您时间了., l$ U* ?- p3 j* B
    要不你作为附件发到这个帖子上来.3 v9 n6 o, p5 _# l9 X* y' }' T

    该用户从未签到

    14#
    发表于 2019-4-25 10:36 | 只看该作者
    很多PCB转换中库中只与PADSTACK cell  PART,就是没有symbol,原理图转换后,提取不了symbol,导致,无法打包编译,无法正表,无法关联;
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

    推荐内容上一条 /1 下一条

    EDA365公众号

    关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

    GMT+8, 2025-9-11 08:30 , Processed in 0.187500 second(s), 36 queries , Gzip On.

    深圳市墨知创新科技有限公司

    地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

    快速回复 返回顶部 返回列表