Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jeremie0

Pages: [1] 2
1
Nevermind i fixed it, it was because you cannot create connectors with a element.Type notes

Now other problem, i cannot place the objects as i want even though i specified the positionX and positionY

Code: [Select]
                   EA.Collection diagramObjects = diagram.DiagramObjects;
                    EA.DiagramObject diagramObject = diagramObjects.AddNew(usecase.Name, "otDiagramLink");
                    diagramObject.ElementID = usecase.ElementID;
                    diagramObject.DiagramID = diagram.DiagramID;
                    usecaseguid = usecase.ElementGUID;

                    diagramObject.top = 200 + (75 * i);
                    diagramObject.left = 560;
                    diagramObject.right = 560 + 100;
                    diagramObject.bottom = 140 + (75 * i);

                    diagramObject.Update();
                    diagram.Update();
                    diagramObjects.Refresh();
                    i++;

                    usecase.Update();

2
Automation Interface, Add-Ins and Tools / Creating diagram connectors
« on: July 06, 2015, 06:07:03 pm »
Hi everybody,
I'm trying to create links from actors to usecases in a usecase diagram

The code works for the first usecase, but crashes on the second one...

Code: [Select]
EA.Connector connect = usecase.Connectors.AddNew("", "UseCase");
connect.ClientID = usecase.ElementID;
connect.SupplierID = actor.ElementID;

connect.Update();

i tried switch clientid and supplierid but no luck so far

anyone has a solution ?
thanks a lot

3
Automation Interface, Add-Ins and Tools / Re: ScenarioExtension
« on: October 03, 2014, 12:37:46 am »
i keep getting the error DAO.Recordset [3022]

4
Automation Interface, Add-Ins and Tools / Re: ScenarioExtension
« on: October 02, 2014, 10:50:34 pm »
Code: [Select]
foreach (ScenarioStep del in source.Steps)
                                            {

                                                    ScenarioStep ScenarioSteptarget = targetsteps.AddNew(del.Name, del.Level); // on copie les etapes du scenario qui ont été cochées

                                                    EA.Collection sourcexts = del.Extensions;


                                                    EA.Collection targexts = ScenarioSteptarget.Extensions;
                                                    foreach (ScenarioExtension sourcext in sourcexts)
                                                    {


                                                            EA.ScenarioExtension targext = ScenarioSteptarget.Extensions.AddNew(sourcext.Scenario.Name, sourcext.Scenario.Type);
                                                            targext.Join = sourcext.Scenario.ScenarioGUID;

                                                    }

                                                    ScenarioSteptarget.Update();
                                                    element2.Update();
                                                }

still not working but..why ?

5
Automation Interface, Add-Ins and Tools / Re: ScenarioExtension
« on: October 02, 2014, 07:01:48 pm »
how do i do that ?

6
Automation Interface, Add-Ins and Tools / Re: ScenarioExtension
« on: September 19, 2014, 01:00:35 am »
So how do I use the ScenarioExtension class ?

7
Automation Interface, Add-Ins and Tools / Re: ScenarioExtension
« on: September 18, 2014, 09:49:48 pm »
Code: [Select]
 foreach (Scenario source in element.Scenarios)
                                {
                                    EA.Scenario target = targets.AddNew(source.Name, source.Type);
foreach (ScenarioStep del in source.Steps)
                                            {
                                                ScenarioStep ScenarioSteptarget = targetsteps.AddNew(del.Name, del.Level); // on copie les etapes du scenario qui ont été cochées
                                                    ScenarioSteptarget.Update();
                                                    element2.Update();
                                                
                                            }
}

8
Automation Interface, Add-Ins and Tools / Re: ScenarioExtension
« on: September 18, 2014, 07:29:49 pm »
Actually it is more like
- new usecase
- new scenario
- copy steps from scenario source to scenario target

For now, the alternate scenario is copied but there are no joiningsteps

9
Automation Interface, Add-Ins and Tools / ScenarioExtension
« on: September 18, 2014, 06:33:38 pm »
Hi everyone,

