如何以编程方式更改 PowerDesigner 16 PDM 图中列的颜色
How to programmatically change the color of a column in a PowerDesigner 16 PDM diagram
我可以使用 VBA 遍历 table 的列并更改与 Column 对象本身相关的许多属性。我正在寻找的是更改 table 的 select 列的颜色,如 PDM 图表中显示的那样。可以从 UI 执行此操作,方法是在图表中单击 table 到 select 的列,然后右键单击以显示上下文菜单,然后 select 'Sub-Objects Format'.
这是一个示例,它使用一些任意标准在物理数据模型中用红色书写一些列,当它们的名称包含“b”时...使用 ObjectCompositeSymbol.SubObjects
属性。
option explicit
const workfont = "Arial,8,N,255,0,0"
dim diags: set diags = createobject("Scripting.Dictionary")
dim m : set m = activemodel
dim t
for each t in m.tables
' public name of subobjects: Column; 0: display all
dim sb : sb = "Column 0" + vbcrlf
dim c,some : some = false
for each c in t.columns
' our criteria is: column name contains a b
dim match : match = instr(lcase(c.name),"b") <> 0
if match then
sb = sb + "{"+ c.GetAttribute("ObjectID")+"} " + workfont + vbcrlf
some = true
end if
next
if not some then sb = ""
' apply subobjects coloring
dim s
for each s in t.symbols
if s.subobjects <> sb then
s.subobjects = sb
if not diags.exists(s.diagram) then diags.add s.diagram,0
end if
next
next
if diags.count > 0 then
dim d
for each d in diags.keys
output "... redraw "+d.name
d.RedrawAllViews
next
end if
我可以使用 VBA 遍历 table 的列并更改与 Column 对象本身相关的许多属性。我正在寻找的是更改 table 的 select 列的颜色,如 PDM 图表中显示的那样。可以从 UI 执行此操作,方法是在图表中单击 table 到 select 的列,然后右键单击以显示上下文菜单,然后 select 'Sub-Objects Format'.
这是一个示例,它使用一些任意标准在物理数据模型中用红色书写一些列,当它们的名称包含“b”时...使用 ObjectCompositeSymbol.SubObjects
属性。
option explicit
const workfont = "Arial,8,N,255,0,0"
dim diags: set diags = createobject("Scripting.Dictionary")
dim m : set m = activemodel
dim t
for each t in m.tables
' public name of subobjects: Column; 0: display all
dim sb : sb = "Column 0" + vbcrlf
dim c,some : some = false
for each c in t.columns
' our criteria is: column name contains a b
dim match : match = instr(lcase(c.name),"b") <> 0
if match then
sb = sb + "{"+ c.GetAttribute("ObjectID")+"} " + workfont + vbcrlf
some = true
end if
next
if not some then sb = ""
' apply subobjects coloring
dim s
for each s in t.symbols
if s.subobjects <> sb then
s.subobjects = sb
if not diags.exists(s.diagram) then diags.add s.diagram,0
end if
next
next
if diags.count > 0 then
dim d
for each d in diags.keys
output "... redraw "+d.name
d.RedrawAllViews
next
end if