Book a Demo

Author Topic: Script: link elements  (Read 3806 times)

andrev

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Script: link elements
« on: August 29, 2017, 03:39:42 am »
Hi guys,

I'm doing some scripting to train and would like to know how to create connections between elements with script, could someone give me a way?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Script: link elements
« Reply #1 on: August 29, 2017, 04:05:41 am »
Code: [Select]
connector = element1.Connectors.AddNew ("", "Dependency");
connector.SupplierID = element2.ElementID;
connector.Update ();

will add a dependency relation between element1 and element2. It will not show immediately. So either you close/reopen the diagram or you issue

Code: [Select]
Repository.ReloadDiagram (diagram.DiagramID)
q.

andrev

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Script: link elements
« Reply #2 on: August 29, 2017, 04:07:25 am »
THANKS GUY, I LOV U