NK

Hi ARIS Support,

I have this task of copying the contents of one model to a blank model and another task of repositioning all of the copied objects along the y-axis. I was able to do both but for the second task, I was not able to properly retain the original positioning of the copied Connection objects/lines (CxnOcc objects). Here are my codes for the y-position realignment task:

// Relocate all the occurences that are found within a model along the x-axis and y-axis
function adjustOccurencesLocAtXY(model, xIncrement, yIncrement) {
    var i, j;
    
    if (model == null) {
        Dialogs.MsgBox("Source Model is null or empty");
        return;
    }

    var srcCxnOccurences = model.CxnOccListFilter();
    for (i = 0; i < srcCxnOccurences.length; i++) {
        var arrPoints = srcCxnOccurences[i].PointList();
        for (j = 0; j < arrPoints.length; j++) {
             arrPoints[j, 0].setX(arrPoints[j, 0].getX() + xIncrement);
             arrPoints[j, 1].setY(arrPoints[j, 1].getY() + yIncrement);
        }   
        
        var fromExtCxnOccs = srcCxnOccurences[i].fromExtCxnOccs();
        for (j = 0; j < fromExtCxnOccs.length; j++) {
            fromExtCxnOccs[i].SetPosition(fromExtCxnOccs[i].X() + xIncrement, fromExtCxnOccs[i].Y() + yIncrement);
        }
    
        var toExtCxnOccs = srcCxnOccurences[i].toExtCxnOccs();
        for (j = 0; j < toExtCxnOccs.length; j++) {
            toExtCxnOccs[i].SetPosition(toExtCxnOccs[i].X() + xIncrement, toExtCxnOccs[i].Y() + yIncrement);
        }
    }
    
    var srcTextOccurences = model.TextOccList();
    for (i = 0; i < srcTextOccurences.length; i++) {
        srcTextOccurences[i].SetPosition(srcTextOccurences[i].X() + xIncrement, srcTextOccurences[i].Y() + yIncrement);
    }
    
    var srcComObjOccurences = model.ComObjOccs();
    for (i = 0; i < srcComObjOccurences.length; i++) {
        srcComObjOccurences[i].SetPosition(srcComObjOccurences[i].X() + xIncrement, srcComObjOccurences[i].Y() + yIncrement);
    }

    var srcOccurences = model.ObjOccList();
    for (i = 0; i < srcOccurences.length; i++) {
        srcOccurences[i].SetPosition(srcOccurences[i].X() + xIncrement, srcOccurences[i].Y() + yIncrement);
    }
}   


Given my codes above, are there things that I missed out from my repositioning codes or had some unwanted function calls or improper order of function calls? Or is there a shorter and easier way of doing this? That I would love to hear.

Shown below is the original model, the copied model and the relocated model...

Thanks.

 

by Abhijit Das
Posted on Tue, 03/29/2011 - 02:06

Hi Nanji,

It reminds me of my variant copy creation of model for our company.

The resaon it is failing are

1. Although you are relocating the connection at the begining and moving objects later. But since connection are linked with Objects it just retains the connection where it is connected with the object. As a result the connection gets messy.  Check only moving the connection without moving the objects.

2. If you are moving the objects first what will happen the coneection still maintain its link with object and get messy.

Theoretically you can do it in the single model but you have to delete the connection and redo the connection and to do that you have to maintain/keep record of object occurence , connection etc in array and reuse it. Although it is complex but it is doable.

I beleive you copied the model with the same principle.

Abhijit Das

0
by Nanji Katana Author
Posted on Tue, 03/29/2011 - 09:34

Hello Abhijit,

I already tried the ff. scenarios but I still ended up with a messy webbings of connection lines:

Scenario 1) On moving the model, I only moved the connections without moving the ObjOcc objects.

Scenario 2) On copying each ObjOcc object of the source model, I simply created a new ObjOcc by using this method and fill it up with parameter values from each ObjOcc object as I did before:

 var temp = targetModel.createObjOcc(srcOccurences[i].SymbolNum(), srcOccurences[i].ObjDef(), srcOccurences[i].X(), srcOccurences[i].Y());

Then only on moving the model, I created all the CxnObj objects on the fly with the adjustments already added.

I have a question though.. when I use the createObjOcc() function, I fill it up with an ObjDef object that contains the CxnOcc references... how would I delete the CxnOcc objects or points referenced within an ObjDef?

 

0
by Fernando Navarro
Posted on Sat, 07/28/2012 - 01:26

Hello,

I have some FAD models which already have messed up connections. Any idea how to fix them.

 

Thank you

0
by Ana Sequeira
Posted on Tue, 12/13/2016 - 19:00

Hey got a similar issue doing another script, I  manage to move all my objects except the connections (type: links in a BPMN collaboration diagram 2.x)

How to obtain an array of those conections  (the ones we need save so then we can delete and then remake)?

 

I am trying getLinks() functions and getConnectedObjOccs but no luck yet

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock