Skip to Content
1

Change display name object MOO diagramme

May 03 at 02:56 PM

80

avatar image

Hi,

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.

Exemple:

Class:

Non abstract Class: IDbCommand

Abstract Class: IdbCommand


Operations:

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?

Thanks,

12.png (75.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Phillip Lam
May 11 at 09:31 PM
0

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 tbl.name="Table_1" Then
'TabSymbol.FillColor=Cstr(RGB(20, 120, 100))
'TabSymbol.FontList= TabFonts
'Else
'TabSymol.FillColor=Cstr(RGB(200,100,20))
'End If

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

'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
Else
TabSymbol.SubObjects = TabSymbol.SubObjects & vbCrLf & col.ObjectID & ColumnFonts
End If
Next
Next
Next

ActiveDiagram.RedrawAllViews()

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks Phillip !

0
Ondrej Divis May 03 at 08:59 PM
0

Hi,

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.

HTH,

Ondrej

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


                            

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Ondrej, I am Camilo's colleague who rised the question first.

I used Visual Paradigm before but I am farrelly new to Power AMC. I am currently trying to find how to access the output of a class. As well, I can't see the Object ID of the Version Info tab in Attribute Properties. I will keep looking deeper into this. I am asking here in case I can get an answer faster.

Thank you for your answer.

Samuel

0

Hi, you can find out ObjectID of all your attributes (operations, etc.) your object by displaying it in the output window. For example:

For each ca in c.attributes
  output ca.ObjectID
Next
0

the Object ID appears in the Version Info tab because Ondřej has turned on Debug mode - hmm, must track down my note, which tells me how to turn on debug mode :)

0