powerDesign经验谈(2)-注释、名称互转

2023-10-19 14:37

本文主要是介绍powerDesign经验谈(2)-注释、名称互转,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

    • 1. 注释转名称comment2name
    • 2. 注释转名称name2conmment

powerdesigner的常用操作:

在实际的工作中经常会用到将“注释和name”互转,具体如下:

  1. 菜单运行: Tools --> Execute Commads -->Edit/Run Script…

1. 注释转名称comment2name

'1、注释转名称(包含表名、视图名)
Option   Explicit 
ValidationMode   =   True 
InteractiveMode   =   im_BatchDim   mdl   '   the   current   model
'   get   the   current   active   model 
Set   mdl   =   ActiveModel 
If   (mdl   Is   Nothing)   Then MsgBox   "There   is   no   current   Model " 
ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then MsgBox   "The   current   model   is   not   an   Physical   Data   model. " 
Else ProcessFolder   mdl 
End   If
Private   sub   ProcessFolder(folder) 
On Error Resume NextDim   Tab   'running     table for   each   Tab   in   folder.tables if   not   tab.isShortcut   then tab.name   =   tab.commentDim   col   '   running   column for   each   col   in   tab.columns if col.comment="" thenelsecol.name=   col.comment end ifnext end   if nextDim   view   'running   view for   each   view   in   folder.Views if   not   view.isShortcut   then view.name   =   view.comment end   if next'   go   into   the   sub-packages Dim   f   '   running   folder For   Each   f   In   folder.Packages if   not   f.IsShortcut   then ProcessFolder   f end   if Next 
end   sub
'1、注释转名称(包含仅字段名)
Option   Explicit 
ValidationMode   =   True 
InteractiveMode   =   im_BatchDim   mdl   '   the   current   model
'   get   the   current   active   model 
Set   mdl   =   ActiveModel 
If   (mdl   Is   Nothing)   Then MsgBox   "There   is   no   current   Model " 
ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then MsgBox   "The   current   model   is   not   an   Physical   Data   model. " 
Else ProcessFolder   mdl 
End   If
Private   sub   ProcessFolder(folder) 
On Error Resume NextDim   Tab   'running     table for   each   Tab   in   folder.tables if   not   tab.isShortcut   thenDim   col   '   running   column for   each   col   in   tab.columns if col.comment="" thenelsecol.name=   col.comment end ifnext end   if next'   go   into   the   sub-packages Dim   f   '   running   folder For   Each   f   In   folder.Packages if   not   f.IsShortcut   then ProcessFolder   f end   if Next 
end   sub

2. 注释转名称name2conmment

'******************************************************************************  
'* File:   name2comment.vbs  
'* Title:  Name to Comment Conversion  
'* Model:  Physical Data Model  
'* Objects: Table, Column, View  
'* Author: steveguoshao  
'* Created: 2013-11-29  
'* Mod By:   
'* Modified: 
'* Version: 1.0  
'* Memo:   Modify from name2code.vbs  
'******************************************************************************  Option Explicit 
ValidationMode = True 
InteractiveMode = im_Batch  Dim mdl ' the current model  ' get the current active model 
Set mdl = ActiveModel 
If (mdl Is Nothing) Then MsgBox "There is no current Model " 
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then MsgBox "The current model is not an Physical Data model. " 
Else ProcessFolder mdl 
End If  ' This routine copy name into comment for each table, each column and each view 
' of the current folder 
Private sub ProcessFolder(folder) Dim Tab 'running   table for each Tab in folder.tables if not tab.isShortcut then tab.comment = tab.name Dim col ' running column for each col in tab.columns col.comment= col.name next end if next  Dim view 'running view for each view in folder.Views if not view.isShortcut then view.comment = view.name end if next  ' go into the sub-packages Dim f ' running folder For Each f In folder.Packages if not f.IsShortcut then ProcessFolder f end if Next 
end sub  

这篇关于powerDesign经验谈(2)-注释、名称互转的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/240442

相关文章

idea中创建新类时自动添加注释的实现

