Archi Forum

Archi => General Archi Discussion => Topic started by: Jose-Carlos on September 19, 2017, 09:27:37 AM

Title: Duplicate a model with a new identifier
Post by: Jose-Carlos on September 19, 2017, 09:27:37 AM
Hi,
is there a way to duplicate a model with a new id?
It generates some troubles when new models created from another one are stored using database plugin. Identifier is the same and model is considered as a new version and not a new model.

Today, I use an editor to modify manualy the id, but a duplicate model function will be usefull.
Thanks.
Title: Re: Duplicate a model with a new identifier
Post by: Phil Beauvoir on September 19, 2017, 09:42:08 AM
I don't understand where you are duplicating a model?
Title: Re: Duplicate a model with a new identifier
Post by: Jose-Carlos on September 19, 2017, 13:24:11 PM
For example, when I create a model from a template or by copying the archimate extention file. those two actions keep the model id.
Title: Re: Duplicate a model with a new identifier
Post by: Phil Beauvoir on September 19, 2017, 13:53:10 PM
I've just made a change to the code so that new IDs are generated for all objects and model when creating a new model from a template.

As for when someone manually copies the file, I can't do anything about that.
Title: Re: Duplicate a model with a new identifier
Post by: Jose-Carlos on September 19, 2017, 15:51:10 PM
Thanks Phil for your reactivity.
I'll wait for next build annoncement to download the new version with this improvment.
Title: Re: Duplicate a model with a new identifier
Post by: Hervé on September 19, 2017, 22:45:45 PM
Hi,

Alternatively, you may download my form plugin (https://github.com/archi-contribs/form-plugin (https://github.com/archi-contribs/form-plugin)).

Then create a configuration file containing the following lines:
{
    "version": 2,
    "org.archicontribs.form": [{
        "spacing": 4,
        "refers": "model",
        "name": "change model's ID",
        "width": 400,
"height": 200,
        "tabs": [{
            "name": "Id",
            "controls": [
               {
                  "x": 5,
                  "y": 10,
                  "text": "Model's ID:",
                  "class": "label"
               },
               {
                  "fontBold": true,
                  "x": 80,
  "y": 10,
                  "width": 320,
                  "variable": "${id}",
                  "class": "text"
               }
]}
      ]
    }]
}


You configure this file in the plugin's preference (Archi menu "Edit" / "preferences" / "form plugin" and finally, you right click on any component of your model to show up the context menu.

When you select the form, you are able to change your model ID.

Hope this helps

Best regards
Hervé
Title: Re: Duplicate a model with a new identifier
Post by: Jose-Carlos on September 20, 2017, 10:23:01 AM
Hi Hervé,
thanks a lot for this workaround. It's perfect!