代码如下:
Option Explicit ‘------------------------------------------------------------------------------- ‘作用:PowerDesigner物理模型复制name到comment ‘ ‘作者: Lio5n ‘时间: 2015-12-18 ‘ ‘版本: V1.0 ‘ ‘说明:如果comment有值,不会覆盖;可以重复执行,不会多次复制 ‘------------------------------------------------------------------------------- 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 "当前模型不是物理模型!" Else ProcessFolder mdl msgbox "执行完成!" End If ‘复制 name 到 comment 的函数 Private sub ProcessFolder(folder) Dim Tab ‘表处理 for each Tab in folder.tables if not tab.isShortcut then if left(trim(tab.comment),len(trim(tab.name ))) <> trim(tab.name) then tab.comment = trim(tab.name) + " " + trim(tab.comment) tab.comment = trim(tab.comment) end if Dim col ‘字段处理 for each col in tab.columns if left(trim(col.comment),len(trim(col.name ))) <> trim(col.name) then col.comment= trim(col.name) + " " + trim(col.comment) col.comment= trim(col.comment) end if next end if next Dim view ‘视图处理 for each view in folder.Views if not view.isShortcut then if left(trim(view.comment),len(trim(view.name ))) <> trim(view.name) then view.comment = trim(view.name) + " " + trim(view.comment) view.comment = trim(view.comment) end if end if next ‘进入子floder Dim f ‘子folder For Each f In folder.Packages if not f.IsShortcut then ProcessFolder f end if Next end sub
时间: 2024-10-11 18:23:43