《idea中创建新类时自动添加注释的实现》在每次使用idea创建一个新类时,过了一段时间发现看不懂这个类是用来干嘛的,为了解决这个问题,我们可以设置在创建一个新类时自动添加注释,帮助我们理解这个类的用... 目录前言:详细操作:步骤一:点击上方的 文件(File),点击&nbmyHIgsp;设置(Setti

Python实现PDF与多种图片格式之间互转(PNG, JPG, BMP, EMF, SVG)

《Python实现PDF与多种图片格式之间互转(PNG,JPG,BMP,EMF,SVG)》PDF和图片是我们日常生活和工作中常用的文件格式,有时候,我们可能需要将PDF和图片进行格式互转来满足... 目录一、介绍二、安装python库三、Python实现多种图片格式转PDF1、单张图片转换为PDF2、多张图

Python中的输入输出与注释教程

《Python中的输入输出与注释教程》:本文主要介绍Python中的输入输出与注释教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、print 输出功能1. 基础用法2. 多参数输出3. 格式化输出4. 换行控制二、input 输入功能1. 基础用法2. 类

Rust中的注释使用解读

《Rust中的注释使用解读》本文介绍了Rust中的行注释、块注释和文档注释的使用方法,通过示例展示了如何在实际代码中应用这些注释,以提高代码的可读性和可维护性... 目录Rust 中的注释使用指南1. 行注释示例:行注释2. 块注释示例:块注释3. 文档注释示例:文档注释4. 综合示例总结Rust 中的注释

使用Python实现PDF与SVG互转

《使用Python实现PDF与SVG互转》SVG(可缩放矢量图形)和PDF(便携式文档格式)是两种常见且广泛使用的文件格式,本文将详细介绍如何使用Python实现SVG和PDF之间的相互转... 目录使用工具使用python将SVG转换为PDF使用Python将SVG添加到现有PDF中使用Python将PD

Java实现Excel与HTML互转

《Java实现Excel与HTML互转》Excel是一种电子表格格式,而HTM则是一种用于创建网页的标记语言,虽然两者在用途上存在差异,但有时我们需要将数据从一种格式转换为另一种格式,下面我们就来看看... Excel是一种电子表格格式,广泛用于数据处理和分析,而HTM则是一种用于创建网页的标记语言。虽然两

C#实现获得某个枚举的所有名称

《C#实现获得某个枚举的所有名称》这篇文章主要为大家详细介绍了C#如何实现获得某个枚举的所有名称,文中的示例代码讲解详细,具有一定的借鉴价值,有需要的小伙伴可以参考一下... C#中获得某个枚举的所有名称using System;using System.Collections.Generic;usi

SSID究竟是什么? WiFi网络名称及工作方式解析

《SSID究竟是什么?WiFi网络名称及工作方式解析》SID可以看作是无线网络的名称,类似于有线网络中的网络名称或者路由器的名称,在无线网络中,设备通过SSID来识别和连接到特定的无线网络... 当提到 Wi-Fi 网络时,就避不开「SSID」这个术语。简单来说,SSID 就是 Wi-Fi 网络的名称。比如

vscode中文乱码问题,注释,终端,调试乱码一劳永逸版

忘记咋回事突然出现了乱码问题,很多方法都试了,注释乱码解决了,终端又乱码,调试窗口也乱码,最后经过本人不懈努力,终于全部解决了,现在分享给大家我的方法。 乱码的原因是各个地方用的编码格式不统一,所以把他们设成统一的utf8. 1.电脑的编码格式 开始-设置-时间和语言-语言和区域 管理语言设置-更改系统区域设置-勾选Bata版:使用utf8-确定-然后按指示重启 2.vscode

在 Qt Creator 中,输入 /** 并按下Enter可以自动生成 Doxygen 风格的注释

在 Qt Creator 中,当你输入 /** 时,确实会自动补全标准的 Doxygen 风格注释。这是因为 Qt Creator 支持 Doxygen 以及类似的文档注释风格,并且提供了代码自动补全功能。 以下是如何在 Qt Creator 中使用和显示这些注释标记的步骤: 1. 自动补全 Doxygen 风格注释 在 Qt Creator 中,你可以这样操作: 在你的代码中,将光标放在