Archi Forum

Archi Plug-ins => jArchi => Topic started by: Gerald Groot Roessink on December 13, 2022, 21:57:10 PM

Title: notes and groups don't copy
Post by: Gerald Groot Roessink on December 13, 2022, 21:57:10 PM
Hi,
From the palette there are two types of objects, notes and groups.  I have a script to copy a view to another view
containing this code:
 
  // add objects like grouping
    var  obj_copy = {} ;
    $(view).find('object').each(function(vo) {
        var obj=vo.concept;
        var bounds = vo.bounds;

//calculate the absolute xy coordinates of nested elements.
var x=bounds.x;
var y=bounds.y;
$(vo).parents().not('folder').not('archimate-diagram-model').each(function(mum){
x=x+mum.bounds.x;
y=y+mum.bounds.y;
});

//declare copy of visual as an object and use the id of the source visual object as key
        obj_copy[vo.id]=view_copy.createObject(obj, x, y, bounds.width, bounds.height, "true"); //autoNest=true

// if need be: add other attributes

    });
Title: Re: notes and groups don't copy
Post by: Gerald Groot Roessink on December 13, 2022, 21:59:23 PM
Finishing:

I expected notes and groups to be copied but they don't. Only grouping-objects do.

Is something wrong here?

Thanks Gerald

Title: Re: notes and groups don't copy
Post by: Phil Beauvoir on December 14, 2022, 09:58:10 AM
Hi,

using 'object' in find won't work for these types of diagram objects. You have to use their class type - 'diagram-model-note' and 'diagram-model-group'

Phil