MC

Hi,

Any one knows that how to get X & Y co-ordinate of Model Attribute using ARIS Script? Please help.

 

by manoj chauhan Author
Posted on Mon, 01/20/2020 - 08:09

Please anyone can help

0
by Ariene Kroeze
Posted on Mon, 01/20/2020 - 13:33
//placement of model attributes
var oTextOccs = oModel.TextOccList()
for each(var oTextOcc in oTextOccs){
    var oModelAttrOccList = oTextOcc.AttrOccList();  
    if (oModelAttrOccList.length>0){
        var AttrNo= oModelAttrOccList[0].AttrDef(-1).getValue()                    
        if (parseInt(AttrNo)>0){
            // content of textbox is model attribute 
            var iX = oTextOcc.X()  //x-pos of the free-form text in 1/10 mm (LOMETRIC).
            var iY = oTextOcc.Y()  //y-pos of the free-form text in 1/10 mm (LOMETRIC).
        }
    }
}
//Placements of attributes of ObjOccs
var oAttrOccList = oObjOcc.AttrOccList()
for (var i in AttrOccList){
    var oAttrOcc = oAttrOccList[i]  
    var iX = oAttrOcc.OffsetX()   //Offset in 1/10 mm (LOMETRIC).         
    var iY = oAttrOcc.OffsetY()   //Offset in 1/10 mm (LOMETRIC). 
}

Best regards, Ariene Kroeze

0
by manoj chauhan Author
Posted on Tue, 01/21/2020 - 07:37

In reply to by Ariene Kroeze

Thank you Ariene, It is realy helpfull. but how can I find X, Y cordidate of specific Attribute.  for example. I want to draw 'Last Change' Attribute  in place of  'Last user' Attribute in diagram at exact X, Y cordinate location of 'Last user' attribute. once draw the 'Last Change'  attribute then I'll remove the 'Last user' attribute. can you help me in this?

0
by Kay Fischbach
Posted on Tue, 01/21/2020 - 08:17

In reply to by Ariene Kroeze

var oAttrOccList = oObjOcc.AttrOccList()
for (var i in AttrOccList){
    var oAttrOcc = oAttrOccList[i]

Shouldn't those three lines look something closer to those two lines?

var oAttrOccList = oObjOcc.AttrOccList()
for (var oAttrOcc  in oAttrOccList){
0
by manoj chauhan Author
Posted on Tue, 01/21/2020 - 09:19

In reply to by Kay Fischbach

Hi Kay,

Thanks

I am doing as below and oObjOcc.AttrOccList() this line throw error can't find function

   var oObjOcc= oModel.ObjOccList()
   var oAttrOccList = oObjOcc.AttrOccList() // This line gives error can't find function
   for (var i in oAttrOccList ){
    var oAttrOcc = oAttrOccList[i]
    var iX = oAttrOcc.OffsetX()   //Offset in 1/10 mm (LOMETRIC).         
    var iY = oAttrOcc.OffsetY()   //Offset in 1/10 mm (LOMETRIC).
    
   }

 

0
by Kay Fischbach
Posted on Tue, 01/21/2020 - 10:46

In reply to by manoj8519

Your code is missing an iteration, and I also made a mistake.

I'm not used to Ariene Kroeze's way of doing for loops, that's why I got confused. You can compress something like

for (var i in oAttrOccList ){
    var oAttrOcc = oAttrOccList[i]

into a single line

for each (var oAttrOcc in oAttrOccList ){

What is important is that you don't forget the "each" like I did with my original comment.

my entire (tested) proof-of-concept test script, maybe it helps:

var allModels = ArisData.getSelectedModels();

for each(var singleModel in allModels){
    var allObjOccs = singleModel.ObjOccList();
    for each (var singleObjOcc in allObjOccs){
        var oAttrOccList = singleObjOcc.AttrOccList();
        for each (var oAttrOcc in oAttrOccList ){
            var iX = oAttrOcc.OffsetX()         
            var iY = oAttrOcc.OffsetY()
        }
    }
}
0
by Ariene Kroeze
Posted on Tue, 01/21/2020 - 10:52
//to create a textbox with a reference to a model attribute:
oModel.CreateTextOcc  (iX, iY, p_nAttrTypeNum )
//to remove a model attribute e.g. attribute 'Name'
var oTextOccs = oModel.TextOccList()
for each(var oTextOcc in oTextOccs){
    var oModelAttrOccList = oTextOcc.AttrOccList();  
    if (oModelAttrOccList.length>0){
        var AttrNo= oModelAttrOccList[0].AttrDef(-1).getValue()                    
        if (parseInt(AttrNo)>0){
            // content of textbox is model attribute 
            if (AttrNo == Constants.AT_NAME){
                oTextOcc.Remove(true)
            }
        }
    }
}
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