Skip to Content

Change display name object MOO diagramme


In a MOO we have some class and operations “abstract” (objet properties). We want identify easy this information in the diagramme, for this we want change the display object (name). So if the class is abstract we want that her name loks “cursive”, the same for the Class Operations.



Non abstract Class: IDbCommand

Abstract Class: IdbCommand


Non abstract Operation: get _command text (): string

Abstract Operation: get _command text (): string

Do you have any recommendation? Have we to create a file extension?


12.png (75.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    May 11, 2018 at 09:31 PM

    This is code sample for resetting fond, color.

    ' Create a PDM with table called Table_1. Add some columns. set one of them to be primary key.

    Option Explicit

    Dim tbl, TabSymbol, col, TabFonts,ColumnFonts, PrimaryKeyFonts

    'Set font for a table name
    'Set font for a column in the table. The color setting is 250,50,150
    TabFonts ="DISPNAME "+CStr(RGB(250,0,0))+" Arial,12 N"
    ColumnFonts=" Arial,8,B,250,50,150"
    PrimaryKeyFonts=" Harrington,8,B,250,250,150"

    'Traverse the whole PDM diagram. Set font for each table
    ' Traverse each table's symbol setting
    'Initialize each table's SubObject(Column font).
    For Each tbl In Activemodel.Tables
    For Each TabSymbol In tbl.symbols
    TabSymbol.SubObjects =""
    ' Set font and color for each table.
    'If"Table_1" Then
    'TabSymbol.FillColor=Cstr(RGB(20, 120, 100))
    'TabSymbol.FontList= TabFonts
    'End If

    'Table background color
    TabSymbol.FillColor=Cstr(RGB(0, 100, 0))

    'Set column font
    For Each col In tbl.Columns
    'Again initialize sub object.Just give it a name
    If TabSymbol.SubObjects = "" Then
    TabSymbol.Subobjects ="Column Font "
    End If

    'If a column is a primary key, set to different font
    If col.Primary=True Then
    TabSymbol.SubObjects = TabSymbol.SubObjects & vbCrLf & col.ObjectID & PrimaryKeyFonts
    TabSymbol.SubObjects = TabSymbol.SubObjects & vbCrLf & col.ObjectID & ColumnFonts
    End If


    Add comment
    10|10000 characters needed characters exceeded

  • May 03, 2018 at 08:59 PM


    I am afraid, that you`ll have to create your own script, which will modify appropriate properties of class symbol. If you need to modify the format of class name (based on the Abstract property for instance), you will have to modify the FontList property of the classSymbol object of your class. See QDNM row in my output window. There is "I" at the end of the row, which means, that qualified name of the object is displayed in Italic. The bad news here is that FontList property contains unstructured text, so best approach here is IMHO using regular expression to find appropriate row in FontList property and modify it according to your needs.

    Regarding the class attributes (operations, etc.), the situation is even a little bit more complicated. As you can see from my screenshot, there are 4 attributes in the class, but only 3 of them are displayed in the output window. It means, that when the format of the attribute in the class symbol is set to default, it is not present in the SubObjects property at all! So your script will have to first find out, whether the format of your attribute is modified (=its object ID will be present in the SubObjects property), and you can use regular expression to modify it. If the attribute format will be in default, you will have to add it manually to the SubObjects property. It is a very nasty way how to achieve your goal, but I am afraid, that it is the only one.

    After you are done, you can put this algorithm to the class event handler for instance, which will make sure, that the formatting changes automatically each time, you make change in your object. Please see the code from my screenshot below, so you can better get to the properties desired.



    For each c in activemodel.classes
      For each ca in c.attributes
        output ca.Name 
      output "----"
      For each cs in c.Symbols
        output cs.FontList
        output "----"
        output cs.SubObjects


    Add comment
    10|10000 characters needed characters exceeded