执行方法:工具栏->Tools -> Execute Commands -> Edit/Run Script (Ctrl+Shift+X)

如下图所示:

1、Name转到Comment注释字段

  1. Option Explicit
  2. ValidationMode = True
  3. InteractiveMode = im_Batch
  4.  
  5. Dim mdl ' the current model
  6.  
  7. ' get the current active model
  8. Set mdl = ActiveModel
  9. If (mdl Is Nothing) Then
  10. MsgBox "There is no current Model "
  11. ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
  12. MsgBox "The current model is not an Physical Data model. "
  13. Else
  14. ProcessFolder mdl
  15. End If
  16.  
  17. ' This routine copy name into comment for each table, each column and each view
  18. ' of the current folder
  19. Private sub ProcessFolder(folder)
  20. Dim Tab 'running table
  21. for each Tab in folder.tables
  22. if not tab.isShortcut then
  23. if trim(tab.comment)="" then'如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面.
  24. tab.comment = tab.name
  25. end if
  26. Dim col ' running column
  27. for each col in tab.columns
  28. if trim(col.comment)="" then '如果colcomment为空,则填入name,如果已有注释,则不添加;这样可以避免已有注释丢失.
  29. col.comment= col.name
  30. end if
  31. next
  32. end if
  33. next
  34.  
  35. Dim view 'running view
  36. for each view in folder.Views
  37. if not view.isShortcut and trim(view.comment)="" then
  38. view.comment = view.name
  39. end if
  40. next
  41.  
  42. ' go into the sub-packages
  43. Dim f ' running folder
  44. For Each f In folder.Packages
  45. if not f.IsShortcut then
  46. ProcessFolder f
  47. end if
  48. Next
  49. end sub

2、将Comment内容保存到NAME中

  1. Option Explicit
  2. ValidationMode = True
  3. InteractiveMode = im_Batch
  4.  
  5. Dim mdl ' the current model
  6.  
  7. ' get the current active model
  8. Set mdl = ActiveModel
  9. If (mdl Is Nothing) Then
  10. MsgBox "There is no current Model "
  11. ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
  12. MsgBox "The current model is not an Physical Data model. "
  13. Else
  14. ProcessFolder mdl
  15. End If
  16.  
  17. Private sub ProcessFolder(folder)
  18. On Error Resume Next
  19. Dim Tab 'running table
  20. for each Tab in folder.tables
  21. if not tab.isShortcut then
  22. tab.name = tab.comment
  23. Dim col ' running column
  24. for each col in tab.columns
  25. if col.comment="" then
  26. else
  27. col.name= col.comment
  28. end if
  29. next
  30. end if
  31. next
  32.  
  33. Dim view 'running view
  34. for each view in folder.Views
  35. if not view.isShortcut then
  36. view.name = view.comment
  37. end if
  38. next
  39.  
  40. ' go into the sub-packages
  41. Dim f ' running folder
  42. For Each f In folder.Packages
  43. if not f.IsShortcut then
  44. ProcessFolder f
  45. end if
  46. Next
  47. end sub

3、name转stereotype

  1. Option Explicit
  2. ValidationMode = True
  3. InteractiveMode = im_Batch
  4.  
  5. Dim mdl ' the current model
  6.  
  7. ' get the current active model
  8. Set mdl = ActiveModel
  9. If (mdl Is Nothing) Then
  10. MsgBox "There is no current Model "
  11. ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
  12. MsgBox "The current model is not an Physical Data model. "
  13. Else
  14. ProcessFolder mdl
  15. End If
  16.  
  17. ' This routine copy name into stereotype for each table, each column and each view
  18. ' of the current folder
  19. Private sub ProcessFolder(folder)
  20. Dim Tab 'running table
  21. for each Tab in folder.tables
  22. if not tab.isShortcut then
  23. if trim(tab.stereotype)="" then'如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面.
  24. tab.stereotype = tab.name
  25. end if
  26. Dim col ' running column
  27. for each col in tab.columns
  28. if trim(col.stereotype)="" then '如果colstereotype为空,则填入name,如果已有注释,则不添加;这样可以避免已有注释丢失.
  29. col.stereotype= col.name
  30. end if
  31. next
  32. end if
  33. next
  34.  
  35. Dim view 'running view
  36. for each view in folder.Views
  37. if not view.isShortcut and trim(view.stereotype)="" then
  38. view.stereotype = view.name
  39. end if
  40. next
  41.  
  42. ' go into the sub-packages
  43. Dim f ' running folder
  44. For Each f In folder.Packages
  45. if not f.IsShortcut then
  46. ProcessFolder f
  47. end if
  48. Next
  49. end sub

