I have an excel table with a list of view templates names. i want to create a lists of view template by input these templates names.
i have already tried to use view.duplicate node, but it dosen’t work.
Hi, you will find lots of related threads by using the search field, and this will help you to start something consistent, see here for instance:
http://dynamobim.com/forums/topic/apply-view-templates-to-the-views/
thanks.
but what i mean is create view templates not Apply view templates.
i think it is more like "copy an exist view template, then duplicate it, apply different parameters, and finally rename view template. "
You could take a look at this and also send your first attempts or own references:
Hi @Yna_Db
I think you misunderstood. He is looking to create new view template not duplicate them
Hi @Xin_Cheng
Currently it is not possible create view template. There is no API method till now. But it is in a wish list though . However you can use the PostCommand function to call the built-in Revit command “CreateTemplateFromCurrentView”.
View active_view = ui_document.ActiveView;
ui_document.ActiveView = copied_views.First();
using (Transaction t = new Transaction(document, "Create template from view"))
{
t.Start();
RevitCommandId id = RevitCommandId.LookupPostableCommandId(PostableCommand.CreateTemplateFromCurrentView);
ui_document.Application.PostCommand(id);
t.Commit();
}
ui_document.ActiveView = active_view;
Good Luck!
Just like @Kulkul was saying, its not possible to just create a new instance of a View Template. It’s also not possible to Duplicate a View Template like one would with a regular view. However, it is possible to Copy/Paste a View Template into the model and effectively create a new copy of it. I added a few nodes to Archi-lab.net package that can handle this:
Here’s the code for reference:
http://forums.autodesk.com/t5/revit-api-forum/create-a-view-template/td-p/3161696
This was uploaded to Archi-lab:
@Kulkul @Yna_Db Thanks for your opinion.
@Konrad_K_Sobon thank you for your new node. it worked.