Find Label/Tag containing specific Shared Parameter

Find Label/Tag containing specific Shared Parameter

DJB_CADfx
Enthusiast Enthusiast
1,856 Views
6 Replies
Message 1 of 7

Find Label/Tag containing specific Shared Parameter

DJB_CADfx
Enthusiast
Enthusiast

We have a tool that looks up specific ViewSheet Parameters to write their data to an external database each time a Sync With Central occurs. One such Parameter is Revit's own "Sheet Number" parameter. However, a new project has the requirement that the Sheet Number include a Prefix value. This was accomplished by creating a Label on the TitleBlock that used the "Sheet Number" parameter and included the required prefix.

 

Our tool now needs to obtain the full Sheet Number that includes this prefix. We have found it difficult to get at this information. For starters, we aren't sure what type of element we need to filter for to get this. The hope was that we could find the one Label object on the ViewSheet that utilizes the "Sheet Number" parameter and obtain the full value including the prefix.

 

We have tried filtering for IndependantTags & TextNotes, but have not found the element we are looking for. So first we need to know what type of element it is we are looking for and then how to get the fully qualified value from it.

 

Any help would be greatly appreciated!

 

Thanks,

 

Dave Blackburn

0 Likes
Accepted solutions (1)
1,857 Views
6 Replies
Replies (6)
Message 2 of 7

jeremytammik
Autodesk
Autodesk

Dear Dave,

 

Thank you for your query.

 

You could implement a filtered element collector that filters for the parameter that you are interested in:

 

 

Such a filter would ignore all other aspects, such as element type, category, etc., if you don't care about those.

 

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 7

FAIR59
Advisor
Advisor
Accepted solution

I don't think you can get information from a Label using the API.

 

With a minor change to your Titleblock family , you don't have to.

 

  1. In the Label replace the prefix text with a shared Parameter
  2. In the project bind the shared Parameter to the Project-information Category.

You now can get the Prefix text by  the value of the shared Parameter. 

 

LabelParam.PNG

0 Likes
Message 4 of 7

DJB_CADfx
Enthusiast
Enthusiast

Fair59,

 

I suspect you are right about not being able to get at the Label object via the API to get what I was looking for. Your suggestion sounds like the best work-around.

 

Thanks!

0 Likes
Message 5 of 7

DJB_CADfx
Enthusiast
Enthusiast

Jeremy,

 

Thanks for the reply. I think you missed a part of my question though. The program already implements a filtered element collector for the parameters and that is functioning properly. The new problem we ran into was that a project required a prefix to the parameter and they used a Label Parameter with a prefix to accomplish this. My original question was how to locate this Label and extract both its Prefix and Parameter value together?.

 

The suggestion by Fair59 to not use a prefix in the Label, but instead use 2 parameters should work. However, I am curious if you know whether or not you can locate a Label object and extract all of its prefix, suffix, parameters etc... using the API or is that not supported at this time?

 

Thanks!

 

Dave Blackburn

 

0 Likes
Message 6 of 7

jeremytammik
Autodesk
Autodesk

Dear Dave,

 

Thank you for your update and glad to hear that Fair59'2 answer looks as if it might help implement solve this issue.

 

Nope, I did not miss that part. Sorry that I did not explain better and missed the point.

 

The problem is that not being a serious Revit user I simply don't understand it. I understand each individual word in the description, but that leaves me absolutely clueless as to what you are really talking about.

 

You do mention that you "have not found the element we are looking for".

 

I do have a standard approach to that question which has always worked for me in the past.

 

It involves use of the element lister:

 

http://thebuildingcoder.typepad.com/blog/2014/09/debugging-and-maintaining-the-image-relationship.ht...

 

Create a starting point A and list all Revit database elements. Modify the model to the state B you desire. List all elements again. Analyse the difference between A and B. That tells you what elements were added. Using RevitLookup or other, more powerful interactive tools, you can explore all their properties and relationships:

 

http://thebuildingcoder.typepad.com/blog/2013/11/intimate-revit-database-exploration-with-the-python...

 

That ought to answer the question.

 

I hope this helps.

 

By the way, if Fair59’s suggestion does resolve the problem and you deem it to be useful for others as well, I am sure a minimal example of how you make use of it would be much appreciated.

 

Thank you!

 

Best regards,

 

Jeremy



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

0 Likes
Message 7 of 7

DJB_CADfx
Enthusiast
Enthusiast

Thanks for the update Jeremy. I fully understand what you're saying as I also am not a Revit user, just a programmer. The Revit users come to me with their problems and I have to figure out solutions to them using the API 🙂  So my Revit knowledge extends only as far as the problems I have had to investigate and figure out a solution to.

 

I understand your suggestion of comparing all elements before & after a change to find the particular element I'm looking for and interrogate it from there. I'll have to give it a try in my spare time (if I ever get any 😉

 

Thanks,

 

Dave Blackburn

0 Likes