Author Topic: Is there a document that lists ObjectType (win32com API)  (Read 473 times)

keesbghs

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Is there a document that lists ObjectType (win32com API)
« on: May 09, 2025, 11:28:45 pm »
I'm trying to write some Python code using the win32com api. Many time I get a `COMObject` with an `ObjectType` attribute. For example a `Repository` has `ObjectType` 2, `Package` had `ObjectType` 5.

Is there a document somewhere that lists all the object types?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Is there a document that lists ObjectType (win32com API)
« Reply #1 on: May 10, 2025, 04:59:10 pm »
They are defined here: https://sparxsystems.com/enterprise_architect_user_guide/17.1/add-ins___scripting/objecttypeenum.html

This enum is also exposed, so in python you should be able to use it (IIRC)
You can find the actual values in the EA-Constants scripts in your "Local Scripts"

Code: [Select]
otNone = 0
otProject = 1
otRepository = 2
otCollection = 3
otElement = 4
otPackage = 5
otModel = 6
otConnector = 7
otDiagram = 8
otRequirement = 9
otScenario = 10
otConstraint = 11
otTaggedValue = 12
otFile = 13
otEffort = 14
otMetric = 15
otIssue = 16
otRisk = 17
otTest = 18
otDiagramObject = 19
otDiagramLink = 20
otResource = 21
otConnectorEnd = 22
otAttribute = 23
otMethod = 24
otParameter = 25
otClient = 26
otAuthor = 27
otDatatype = 28
otStereotype = 29
otTask = 30
otTerm = 31
otProjectIssues = 32
otAttributeConstraint = 33
otAttributeTag = 34
otMethodConstraint = 35
otMethodTag = 36
otConnectorConstraint = 37
otConnectorTag = 38
otProjectResource = 39
otReference = 40
otRoleTag = 41
otCustomProperty = 42
otPartition = 43
otTransition = 44
otEventProperty = 45
otEventProperties = 46
otPropertyType = 47
otProperties = 48
otProperty = 49
otSwimlaneDef = 50
otSwimlanes = 51
otSwimlane = 52
otModelWatcher = 53
otScenarioStep = 54
otScenarioExtension = 55
otParamTag = 56
otProjectRole = 57
otDocumentGenerator = 58
otMailInterface = 59

Geert

keesbghs

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Is there a document that lists ObjectType (win32com API)
« Reply #2 on: May 12, 2025, 06:05:11 pm »
Thanks Geert. I did see that objecttypeenum.html, I see the enum, but the items are sorted alphabetically and they don't have associated numeric values.

You mention "Local Scripts". Is that part of some installation? I don't have that in my EA v16.1

BTW the HTML markup of the documentation is pretty bad. Why is there so much white space? Why don't they use better (non-proportional) fonts for code examples. It hurts my eyes.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Is there a document that lists ObjectType (win32com API)
« Reply #3 on: May 12, 2025, 06:30:37 pm »
Thanks Geert. I did see that objecttypeenum.html, I see the enum, but the items are sorted alphabetically and they don't have associated numeric values.

You mention "Local Scripts". Is that part of some installation? I don't have that in my EA v16.1
You normally don't need the numeric values as you should be able to use the enumeration directly.

Local script is a scriptgroup that is included in the installation. If you open up the script library you should be able to see it. (Specialize | Scripting | Script Library)
These script are actually read from a folder in your installation folder: C:\Program Files\Sparx Systems\EA\Scripts

You need a corporate license or above to use scripts in EA, but the scripts folder should always be there.

Geert

keesbghs

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Is there a document that lists ObjectType (win32com API)
« Reply #4 on: May 12, 2025, 07:16:21 pm »
Thanks, I found the enum values in the EAConstants-*.* files.

These values are not available in Python, at least, not to my knowledge. Unless there is a win32com API trick, which I'm not aware of.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Is there a document that lists ObjectType (win32com API)
« Reply #5 on: May 12, 2025, 07:52:31 pm »
In C# I can do something like
myVariable == global::EA.EAEditionTypes.piLite
where EA.EAEditionTypes is the enum. So I don't need to know the actual numeric value.

Since Python is relatively new I assumed there was a similar way to access COM accessible enumerations.
But I guess I assumed wrong.

Geert