Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PowerDesigner 表结构和字段大小写转换
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' 当前模型
' 获取当前模型
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "没有打开一个模型"
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "当前模型不是一个PDM"
ProcessFolder mdl
End If
Private sub ProcessFolder(folder)
Dim Tab '要处理的表
for each Tab in folder.Tables
' if not Tab.isShortcut then
' Tab.code =
'表名处理,前边添加前缀,字母小写 LCase(
Tab.code= LCase(Tab.code)
Dim col ' 要处理的列
for each col in Tab.columns
'列名称和code全部小写,大写UCase 小写LCase
col.code= LCase(col.code) LCase(
'end if
' 处理视图
' Dim view 'running view
' for each view in folder.Views
' if not view.isShortcut then
' view.code =
' end if
' next
' 递归进入 sub-packages
Dim f ' sub folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
end sub
' 执行脚本从菜单打开:Tools – Excute Commands – Edit/Run Script 或快捷键 Ctrl+Shift+X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment