Updating template changes to completed files

Hi All,

I was wondering if there was a way to have templates update when alterations are made on them to already completed files.

For example if layers or blocks were removed/modified on a template then a model that was created before the template was opened, what would be the method for that old model to receive the attributes of the new template.

Or is there a method like linked blocks that could be applied?

Thanks.

Hello - linked blocks would be updated, I think that’s about as close as it comes to what I think you are asking.

-Pascal

Hi Pascal,

Thank you for your response

Would you know the closest thing to CAD management Rhino can implement.

Would a script be able to carry out this function?

Thanks.

Hi - you can most likely make scripts that do anything that you want but you will have to be very specific about the requirements. The information that you have provided in the first post is a bit too general to be able to point to good answers.
-wim

Hi Wim,

An example would be creating a template with 10 blocks. Making this template default and using it for a number of models. Realising that you need to add a block that would be standard on all templates in the future. So you create a new template with 11 blocks and overwrite the old template with the new one.

Instead of migrating the models created on the old template to the new template or adding the new block to the models, is there a way to set up templates where they can be updated if changes happen and will populate blocks in models already created when opened.

The same idea for layers also.

If this has to be done by a script, the idea I have is the script to check what layers/blocks are in the model, highlight what is missing and pull them “from somewhere” and populate them in the model.

Would also be nice to have something to check what blocks/layers shouldn’t be there and options to remove or convert those layers.

Can creating a script provide this solution?

Thanks.

Hi - much of that can be solved with linked blocks, as Pascal mentioned above. Have you tried that?

This nice-to-have feature would make things a lot more complicated and would require some sort of scripting. Do you have experience with Python or C#?
-wim

Hi Wim,

I was more focused on new blocks that were added to the template than linked blocks that were already there.

My knowledge on python is light but I’ve done some C++.

Thanks.

I think you’ve got this the wrong way around.
Make a new file.
Insert your template file in this new file - pick the linked option.
When, at some point, you need to edit your template file, the block manager in the new file will tell you that the template file has been modified and you can chose to update it.

So, if you add or remove objects or layers in the template file, the new file can be updated to reflect this.
Does that get you anywhere?
-wim

Hi Wim,

May sound like a dumb question but how does you link the template file? I already have it set up as the default template. So when if I change anything in the template and start a new file those changes will be in a new file.

My issue is opening old files and the template not updating in these old files. Unless I have something wrong with my program where this update process should be happening?

To clarify I mean adding a new block to the template which wasn’t in an old model. When I open the old model, there is no prompt to add the new block.

Thanks.

Hi - In the proposed workflow, you would have to deal with 2 different template files. One is that you set Rhino to start with and will include your personal settings for units, annotations, notes, etc.
The other template will include your layers and objects that you need in all new files.

In your start-up template, insert (linked) the other template and save.

When you now start a new Rhino session, all your customizations will be in there. When you add or remove objects and/or layers in the other template, you can update all new files through the block manager.
Does that help?
-wim

Hi Wim,

Your suggestions seems to have work. From what I understand the “linked” template in now being inserted as a block itself and then saving this file as a default template will keep its link for all new models.

Just as a preference, is there a way to insert the to-be-“linked”-template without populating the blocks in the file. This is the error I receive when I try doing it ‘File does not contain any objects, unable to create block.’ Will be able to live with it if it’s not possible.

Additionally, as a test I deleted a layer from the “linked” template file. When opening a new file the layer had been removed. But on a dummy old file the layer was still there. The same happened with blocks. Is there a way around this.

Sorry to add more but something else I noticed, when changing a layer name, the new name appear but old one remained. I’m assuming the fix for this would sort all these issues out, but haven’t managed to work something out myself yet.

Thanks for your help so far.

Hi - I’m confused now. In your earlier post you wrote that, as an example, you would create a template with 10 blocks. Those blocks must contain some geometry, no?

Yes, that’s the tricky part.

If you, instead of using the default Active as Layer Style, use Reference, removing and renaming layers in the linked template will update correctly in new files. But, in this case, layers cannot be empty in the linked template.

If I’m not mistaken, @Helvetosaur is writing a script that can read layer names from external files.
If using linked files doesn’t work for you, you could probably look at that one and see if you can modify it to your needs. → See Importing layers via Rhino.FileIO
-wim

Hi Wim,

You are correct, I would create the template with blocks, but then I would delete the blocks since they were still accessible in the block manager. As when I started a new file I wanted it to be empty in the modelspace. It’s fine if the blocks have to be populated in the modelspace for this solution.

Will attempt to modify the code you sent in the link.

Is there a possibility that some form of cad management will come to rhino in the near future. This is the furthest I’ve got, also have used the Layer State Manager Function.

Thanks for your help.

Hi - I’m not aware of any developments in that area, no.
-wim