PowerDesigner执行脚本 name/comment/stereotype互转的更多相关文章

  1. PowerDesigner设计Name和Comment 替换

    这两天在用powerdesigner设计数据库.一直以为name就是注释名字来着.后来生成sql语句 怎么就没有注释信息那. 后来看了半天才知道自己范2了. 通过各种信息查找.大多都是改databas ...

  2. crontab 定时执行脚本出错,但手动执行脚本正常

    原因: crontab 没有去读环境变量,需要再脚本中手动引入环境变量,可以用source 也可以用export 写死环境变量. 为了定时监控Linux系统CPU.内存.负载的使用情况,写了个Shel ...

  3. Linux下定时执行脚本(转自Decode360)

    文章来自:http://www.blogjava.net/decode360/archive/2009/09/18/287743.html Decode360's Blog  老师(业精于勤而荒于嬉 ...

  4. SSH登录远程主机执行脚本找不到环境变量

    这是因为在Linux上,bash会有四种模式,根据不同的case,Linux会加载不同模式的bash.一般如果你自己直接登录主机,能看到环境变量,但是使用ssh 远程登录执行脚本就找不到环境变量,那么 ...

  5. 【Telnet】使用Telnet协议连接到远程Shell执行脚本

    介绍 本文介绍如何通过Telnet协议连接到远程Shell,执行脚本,并获取执行结果: 相关文章: <[Jsch]使用SSH协议连接到远程Shell执行脚本>http://www.cnbl ...

  6. 【Jsch】使用SSH协议连接到远程Shell执行脚本

    如果大家熟悉Linux的话,一定对ssh,sftp,scp等命令非常熟悉,ssh是一个安全协议,用来在不同系统或者服务器之间进行安全连接,SSH 在连接和传送的过程中会加密所有的数据. 但是SSH一般 ...

  7. c# 动态执行脚本,相关的几个脚本引擎.

    Jint   嵌入式的javascript脚本支持引擎,一直都在更新,对各种方法支持也比较好,可以 C# 交互. https://github.com/sebastienros/jint Jurass ...

  8. crontab执行脚本中文乱码,手动执行没有问题

    crontab执行脚本中文乱码,手动执行没有问题 产生原因:       这是因为Unix/Linux下使用crontab时的运行环境已经不是用户环境了,因此原本用户下的一些环境变量的设置就失效了.例 ...

  9. SSH 无密码远程执行脚本

    ssh无密码登录及远程执行脚本要使用公钥与私钥.linux下可以用用ssh-keygen生成公钥/私钥对,下面我以CentOS7为例. 测试环境:机器A(10.0.224.80):机器B(192.16 ...

随机推荐

  1. 【Go】 Go 语言环境安装

    安装环境/工具 1.Linux(CentOS 7.4版) 2.go1.11.2.linux-amd64.tar Go 语言环境安装 1.下载安装包 安装包下载地址为:https://golang.or ...

  2. spring学习 五 依赖注入的方式

    依赖注入有两种方式: 1 构造注入,如果<bean>标签下使用<contructor-arg>,则是构造注入 2 setter注入,就是调用setter方法注入,如果<b ...

  3. 【linux轻松学】修改文件权限

    用chmod修改文件权限,此命令非常重要. 用户范围:u 表示当前用户g 表示当前群组o 除u,g之外的用户和群组a 所有用户和群组 权限代号:r :读,用数字4表示w :写,用数字2表示x :执行, ...

  4. 经典矩阵快速幂之一-----poj3233(矩阵套矩阵

    题意:给你一个矩阵A,求S=A+A^2+A^3+...+A^k. 其实这个当时我看着毫无头绪,看了他们给的矩阵发现好!精!妙! 我们这样看 是不是有点思路! 没错!就是右上角,我们以此类推可以得到A+ ...

  5. JSON文件导入Unity3d中是空的的问题

    将Json文件的内容在网上在线的Json文件编辑器导出后再导入即可

  6. 01.Java 开发简单的计算器

    难度为一般,适合具有 Java 基础和 Swing 组件编程知识的用户学习一. 实验介绍1.1 实验内容本次实验利用Java开发一个可以进行简单的四则运算的图形化计算器,会使用到 Java Swing ...

  7. 2018.10.26 NOIP训练 数数树(换根dp)

    传送门 换根dpdpdp傻逼题好像不好码啊. 考虑直接把每一个二进制位拆开处理. 先dfsdfsdfs出每个点到1的异或距离. 然后分类讨论一波: 如果一个点如果当前二进制位到根节点异或距离为1,那么 ...

  8. react native项目的创建和运行

    1.创建项目 react-native init projectName 2.运行项目 在AndroidStudio上运行安卓模拟器 cd projectName react-native run-a ...

  9. VC调试小结

    本机调试F5: 开始调试Shift+F5: 停止调试F10: 调试到下一句,这里是单步跟踪 F11: 调试到下一句,跟进函数内部Shift+F11: 从当前函数中跳出F9: 设置(取消)断点Outpu ...

  10. HDMI中checksum计算法

    在AVI传输过程中有三个字节没有被传输.这是在HDMI1.4B中找到的前三个字节的数据. >> hex2dec('82') ans = 130 下图中的数据中在HDMI中接收到的一串数据, ...