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 - rchalleray

Pages: [1]
1
Hi Geert

I think my question is a bit different.

I am actually add to this document and not working on elements pre-existing in the diagram.

My question was specifically related as to how I can traverse relationships within the model with the object of adding the traversed elements to the diagram. That is the crux of the question.

There was a secondary question as well in point (7) which was not addressed.

Once again, I hope I am not being presumptuous in seeking these clarifications but I need some guidance and shall be most grateful for your guidance on this matter.

Cheers
Rob

2
Hi

I am trying to write a Javascript that will do the following.
1.   The function that receives as an input two parameters as an input:
        (a)   An EA element (This will be a nested XSD element and shall contain other nested elements).
        (b)   A diagram element (This is a pre-existing diagram that we will be passing to the function. The intention is that this diagram will be updated with elements based on the logical processing that is engendered within this function.


2.   Basically, what this function will do is in effect find all the nested associations that are related to the element.

3.   For example, let’s say that we have an element “A” which has “association relations” with element “B”, “C” and “D”. “B” has associations with elements B1, B2 & B3.  “B1” has further associations with “B11”, “B12” and “B13”.


4.   Basically when I pass the element “A” to the function, I want the script to parse through A and highlight all the relationships mentioned above i.e. “A’s” relationships with “B”, “C” & “D”. Similarly I want to visualize the relationships of B, B1 & B11 (referred to above).

5.   Basically, what I am trying to achieve already exists within EA but I am trying to automate it. Basically, if you create a SysML block diagram and you insert a complex type into it and you do “insert related Elements” and specify a depth of “3” (which is possible when you are doing the insert related elements operation) then EA will list all the elements out as I have explained above. My objective is simply to achieve this.

6.   I shall greatly appreciate if I can receive some guidance. I am not exactly sure as to what is the optimal way to parse the tree structure such that each of these elements can be appended to the diagram that I am appending to the diagram

A ---------> B --------->B1----------> B11
  |                                 |------------> B12
  |                                 |------------> B13
  |                                B2 -----------> B21
  |                                 |-------------> B22
  |                                 |-------------> B23
  |                                B3 -----------> B31
  |                                 |-------------> B32
  |                                 |-------------> B33
  |--------->C ---------> C1---------> C11
  |                               |------------> C12
  |                               |------------> C13
  |                             C2 ----------> C21
  |                               |------------> C22
  |                               |------------> C23
  |                               C3 ----------> C31
  |                               |------------> C32
  |                                |------------> C33
  |--------->D ---------->D1 ---------> D11
                                    |------------> D12
                                    |------------> D13


7.   There is one further thing that I would like to do. Note that the arrows shown above are the relationship. Based on the type of relationship I would like to use a different font colour and different background colour for the box corresponding to these elements (like blue for associations, red for dependency). If you could help me figure out how I can do this additional step then it would be greatly appreciated.

I look forward to receive some concrete guidance. Just referring to the API reference definitions did not help but I need to go through some script command examples in order to understand how it can be usually done.

Cheers
Rob
             

3
Hi Geert

Thank you for your kind response.

By the way, we missed you on the 24th of May 2022 in Reading. I heard that you could not make it because of the ID card issues after Brexit.

I was really looking forward to listening to your presentation. It came highly recommended by a colleague.

I look forward to speaking to you someday.

Regards
Rob

4
Respected Sirs,

I would like to write a JavaScript function that does the following:
1.   it accepts 2 inputs namely
(a)   A diagram (that was created in the main programme)
(b)   An EA element (that already exists in the model)
the objective of the function would be to simply add the elements to the diagram (i.e. which was cost to the JavaScript function in question).

I have written the following script but I'm getting an error in execution

function add_element_dia(input_element, theDiagram)
 {
      // Add the element to the diagram
      var diagramObjects as EA.Collection;
      var testDiagram as EA.Diagram
      testDiagram = theDiagram;
      diagramObjects=testDiagram.DiagramObjects; // Error Occurs here
   
      var testDiagramObject as EA.DiagramObject;
      testDiagramObject = theDiagram.DiagramObjects.AddNew( "l=200;r=400;t=200;b=600;", "" );
      testDiagramObject.ElementID = input_element.ElementID;
      testDiagramObject.Update();   
 }

Can anyone direct me to a previous thread that can explain clearly what I'm trying to do (ie referring to the objectives mentioned above) or alternatively if they can comment on my script clarifying what I'm doing wrong then that would be most appreciated.
if my question is unclear in any aspect then please feel free to seek any clarification.

I look forward to a prompt clarification on this topic

Best regards
Rob

5
Hi Eve

Thank you for your brilliant clarification.

May I wish you a brilliant day! Thanks a million!

Best regards
Rob

6
While I am debugging a script that I wrote. I am unable to use the "Display variable" function in order to visualize specific variables that are of interest to me during the debug session.

Being able to visualize the variable during the debugging would be very useful. Do you have any recommendations as to why this is happening?

I want to highlight that I was able to use this functionality before and then it suddenly stopped.

Here is a screenshot of the debug window if this helps:
[628170949]      Stack recording threshold set to 3 frames
[628171013]      Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[628171013]      Agent dll found: C:\Program Files (x86)\Sparx Systems\EA\SScript.dll
[628171013]      Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[628171014]      Agent: Started
[628171275]      dbg.enabled=undefined
[628171277]      vea.hit =function hit() {
[628171277]          [native code]
[628171277]      }
[628171277]      compiling script for url: C:\Users\chatt\AppData\Local\Temp\2C66BFAA-1D86-4e06-80A8-D4BA8B7531C5.js
[628171282]      compiling script for url: C:\Users\chatt\AppData\Local\Temp\3FBFB686-E6FE-433b-8500-023A28CAA601.js
[628171282]      Breakpoint bound! name:EAModel1.RCHMDv2, line:147

Can someone explain as to why the debugger suddenly stopped the ability to be able to visualize the display variables?

Best regards
Rob

7
Good morning

I want to create a diagram which is a SysML Block diagram.

I used the following code (based on the information that is out there in the web):

  var XSD_DM_Diagram as EA.Diagram;
XSD_DM_Diagram = root_IE.Diagrams.AddNew(root_IE.Name, "SysML1.5::Block");
XSD_DM_Diagram.Notes = "Test diagram created by the ManageDiagramsExample script";
XSD_DM_Diagram.Update();

The problem is that EA is always simply creating a "UML class diagram" for me instead of the SysML block diagram (which is the intention).

Can you clarify why this is? What error am I doing wrong? What parameters should I pass to the  root_IE.Diagrams.AddNew so that it will create a SysML Block diagram instead of the default UML class diagram?

I shall be most grateful for your clarification.

Program Version: 16.0.1604 (Build: 1604) - 32 bit [Version that is being used by me]

Can someone please provide a clarification and direct me to additional scripts (concerning how Javascript can be used to automate diagram creation). I am looking for more scripts in addition to the example scripts already provided by EA in the script library.

Best regards
Rob

Pages: [1]