Create a view template

Create a view template

m.vallee
Advocate Advocate
6,026 Views
21 Replies
Message 1 of 22

Create a view template

m.vallee
Advocate
Advocate

Hi,

 

I would like to know if it is now possible to create a view template, I mean from scratch, without copying an existing one.

I think it was the purpose of CF-1509 [API wish: create view template -- 09693106].

 

If not, is it possible instead to create a view template from the current view ?

It is possible with the UI :

  • with the command called "Create Template from Current View"
  • or with the right-click context menu "Create View Template From View".

Thanks a lot for your help.

 

Best regards,

 

Maxime

6,027 Views
21 Replies
Replies (21)
Message 2 of 22

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Thank you for your query.

 

I am sorry to say that no progress has yet been made on the wish list item CF-1509 [API wish: create view template -- 09693106, 11795199] .

 

I added a note of your request and renamed it in order to make the development team aware of its importance.

 

You are welcome to request an update on the status of this issue or to provide us with additional information at any time quoting this wish list item number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team, and prioritised against all of the other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 22

m.vallee
Advocate
Advocate

Hi Jeremy,

 

Thanks for your quick answer. Unfortunately nothing happened since someone raised this subject two years ago...

 

The Revit plugin I am working on needs to create view templates on-the-fly and I don't know how to do this if there is no view template in the project.

 

Do you know if we can create a view template from the current view, as the UI proposes it to the user ? If it is the case I would create the view the user wants to have, then "save it" as a view template.

 

Best regards.

 

Maxime

0 Likes
Message 4 of 22

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Thank you for your update.

 

If the user interaction you describe is pretty simple, you might be able to drive it programmatically, simulating button clicks and so forth.

 

Here are some samples on doing that to achieve various things in Revit:

 

http://thebuildingcoder.typepad.com/blog/automation

 

Do the suggestions regarding this workaround possibly help?

 

http://forums.autodesk.com/t5/revit-api/drafting-view/m-p/6300235

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 22

m.vallee
Advocate
Advocate

Hi,

 

I tried to 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;

The trouble is this piece of code is called more than once during my command execution, and you can post command only one Revit command.

 

Is there a way to call this Revit command with arguments (here typically, the name of the created view template) and execute it silently ?

 

Or is is something you plan to allow ?

 

Thanks.

 

Maxime

0 Likes
Message 6 of 22

jeremy_tammik
Alumni
Alumni

Dear Maxime,

 

Thank you for your update and new question.

 

Very cool request.

 

No, there are no plans for supporting this out of the box afaik.

 

Please consider a different approach.

 

Here is an idea for you to try out:

 

1. Implement a queue to store all the tasks you wish to perform, such as the PostCommand call to launch the CreateTemplateFromCurrentView command.

2. Add all your tasks to the queue.

3. Subscribe to the Idling event.

4. As long as any tasks pending execution remain in the queue, execute them and continue subscribing to the Idling event.

5. Unsubscribe from the Idling event when all tasks are done.

 

How does that sound to you?

 

 

Please let us know whether this works for you and how you end up solving this.

 

Thank you!

 

Best regards,

 

Jeremy

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 7 of 22

m.vallee
Advocate
Advocate

Hi Jeremy,

 

Thanks for the idea. That would probably work, but it is not user-friendly at all.

 

My command automatically creates a bunch of views for filtering by different parameters, and I need the corresponding view templates' creation to be part of the process, so that :

  • I can give a non-ambiguous name to each view template, saying what it corresponds to
  • it is totally transparent for the user.

 

If at the end of the command execution, the user has to give a name for each view template to be created then click "OK", it is not handy at all. Moreover, he doesn't know which name to give unless he opens the Filter tab of the V/G panel.

 

To sum up, I think I cannot do what I want as of today. There are three ways for Autodesk to solve this :

  • Add an API function to create view templates from scratch, then let us modify their properties
  • Add an API function to create view templates from existing/current views
  • Allow Revit commands like "CreateTemplateFromCurrentView" to be called silently and with the required arguments.

 

Thanks.

 

Maxime

0 Likes
Message 8 of 22

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Thank you for your updates and suggestions, which I added to the wish list item CF-1509 [API wish: create view template -- 09693106, 11795199].

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 9 of 22

m.vallee
Advocate
Advocate

Hi @jeremytammik,

 

Any new info regarding this request ?

 

Thanks.

 

Best regards.

 

Maxime

0 Likes
Message 10 of 22

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Nope, nothing so far. I asked the development team for a status report...

 

Have you also submitted this wish to the Revit Idea station?

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 11 of 22

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Feedback from the development team:

 

Looks like this is the associated Revit idea (it’s asking for modification, but I assume that’s the next step after being able to create one):

 

https://forums.autodesk.com/t5/revit-ideas/set-view-template-from-api/idi-p/6661957
 
I recommend that Maxime vote on this issue.
 
At this time it’s not on our roadmap.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 12 of 22

m.vallee
Advocate
Advocate

Thanks Jeremy. I just voted on the issue.

