Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: RobCDeJong on November 18, 2013, 08:18:09 pm
-
I want, via the EA object model API, to get all ports (or all elements) where an interfaceblock is the classifier of.
For an element, the classifierID is a property but I want to see which elements use a specific interface block. Is there a single API-call to get this information?
Cheers,
Rob
-
Hi,
there is no simple API to find the ports of an InterfaceBlock.
You may:
- Iterate over all ports
- use SQL
Helmut
-
Try
Repository.SQLQuery ("SELECT * FROM t_object as o1, t_object as o2 WHERE o1.object_type = "Port" AND o2.object_type = "Interface" AND o1.PDATA1 = o2.ea_guid AND o2.object_id = <theid>")where <theid> is the ObjectID of the interface.
q.
-
Thank you, that helped!
@qwerty, i revised the code a bit to the snippet below. This because the object_type for a InterfaceBlock is a Class and because the object_id is a unique id it is not needed to give a good answer.
SELECT * FROM t_object as o1, t_object as o2 WHERE o1.object_type = "Port" AND o1.PDATA1 = o2.ea_guid AND o2.object_id = <id>