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

Pages: [1] 2
1
I want to avoid iterating through my model using API calls and speed up my app using DB queries.
I should have looked further in the documentation to find the correct table, I was too quick in my conclusions.
Thanks for putting me on the right track!
Joost

2
I have a ConstraintBlock, if I show its properties in the GUI, I find a non-empty list of Constraints.
Because Constraints is a Collection under Attributes, I'm looking in t_attribute. Maybe I'm mislead?

3
I have a small question, it is really a mystery for me:
Why would a simple query like "select * from t_attribute" return an empty result?
Selecting from t_object works normally.
Thanks!

4
A new concept for a newbie: shape scripts ;)
Thank you both for pointing me to this!

Another option I have (if I do not succeed with these shape scripts) is to kind of live with it, but then I need to find the size of the resulting DiagramObject for controlling the total layout. It seems though to me that the database (t_DiagramObjects) is not aware of what is drawn extra in the shape script. For example the height (difference between bottom and top) is as if there is no extra compartment.

5
Requirement of which profile?
Stereotype of requirement is "SysML 1.5::requirement"

6
Today I try to hide the "Satisfies" compartment that is shown automatically in the DiagramObject for an element that is connected to a Requirement.

In the GUI I can open the "Compartment visibility" dialog for the DiagramObject. The "Satisfies" checkbox is selected. I can unselect the checkbox and push OK, but it has no effect: the DiagramObject still shows the "Satisfies" relation, and when I reopen the "Compartment visibility" dialog, the checkbox is selected again.

Finally I would like to control the visibility of the compartment programmatically, but I did not find yet how to do it through API calls or database updates. If I would be able to change it manually in the GUI, then I would be able to detect modifications in the database, but unfortunately that is not possible at the moment.

Any idea?

7
I started investigating more in depth the differences between elements created in the GUI and elements created in my program. This has revealed that I have to set properly p_object.PDATA3 of my element to make everything work.

This is now what I do (I have already a ConstraintBlock with Part "A"):
  • Create a ConstraintLink referring to my ConstraintBlock
  • Create a new Part "A" under this ConstraintLink
  • Set PDATA3 for this new Part to the GUID of Part "A" in the ConstraintBlock
  • Create the ParametricDiagram
  • Add the parent block to the Diagram
  • Add the ConstraintLink to the Diagram
  • Add the new Part "A" inside the borders of the ConstraintLink
"A" is nicely becoming an embedded element in the ConstraintLink.
No more extra Elements are created in the ConstraintLink when selecting it in the Diagram, my own elements are accepted.
All seems to be fine...

8
Perfect, setting PDATA1 to the correct GUID did the job!
Thanks a lot!
Joost

9
You can try to open the diagram, save it and close it using the API functions.
Maybe that works the same way as doing it manually?
Indeed, this is a much easier way to get the diagram frame for free, thank you Geert for that!

I'm getting closer and closer to my end-goal, layout of the diagram is more and more under control.

One of the last difficulties I need to solve is the fact that EA is not completely happy with the sub-elements that I create in my constraintLink. These are my findings:
  • The good thing is that they show as embedded DiagramObjects in the constraintLink (with the little square for a connector).
  • On the other hand, EA generates a new set of sub-elements when I select manually the constraintLink in my ParametricDiagram. It must be that he is not happy with my sub-elements. The automatically created sub-elements show as owner the ConstraintBlock that was set as PropertyType for the ConstraintLink, which makes sense of course.
When I try to set the ownership (parentID) myself on my own sub-elements, then unfortunately the sub-elements do not become embedded elements of the ConstraintLink in the ParametricDiagram.

I do not see the difference between my own sub-elements and the ones created automatically by EA. Any hint?

10
This will be the diagram frame. I haven't ever created a SysML diagram using automation, but I would expect to get the diagram frame for free.
The diagram frame is not created directly after creating the new Parametric diagram.
Only for example if I open the project in the GUI, double click the diagram and close it again, then EA asks to save it. At that time it is added.
It was also added when I call the function LayoutDiagramEx().

Wondering if there is an alternative to LayoutDiagramEx for getting the diagram frame for free...

11
Getting again one step further in understanding how the things work. It is about understanding what objects are created under the hood when clicking in EA GUI.