What a pity though that is is not on Autodesk's roadmap...

 

Maxime

0 Likes
Message 13 of 22

mastjaso
Advocate
Advocate

I've voted too, but this is a pity as having to manually change the settings of view template options for dozens of view templates is incredibly time consuming and monotonous (as is having to create them from scratch).

 

Thank you Jeremy for doing such an excellent job with community engagement and outreach (not to mention your ridiculously helpful blog), but I do want to express my displeasure with the Autodesk engineering team's "limited resources". Revit has a defacto monopoly on the design software for basically the entire worldwide AEC industry and charges massive fees to use said software. I have a hard time believing that these "limited resources" are actually being driven by a lack of resources at Autodesk and not just corporate greed. Every dollar that Autodesk spends improving Revit probably saves the worldwide construction industry thousands. Given the fees that Autodesk charges and the impact their improvements have, the glacially slow pace of Revit development seems extremely hard to justify. 

Message 14 of 22

jeremytammik
Autodesk
Autodesk

Dear Maxime, Jason, and all others concerned,

 

Thank you for voting and for your kind appreciation.

 

This wish list item appears to be on the roadmap now after all, and the development team are requesting feedback on it:

 

 

The discussion forum threads, ADN cases and development tasks affected are:

 

 

Would you like to review the current draft of the plans below and let us know whether you think they will meet your needs?

 

We think the Acceptance Criteria listed below cover the customer wishes; please let us know if this is correct and if there are other requirements related to View Templates.

 

Draft Release Epic:

 

As an API developer, I need the ability to create, modify and apply view templates via the API, so that I don’t need to use Revit interface to create and manage my view templates.

 

Draft Acceptance Criteria:

 

  • Ability to edit and control all view template setting via the API (this may be available now?)
  • Ensure that the action of including parameters via the “Include” column in the view templates dialog is available through the API. (maybe this is the same as line #1?)
  • Create a new view template from scratch via the API
  • Duplicate an existing view template via the API
  • Create a view template from the current view and from existing views via the API
  • Allow Revit command “CreateTemplateFromCurrentView" to be called silently and with the required arguments. (Is this request redundant?)

 

Customer sentiment:

 

My goal is to create X views, each with a new view template that has filter variations which depend on parameter values. I managed (via the API) to associate each view with the correct template, but had to create the templates via the UI, before I could edit them with the API.

 

Does that sound as if it matches and covers all your requirements?

 

Thank you!

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 15 of 22

m.vallee
Advocate
Advocate
Hi Jeremy, That sounds good to me. When does the dev team think it will be available ? Thanks for the feedback. Maxime
0 Likes
Message 16 of 22

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Thank you for your appreciation and interest.

 

I do not see any clear plan stated, so I assume in a future release of Revit.

 

We never make promises on future products anyway.

 

Cheers,

 

Jeremy

 

P.S.

 

  • 'Worte sind wie Schall und Rauch...'
  • The best way to keep one's word is not to give it. -- Napoleon Bonaparte
  • Thou ought to be nice, even to superstition, in keeping thy promises, and therefore equally cautious in making them. -- Thomas Fuller
  • Promise is most given when the least is said. -- George Chapman

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 17 of 22

scheerd
Alumni
Alumni

One more vote from me. Been needing this for a few years now for creating views for addins like Insight Lighting, Solar, Crowd, and some others I'm working on that have their own analysis results views.  Also would be useful for the temp views created for the big-room trick for finding exterior walls.  This process is significantly sped up if the temporary views are simplifed by applying a template.

0 Likes
Message 18 of 22

m.vallee
Advocate
Advocate

Hi Jeremy,

 

Do you have some information regarding the development of these new functionalities ?

 

Thanks in advance.

Best regards.

 

0 Likes
Message 19 of 22

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Thank you for your patience and perseverance.

 

RTFM, please.

 

For instance, it is listed here in What's New in the Revit 2020 API:

 

https://thebuildingcoder.typepad.com/blog/2019/04/whats-new-in-the-revit-2020-api.html#4.2.10.1

 

2.10. View API additions

 

2.10.1. View Template API additions

 

The new methods:

 

  • View.CreateViewTemplate()
  • View.isViewValidForTemplateCreation()

 

allow you to turn an existing view into a view template. The created view template has an automatically generated unique name.

 

The Revit API, for a few releases, has featured a fairly fully-featured capability to set up and modify view templates and their properties. These capabilities are now demonstrated in the new SDK sample "ViewTemplateCreation".

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 20 of 22

m.vallee
Advocate
Advocate

Hi,

 

Thanks for pointing me to the new view template API additions.

There was no need to say "RTFM", the info could not be found so easily if not working for Autodesk : 

  • no updates here in the related forum's subject, though this problem has been raised to Autodesk for many years now
  • Google results for "revit api create view template" do not point to the "What's new" section of Revit 2020 API

Now, regarding the technical aspect, there are two points of the initial request that have not been added : 

  • Create a new view template from scratch via the API
  • Modify a view template via the API

Best regards.

0 Likes