Book a Demo

Author Topic: Get ports classified by an interface block  (Read 4945 times)

RobCDeJong

  • EA User
  • **
  • Posts: 29
  • Karma: +4/-0
    • View Profile
    • Soltegro site
Get ports classified by an interface block
« 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

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Get ports classified by an interface block
« Reply #1 on: November 18, 2013, 09:33:27 pm »
Hi,

there is no simple API to find the ports of an InterfaceBlock.

You may:
- Iterate over all ports
- use SQL

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Get ports classified by an interface block
« Reply #2 on: November 18, 2013, 10:23:06 pm »
Try
Code: [Select]
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.

RobCDeJong

  • EA User
  • **
  • Posts: 29
  • Karma: +4/-0
    • View Profile
    • Soltegro site
Re: Get ports classified by an interface block
« Reply #3 on: November 19, 2013, 12:01:13 am »
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.
Code: [Select]
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>