When I manually
  • create the ParametricDiagram
  • add a constraintLink for a specific ConstraintBlock
  • select the ConstraintLink and check on the visibility of an underlying Part "A" in the feature list
Then I end up with 3 DiagramObjects:
  • one object for the ConstraintLink
  • one extra locked and invisible object related to the parent block
  • one extra Part also called "A", but with different ElementID than the one of the original "A" Part under ConstraintBlock
This locked object is around the other objects, and it will constrain the positions of any new DiagramObject as Geert explained.

Now I have to replicate the creation of these objects in my program, especially the creation of this embedded object for Part "A" seems still a challenge, that's what I will try now. I think I need the following steps to achieve this:
  • Create a ConstraintLink referring to my ConstraintBlock (containing a Part "A")
  • Create a new Part "A" under this ConstraintLink
  • Create the ParametricDiagram
  • Add the parent block to the Diagram
  • Fiddle with it (maybe with SQL queries) to set a large enough size and make sure it is locked (NSL=1)
  • Add the ConstraintLink to the Diagram
  • Fiddle with it to set its size
  • Add the new Part "A" inside the borders of the ConstraintLink in the hope it becomes an embedded element
Thank you for advice if you see mistakes in this recipe!

12
From the coordinates it looks like you calculated the lower position as too low and EA moved them up.
I think for my test I specify more space than needed for the contents it should show, but the top/left is not always on the desired location, and the width/height is adapted (shrunk), even such that it isn't sufficient for covering the complete contents.

Would I have to switch to direct database access in order to achieve what I want? Would that be possible?

I have not the faintest idea what you mean by "invisible parent".
To clarify this: For verifying the coordinates, I'm iterating through the DiagramObjects and print the ElementID of the associated elements. The extra DiagramObject I find has an ElementID of the block to which my Diagram is belonging, so I call that the parent.

13
Good to hear about the trick for embedded elements, trying that out now.

The problem I have with this is that the coordinates I specify are not taken.
For each element I add in the diagram I do something like:
Code: [Select]
diagramObject = myDiagram.DiagramObjects.AddNew(position, "")
diagramObject.ElementID = someElement.ElementID
diagramObject.Update()

During my last test I added 4 elements with different positions like:
"l=50;r=170;t=-50;b=-156;"
"l=220;r=340;t=-50;b=-156;'"
"l=50;r=550;t=-256;b=-756;"
"l=50;r=150;t=-276;b=-376;"

When inspecting DiagramObjects, I find not 4 but 5 objects (I suspect that the 5th object is referring to the parent block of the parametric diagram), with left / right / top / bottom coordinates like:
"15 / 206 / -15 / -113" (parent block, did not add it myself, invisible in the GUI)
"50 / 170 / -50 / -82"
"84 / 204 / -50 / -82"
"50 / 120 / -79 / -111"
"50 / 150 / -276 / -376" (only correct one)

So some of the coordinates are correct, some are not.
What could be the way to set them as desired?

14
Well, it's simply removed from the diagram objects. That's all.
Thanks for confirming that!
If I understand correctly, I have to study more deeply how to create/delete the appropriate DiagramObjects in case I want to show/hide my elements.

15
Hi all,

I try to control automatically whether parts are shown in different diagrams:
  • For example I have a constraintBlock with a part "A" inside. In the Parts/Properties tab of the Features of the constraintBlock, this part appears with a checkbox in front of its name, setting the value in the "Visible" column to True/False, and having an effect in the related diagram: the part appears/disappears as a blue rectangle.
  • I also have a constraintLink referring to this constraintBlock. If this constraintLink is shown in a parametric diagram, visibility of part "A" inside the rounded blue rectangle can also be controlled with the checkbox in the feature list, but obviously this is independent of the visibility in the constraint diagram.
I conclude that the "Visible" flag is not a property of the Part "A", but something related to the context in which the Part is used.

Until now I did not find a way to programmatically show/hide my Part in the parametric diagram. Do I have to set some parameter? Do I have to create a DiagramObject inside the DiagramObject of the constraintLink, because maybe the "Visible" flag is not a real variable but just reflecting the existence of the Part in the diagram? Any other way?

Not sure where to start. Do you have any hints?

Pages: [1] 2