notes and groups don't copy

Started by Gerald Groot Roessink, December 13, 2022, 21:57:10 PM

Previous topic - Next topic

Gerald Groot Roessink

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

    });

Gerald Groot Roessink

Finishing:

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

Is something wrong here?

Thanks Gerald


Phil Beauvoir

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
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.