Author Topic: Problems while trying to combine two components  (Read 6303 times)

Kikai_no_Tenshi

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Problems while trying to combine two components
« on: March 20, 2007, 01:58:27 am »
Hello!

I am trying to combine two components into one.

Therefore I want to overwrite the values of all diagramlinks which are connected to the first component with the values of the second component.

But after changing the values and calling the dl.update function, the program just stops.

The script runs through the for-loop and calls the dl.update function without problems but after accessing the if function the dl.update function is not called and the program stops.

does anyone know how to solve that problem? ???

Set d = Repository.GetDiagramByID(id_dia2)

i = 0

For Each dl In d.DiagramLinks

  For k = 0 To d.DiagramLinks.Count - 1

     If dl.ConnectorID = connector_dl(k) Then

        dl.Path = path_dl(i)
        dl.Geometry = geometry_dl(i)
        dl.ConnectorID = id2_con(i)
        dl.DiagramID = diagram_dl(i)

        dl.Update

        Repository.ReloadDiagram (id_dia2)

     End If

  Next

  i = i + 1

Next
« Last Edit: March 20, 2007, 02:00:13 am by Kikai_no_Tenshi »

thomaskilian

  • Guest
Re: Problems while trying to combine two component
« Reply #1 on: March 20, 2007, 02:16:05 am »
Hard to tell, but the values you assign might be nonsense (and cause EA to trap). Try an On Error and have a look at the values you are assigning. Maybe you first try a *save* change to the connectors, like adding a suffix to the name. Then do the next step...
« Last Edit: March 20, 2007, 02:17:32 am by thomaskilian »

Kikai_no_Tenshi

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Problems while trying to combine two component
« Reply #2 on: March 20, 2007, 02:41:02 am »
The values are all correct, I checked them with msgboxes (but deleted them in my code above)

There is more code in my program (330 lines) but I am just posting the code for overwriting the diagramlinks, because the rest works very well.

i have two funktions, one for selecting a component and writing all values in arrays and one for overwriting the second component.

Here is the code of the first function, for writing the values into the arrays.

The values are assigned as following:

Set d = Repository.GetDiagramByID(id_dia2)

i = 0

For Each dl In d.DiagramLinks

  For k = 0 To d.DiagramLinks.Count - 1

     If dl.ConnectorID = id_con(k) Then

        path_dl(i) = dl.Path
        geometry_dl(i) = dl.Geometry
        diagram_dl(i) = dl.DiagramID
        connector_dl(i) = dl.ConnectorID

     End If

  Next

  i = i + 1

Next


i hope this helps  :-[
« Last Edit: March 20, 2007, 02:41:20 am by Kikai_no_Tenshi »

thomaskilian

  • Guest
Re: Problems while trying to combine two component
« Reply #3 on: March 20, 2007, 05:38:54 am »
I'm sorry that I don't have the time to verify this, but it looks odd that you change the diagramid. Looks like a change to the primary key ???

Kikai_no_Tenshi

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Problems while trying to combine two component
« Reply #4 on: March 20, 2007, 05:59:15 am »
you are right, it's not neccessary to change the diagramid, because it isn't changing (diagramid = 491 the whole time) but even if i comment those lines out, it stops at the line where the program should do the update  :-/

thomaskilian

  • Guest
Re: Problems while trying to combine two component
« Reply #5 on: March 20, 2007, 10:44:43 am »
I see. Have you tried a simple, simple case: grip one link, change a simple attribute and save the changes? If that doesn't work, I would be as clueless as you and thinking about a bug report...

Kikai_no_Tenshi

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Problems while trying to combine two component
« Reply #6 on: March 21, 2007, 02:14:26 am »
That was a hot hint!

I tried to change the path-value of the diagramlink of an other existing connector and it's working.

While trying to change the path-value of the diagramlink of the created connector, I realised that they don't have an own diagramlink  :-/

But I thought that the diagramlink is the graphical appearance on the screen, so they MUST have a diagramlink, or am I wrong? ???

I also tried to create new diagramlinks with d.diagramlinks.addnew() but I don't know what to put into the parameter (). And I haven't found anything in this forum about that.

I am clueless now :-[

edit: forgot to say, yes the connectors and the diagrams are updated everytime a change is done on them.
« Last Edit: March 21, 2007, 02:23:34 am by Kikai_no_Tenshi »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problems while trying to combine two component
« Reply #7 on: March 21, 2007, 02:34:30 am »
Quote
While trying to change the path-value of the diagramlink of the created connector, I realised that they don't have an own diagramlink  :-/
Hi Kikai,

What version are you running?

Until very recently, it was EXACTLY possible that you could have a diagram edge which did NOT have an equivalent t_diagramlinks entry.

This was one of the defects Sparx finally fixed with version 804.

It should now be the case that for each formal edge between two vertexes in a diagram should have an equivalent t_diagramlinks entry.

You can check the database with a few simple SQL queries.

HTH.
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Kikai_no_Tenshi

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Problems while trying to combine two component
« Reply #8 on: March 21, 2007, 02:42:11 am »
I am running build 803.

I am sorry but I don't know SQL... :-[

So is it possible to change the diagramlink values of a connector which has been created in that procedure?

I haven't been working with a t_diagramlinks entry yet, what is that exactly?

thomaskilian

  • Guest
Re: Problems while trying to combine two component
« Reply #9 on: March 21, 2007, 03:51:00 am »
You could try to run Tools/Data Management/Project Integrity Check

Kikai_no_Tenshi

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Problems while trying to combine two component
« Reply #10 on: March 21, 2007, 05:18:19 am »
OK I have run the integrity check and he found 5 connector problems. EA has cleaned it but the thing with the diagramlinks won't work.

I can change all values of the diagramlink and update it without problems, but if I change the connectorid value of the diagramlink, he skips the update and just breaks out of the procedure without a failure message.

I think i have to add a new diagram link for each connector I add to the diagram (and the graphical interface) but how can I do it?

There is no information in the user guide about adding diagramlinks and here in the forum there are no hints how to do it.

If I try diagram.diagramlinks.addnew() it says that the parameter is not optional. I have to give it a name and a type. A name would be no problem, but which type can i choose?

thomaskilian

  • Guest
Re: Problems while trying to combine two component
« Reply #11 on: March 21, 2007, 07:53:47 am »
If noone else can take this, you will have to wait for Simon.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Problems while trying to combine two component
« Reply #12 on: March 21, 2007, 01:16:12 pm »
Well, the automation interface isn't my speciality, but I've had a look and it appears that the parameters to AddNew for diagram links will be ignored.  So I'd try just passing in two empty strings.
« Last Edit: March 21, 2007, 01:16:32 pm by simonm »

Kikai_no_Tenshi

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Problems while trying to combine two component
« Reply #13 on: March 22, 2007, 02:27:16 am »
yeah it's working! ;D

Thank you very very much for your help @all!!! :)