- Posts: 5
- Thank you received: 0
×
Modelio 4.0.0 released (07 Nov 2019)
Modelio 4.0.0 has been released ( www.modelio.org/forum/4-announcements/45...-4-0-0-released.html )
Getting all elements in a BlockDiagram
- INTO-CPS-Rasmus
-
Topic Author
- Offline
- Fresh Boarder
-
Less More
7 years 10 months ago #3290 by INTO-CPS-Rasmus
Hi,
I have created a new module with a new PropertyPage. In the PropertyPage I have added some customized parameters for a Block.
In my BlockDiagram I have several Blocks. I know want to launch a command where I get all the Block elements so I can use their parameters.
I can also currently only get my command displayed when right clicking a single Block element.
Questions:
1. Is it possible to right click a single Block and select a command, which can then find all the Block elements in the diagram? If so could someone show the code?
2. If the above is not possible. How do i define my command and the accept functions so that I can get all my block diagram elements?
Regards
I have created a new module with a new PropertyPage. In the PropertyPage I have added some customized parameters for a Block.
In my BlockDiagram I have several Blocks. I know want to launch a command where I get all the Block elements so I can use their parameters.
I can also currently only get my command displayed when right clicking a single Block element.
Questions:
1. Is it possible to right click a single Block and select a command, which can then find all the Block elements in the diagram? If so could someone show the code?
2. If the above is not possible. How do i define my command and the accept functions so that I can get all my block diagram elements?
Regards
Please Log in or Create an account to join the conversation.
- INTO-CPS-Rasmus
-
Topic Author
- Offline
- Fresh Boarder
-
Less More
- Posts: 5
- Thank you received: 0
7 years 10 months ago #3295 by INTO-CPS-Rasmus
Please Log in or Create an account to join the conversation.
7 years 10 months ago #3308 by ebr
The best would be to use the following code in your command implementation.
Hoping it helps,
EBR
public void actionPerformed(List<MObject> selectedElements, IModule module) {
IModelingSession session = Modelio.getInstance().getModelingSession();
IDiagramService diagramServices = Modelio.getInstance().getDiagramService();
IDiagramHandle dh = diagramServices.getDiagramHandle((AbstractDiagram)selectedElements.get(o));
for (IDiagramLink dl: dh.getDiagramNode().getLinks()){
System.err.println( ((IDiagramNode)dl.getFrom()).getParent().getElement());
}
}
Hoping it helps,
EBR
Please Log in or Create an account to join the conversation.
Time to create page: 0.153 seconds