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

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;

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

// if need be: add other attributes


Gerald Groot Roessink


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

Is something wrong here?

Thanks Gerald

Phil Beauvoir


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'

If you value and use Archi please consider making a donation!