I'm trying to copy the alternate scenarios of a usecase
I've already copied the basic path but i don't know how to use the ScenarioExtension class


10
i would say
that a connector is defined as a type (association for example), a clientID and a supplierID

if you know the elementID, just see if the element is the client or the supplier

in your example supplier would be A and client B

11
Automation Interface, Add-Ins and Tools / Re: Copy context references
« on: June 26, 2014, 11:03:15 pm »
yeah i get it, the assocations in the newly created usecase are those linked to the source usecase in the diagram

so do you have an idea
- to create an association in the new usecase ?
- or just to add the missing ones in the context references ?

12
Automation Interface, Add-Ins and Tools / Re: Copy context references
« on: June 26, 2014, 06:06:57 pm »
although it seems like there's a small problem
not all the actors in the context references are copied in the new use case
and i can't figure out why

any idea ?

13
Automation Interface, Add-Ins and Tools / Re: Copy context references
« on: June 26, 2014, 05:39:56 pm »
ok i figured where the problem was.
The supplierID is the elementID of the new element i created, not a copy of the old one

thanks qwerty for your help

Code: [Select]
foreach (EA.Connector ct in element.Connectors)
                                            {// ON CHERCHE A COPIER LES CONTEXT ITEMS, PAS LES CONNECTEURS
                                                EA.Connector con = (EA.Connector) element2.Connectors.AddNew("", ct.Type);
                                                con.ClientID = ct.ClientID; // <-- element2 est un package pas un element, trouver l'acteur id
                                                //string prov = Repository.GetConnectorByID(ct.ClientID).Name;

                                                con.SupplierID = a.ElementID;
                                                //prov = Repository.GetConnectorByID(ct.SupplierID).Name;

                                                try
                                                {
                                                    con.Update();
                                                }
                                                catch(Exception e)
                                                {
                                                    MessageBox.Show(e.Message);
                                                }
                                                    
                                            }

14
Automation Interface, Add-Ins and Tools / Re: Copy context references
« on: June 14, 2014, 01:00:03 am »
i basically have the same code, at least i think

Code: [Select]
EA.Diagram diagram = Repository.GetDiagramByID(droppedID);
EA.Package element2 = Repository.GetPackageByID(diagram.PackageID);

EA.Element a = element2.Elements.AddNew(element.Name, element.Type);


a.Name=a.Name.Replace(a.Name, a.Name + "_tmp");
element2.Elements.Refresh();
a.Update();
                                

EA.Collection targets = a.Scenarios;
 foreach (Scenario source in element.Scenarios)
                                {
                                    EA.Scenario target = targets.AddNew(source.Name, source.Type); //on cree un nouveau scenario du meme nom
                                    
                                    var form = new Form1();
                                    var checkedListBox1 = new CheckedListBox();
                                    form.Text = target.Name;

                                    targets.Refresh();
                                    EA.Collection targetsteps = target.Steps;
                                    EA.Collection cts = element.Connectors;
                                    EA.Collection ctstarget = element2.Connectors;
                                    int i = 0;
                                    foreach (ScenarioStep aaa in source.Steps)
                                    {
                                        form.checkedListBox1.Items.Add(aaa.Name);
                                        form.checkedListBox1.SetItemChecked(i, true);
                                        foreach (EA.Connector ct in cts)
                                        {
                                            EA.Connector con = (EA.Connector)ctstarget.AddNew("", ct.Type);
                                            con.SupplierID = ct.SupplierID;
                                            con.ClientID = ct.ClientID;
                                            if(!con.Update())
                                            {
                                                MessageBox.Show(con.GetLastError());
                                            }
                                        }
                                        ctstarget.Refresh();
                                        i++;
                                        element2.Update();
                                    }

anyway thanks for all your help i guess i'll find a workaround

15
Automation Interface, Add-Ins and Tools / Re: Copy context references
« on: June 13, 2014, 11:43:28 pm »
the code was missing the following instruction

Code: [Select]
conCopy.ClientID = con.ClientID;
now the error is gone, but still no context references in the new scenario

Pages: [1] 2