Hi friends,
By API, there is a way to get the template of the project? If it is from structural, architectural, construction or ...?
Thanks for your answer.
I don’t think there is an in-built way because any project from such a template can be broadened to any discipline. When things start out you can obviously investigate the view disciplines etc. but the things you may be looking for could change.
My approach would be as follows:
Create extensible storage element with simple field containing the template name. This would then be passed through as a characteristic of the template to all project files derived from it. You can do the same with a parameter bound to a singleton but such things are easier for common users to change (unless they are user modifiable = false etc.).
If you are looking for a solution to existing projects created from templates long ago then I don’t have an obvious solution other than to use the RevitLookup tool to identify some characteristics common to all files created from a certain template:
In my quick test with 2018 out of the box templates I get the following UniqueIDs for the ‘ProjectInformation’ singleton.
(Architecture)
bf0552b6-b7f7-4331-96d5-b19843262895-00015084
ProjectInfo (Structure)
f068b91d-a784-4968-b44d-9a258b6becb0-0000795f
(These are mine may or may not be yours)
My caveat would be that this is obviously a very ropey way of identifying the template a document is derived from. There may be no consistency between such things in different templates of the same discipline and I have no idea what actions such as file auditing have on UIDs.
It all depends on the purpose of such identification in the first place. I can only imagine the functionality this is to provide:
If you have 100 project files stored together in the same place and you want a quick and rough way to file them by discipline in an automated way then the above may match the majority of cases leaving you with a few to manually check. In such a process, you’ll have to estimate how likely it is that an MEP guy started out by using a structural template etc. It’s not going to give you 100% certainty that things will be correctly partitioned.
If on the other hand you want the interface to adapt to the project file and your ‘auto detect’ approach fails then the user will manually pick the correct option and at the same time you add the identification to it (via extensible storage/parameters).
Can't find what you're looking for? Ask the community or share your knowledge.