Group/Combine Model Elements in Modelling EditorGroup/Combine Model Elements in Modelling EditorRE: Group/Combine Model Elements in Modelling EditorMateusz Dziedzichttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=13844752018-10-04T12:37:36Z2018-10-04T12:26:13ZThe easiest way to move the Pin objects when moving the corresponding Component object is to select the Pin objects together with the Component object. You can either do this manually by selecting all the objects when you want to move them or you can do this e.g. via a Script which, when executed, selects the Pin objects connected via INTERREF with the selected Component object.<br /><br />Regarding the Script:<br />1) Create an attribute of type “EXPRESSION” with the name e.g. “PinsInterrefIDs” for the class Component<br /><br />2) Add the following Expression to the standard value of the PinsInterrefIDs attribute: <br />EXPR type:string expr: (irtobjs("#Name of the INTERREF attribute which connects the Pins with the Component object#")) → e.g. EXPR type:string expr: (irtobjs("Pins"))<br /><br />3) AdoScript code: What the following script basically does is<br />a) it gets all the IDs of selected objects in an active model<br />b) it loops through the list with the IDs and because only the selected Component objects are relevant in this case it checks for the objects of class Component<br />c) For the selected Component objects it gets the IDs of the Pins objects, which are connected via INTERREF with a selected Component object, into an array<br />d) it loops through the array to select all the Pins objects <br /><br /><div class="code"><span class="code-lines"> 1</span>CC "Modeling" GET_ACT_MODEL<br /><span class="code-lines"> 2</span># --> RESULT modelid:intValue<br /><span class="code-lines"> 3</span>SETL nModelID:(modelid)<br /><span class="code-lines"> 4</span><br /><span class="code-lines"> 5</span>CC "Modeling" GET_SELECTED modelid:(nModelID)<br /><span class="code-lines"> 6</span># --> RESULT ecode:intValue objids:strValue classid:id<br /><span class="code-lines"> 7</span>SETL sSelectedObjects:(objids)<br /><span class="code-lines"> 8</span><br /><span class="code-lines"> 9</span>#Create an array for the Pins objects IDs<br /><span class="code-lines">10</span>SETL aPinsObjects:({})<br /><span class="code-lines">11</span><br /><span class="code-lines">12</span>FOR i from:(0) to:(tokcnt(sSelectedObjects)-1) {<br /><span class="code-lines">13</span> <br /><span class="code-lines">14</span> #check for the selected objects of Class Component in case<br /><span class="code-lines">15</span> #there are more objects of different classes selected at once<br /><span class="code-lines">16</span> CC "Core" GET_CLASS_ID objid:(VAL (token(sSelectedObjects,i)))<br /><span class="code-lines">17</span> #--> RESULT ecode:intValue classid:intValue isrel:intValue<br /><span class="code-lines">18</span> CC "Core" GET_CLASS_NAME classid:(classid)<br /><span class="code-lines">19</span> #--> RESULT ecode:intValue classname:strValue isrel:intValue<br /><span class="code-lines">20</span> <br /><span class="code-lines">21</span> #in case a selected object is of class Component then get<br /><span class="code-lines">22</span> #the IDs of the connected (via INTERREF) Pin objects and put them<br /><span class="code-lines">23</span> #into the array aPinsObjects<br /><span class="code-lines">24</span> IF (classname = "Component") {<br /><span class="code-lines">25</span> CC "Core" GET_ATTR_VAL objid:(VAL (token(sSelectedObjects,i))) attrname:("PinsInterrefIDs")<br /><span class="code-lines">26</span> #-->RESULT ecode:intValue val:anyValue<br /><span class="code-lines">27</span> FOR j in:(val) {<br /><span class="code-lines">28</span> SETL dummy:(aappend(aPinsObjects, VAL j))<br /><span class="code-lines">29</span> }<br /><span class="code-lines">30</span> }<br /><span class="code-lines">31</span>}<br /><span class="code-lines">32</span><br /><span class="code-lines">33</span>#select all the Pins objects belonging to selected Component objects<br /><span class="code-lines">34</span>FOR i from:(0) to:(aPinsObjects.length - 1) {<br /><span class="code-lines">35</span> CC "Modeling" SELECT objid:(aPinsObjects[i])<br /><span class="code-lines">36</span> # --> RESULT ecode:intValue .<br /><span class="code-lines">37</span>}<br /></div>Mateusz Dziedzic2018-10-04T12:26:13ZGroup/Combine Model Elements in Modelling EditorMartin Paczonahttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=13801672019-01-09T13:26:12Z2018-09-28T13:25:16ZHello,<br /><br /><strong>Is there a possiblity to group model elements together, <br />so if element A is moved the model element B is also moved in the modeling tool.</strong><br /><br />To make this more clear here my example:<br />i have following model concepts (see picture):<br />- <strong><em>Component </em></strong><br />- <strong><em>Pin</em></strong><br /><br />If i place now the <em>Componet </em> in the modeling tool automaticly 2 <em>Pins </em>beside the model element <em>Component </em>are created<strong>.</strong><br />Now i also need a possibilty to link the <em>Pin </em>to the <em>Component </em>so that when i move the C<em>omponent </em>the P<em>in is</em> also moved. <br /><br />To have also the logical linke between this model elements a model INTERREF is used.<br /><br />Thank you for your help!<br /><br />BR<br />Martin<br /><br />(ADOxx Verson 1.5)Martin Paczona2018-09-28T13:25:16Z