Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

highlight and tag linked elements

33 REPLIES 33
Reply
Message 1 of 34
Ning_Zhou
2837 Views, 33 Replies

highlight and tag linked elements

in normal Revit UI you can select linked elements and these selected guys will be automatically highlighted after selection, what about in reverse order? say i have IDs of the linked elements and i want these elements being highlighted, furthermore, i want tag these guys or do similar things to them within host model, possible? in fact,  IDs of the linked elements are from exported Revit's clashing report.

33 REPLIES 33
Message 2 of 34
Ning_Zhou
in reply to: Ning_Zhou

did a quick test using API, i can also select linked elements and will be highlighted automatically if return failed, but these select linked elements won't be reflected in uidoc.selection
so if i knew linked element IDs then how to highlight, and tag or change color, both in host model?
Message 3 of 34
jeremytammik
in reply to: Ning_Zhou

Dear Ning,

 

Thank you for your query.

 

I am afraid that your telegraphic style conveys a very cryptic message.

 

I get some hints and fleeting glimpses of what you may possibly be after, but I am far from certain, so it is very hard to respond, let alone answer.

 

Please take a moment to formulate what you mean, and think of the receiving end when you write.

 

Thank you!

 

You can also explicitly declare you messages as pure inspiring poetical outpourings, so they can be more easily appreciated as such 🙂

 

Sorry for being so blunt and making a joke... I hope you don't mind.

 

I do enjoy riddles, anyway, so here is what I get out of it; I guess that the following two questions may be contained in your messages:

 

Q1. Is the Revit set of selected elements structured as an ordered list, and can I somehow query or control that order?

 

A1. No, as far as I know not.

 

Q2. Given a list of element ids, can I somehow change their colour or otherwise mark them?

 

A2. Yes, as far as I know there are numerous ways to achieve this. I am not absolutely sure of any, though. Maybe one way is to use view filters. They can be controlled as illustrated by the ViewFilters SDK sample. I believe it can be used to toggle a specific element between being displayed in blue and its natural colour by simply changing the value of one of its parameters.

 

I hope this helps.

 

Best regards,

 

Jeremy



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

Message 4 of 34
Ning_Zhou
in reply to: jeremytammik

thanks Jeremy for your reply, and sorry for the confusing question i raised and late reply as i'm currently on the vacation in europe, here is the more clear description (hopefully since i'm writing it in amsterdam even though not in dutch languageSmiley Embarassed)

1) i have a host model A w/ linked model B

2) i knew the IDs of elements in linked model B (from Revit's clashing html report)

3) i want to highlight these elements in host model A

4) furthermore, i want to do tagging or similar stuff to these elements, again in host model A (in normal UI you can only tag rooms from linked model, so i assume it's not possible to tag elements from linked model using API)

cheers,

ning

Message 5 of 34
R.van.den.Bor
in reply to: Ning_Zhou

I need the same thing, I can find the element ID of an element in a linked file, but I want to highlight it thus adding this element to the selection set.

 

 

Simply adding this elementID to the selectionset and giving this to the uidoc doesn't give an error but also doesn't highlight the element in the linked file.

 

uidoc.Selection.SetElementIds(_elemIdSet);

 

 

This post doens't provide an answer 😞  Ning_Zhou, did you manage to highlight an element in a linked file? Or can someone tell me how to achieve this ?

 

 

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 6 of 34
Ning_Zhou
in reply to: R.van.den.Bor

no luck yet as i almost forgot and thanks for revitalizing this post.
Message 7 of 34
jeremytammik
in reply to: Ning_Zhou

Dear Remy and Ning,

 

Thank you for bringing this up again.

 

One way to highlight elements is by using view filters.

 

This is demonstrated programmatically by the ElementFilter/ViewFilters SDK sample.

 

As far as I understand your request, that should fulfil your need, assuming it works also for linked elements.

 

Can you try that out, please?

 

Once you answer that, and if the answer is negative, I can proceed with the next steps, (i) ask the development team for advice and (ii) raise a development issue for this functionality.

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 8 of 34

Hello Jeremy,

 

I don't think view filters will do the trick. I my case I have a list of elements and I want to highlight the element the users clicks in the list.

 

View filters are not ment for highlighting 1 selected element, they are ment to set the visibility for a view for elements that answer to certain rules.

For example, hide or color red all walls with a width smaller then 100mm ect.

 

What I need is to select and highlight 1 element at the time. And I know much of the Revit user interface, and even here I can't acchieve this, so I don't think with the API I will.

 

I think the major problem is that the elementId of elements in a linked document aren't exposed to the main project. So, what I normally do when I want to select an element in the main project, I make an elementID set consisting of 1 element and give this list to the uidoc.Selection like this.

 

uidoc.Selection.SetElementIds(_elemIdSet); 

 

Problem with elements in linked files is, I can get it's elementID, but this elementID can't be used in  the main project. So what I think needs to be done is that the API gets an extra function to select elements in linkedreferences, something like:

 

LinkedDocumentInstance.Selection.SetElementIds(elemIdSet);

 

because every instance of a linkeddocument has it's own elementID in the main project, but the elements in this instance have the same elementID.

The combination that is unique is Linkend document instance elementID + object elementID.

 

So lets say I have a main project file. In this file I have linked IamLink.rvt and placed it 5 times. In the file IamLink.rvt is 1 wall with elementID 123456, then the combinations could be: 

IamLink(1) gets elementID 111111 with element 123456

IamLink(2) gets elementID 111112 with element 123456

 

IamLink(3) gets elementID 111113 with element 123456

 

IamLink(4) gets elementID 111114 with element 123456

 

IamLink(5) gets elementID 111115 with element 123456

 

 

So it would be nice to have a function like:

 

List<ElementId> elemIdSet = new List<ElementId>();

elemIdSet.add(123456);

IamLink(4).Selection.SetElementIds(elemIdSet);

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 9 of 34

Dear Remy,

 

Thank you for your update and clarification.

 

Afaik, there is currently no API access to this functionality.

 

I submitted the wish list item CF-4170 [API wish: highlight and tag linked elements -- 10027136] on your behalf for the functionality you suggest, as this issue requires exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

We also have an existing wish list item CF-2669 [API ability to tag elements in linked document] for related functionality.

 

You are welcome to request an update on the status of these issues or to provide us with additional information at any time quoting these numbers.

 

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.

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 10 of 34
eirik
in reply to: jeremytammik

Dear Jeremy,

 

I have exactly the same issue as R.van.den.Bor. We have a model-check function at our company, that highlights relevant elements, and it would be amazing if it was possible to highlight linked elements as well. Is there any updates on wish list item CF-4170 [API wish: highlight and tag linked elements -- 10027136]?

 

  • Impact on your application and/or your development.
    Major.
  • The number of users affected.
    ~1000

  • The potential revenue impact
    Impossible to answer.
Message 11 of 34
jeremytammik
in reply to: eirik

Dear Eirik,

 

The only thing I have heard about this so far is one member of the development team saying "I routed it to the owner via email for consideration."

 

No further news since then, I'm afraid.

 

Thank you for your business case!

 

That is exactly the kind of information that helps drive this kind of request.

 

Please keep them coming.

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 12 of 34
kinjal
in reply to: jeremytammik

Dear Jeremy,

 

+1 on this request. Not sure how much a vote would affect it's priority.

 

I really look forward to possibility of tagging elements in linked file from within host file.

 

 

  • Impact on your application and/or your development: Moderate+
  • The number of users affected.: 20+ (at least)
  • The potential revenue impact to you: Moderate
  • The potential revenue impact to Autodesk: I think, none
  • Realistic timescale over which a fix would help you: 3 - 5 months.
  • 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.: Not a new request so skipping, but it will have high impact on productivity.

 

Thanks for the good work.

 

Best regards,

Kinjal.

 

Kinjal Desai
Fullstack developer @ Dwaravati
Delivering high quality programmatic boosts for your already beautiful Revit


Message 13 of 34
Moustafa_K
in reply to: jeremytammik

Hi Jeremy

Any luck with this case?


-----------------------------------------------------
Moustafa Khalil
Message 14 of 34
jeremytammik
in reply to: Ning_Zhou

Dear @Ning_Zhou@R.van.den.Bor@eirik@Moustafa_K@kinjal,

 

Here is some more feedback from the development team that you may be able to respond to:

 

Overall this makes sense, although it would help to describe a use case, i.e., actual workflow and add-in that would include selection of elements in linked files.

 

One caveat is that there may be several RvtLinkInstances of the same linked RVT model. So, we will need to pass something like ElementId of the RvtLinkInstance along with the ElementId of the element in the linked model to the SetLinkElements() method.

 

Also this request sounds pretty close to another API for Sub-elements that we are working one. We need to analyse in more depth.

 

Can you describe your use case, please?

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 15 of 34
kinjal
in reply to: jeremytammik

Dear Jeremy,

 

My request originated from a rather simple use case;

 

A client of mine wanted/wants a plugin to quickly tag various elements in current view based on a set of rules. (Doing it manually takes significant time of drafters). The way they organize their Revit projects, a given building they are designing is segmented in various individual .rvt files, ultimately linked together in a 'host' Revit file. They would like to programmatically tag elements (belonging to various linked files) in views belonging to the host file. 

 

I hope this short description serves the purpose, if not please let me know. For specifics, i may have to check with my client before sharing information in public.

Kinjal Desai
Fullstack developer @ Dwaravati
Delivering high quality programmatic boosts for your already beautiful Revit


Message 16 of 34
jeremytammik
in reply to: kinjal

Dear Kinjal,

Thank you for your use case, which I added to the wish list item REVIT-90539 [API wish: highlight linked elements -- 10027136].

Cheers,

Jeremy



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

Message 17 of 34

Please add my vote. This would be extremely valuable. Dale




______________
Yes, I'm Satoshi.
Message 18 of 34

Please add 1024 votes for me 🙂

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 19 of 34
jeremytammik
in reply to: Ning_Zhou

Dear @Dale.Bartlett and @R.van.den.Bor,

 

Please be aware that you have to vote yourself in the Revit Idea Station.

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 20 of 34
m.vallee
in reply to: jeremytammik

Hi everybody,

 

I just want to thank you for the whole interesting discussion here.

 

I came up with the same kind of problem while trying to create a SelectionFilterElement containg IDs of elements located in a linked file.

 

                        ElementMulticategoryFilter multicat_filter = new ElementMulticategoryFilter(categories);
                        var collector = new FilteredElementCollector(document).WherePasses(multicat_filter).WherePasses(epf).ToElementIds().ToList();

                        foreach (var link in linked_docs)
                        {
                            var coll = new FilteredElementCollector(link).WherePasses(multicat_filter).WherePasses(epf).ToElementIds().ToList();
                            collector.AddRange(coll);
                        }


                        filter = SelectionFilterElement.Create(document, filter_name);
                        

                        // Set the elementIds to select, not working for linked elements ID
                        ((SelectionFilterElement)filter).SetElementIds(collector);

Only the IDs that correspond to the host model elements are taken into account by the view filter.

 

@jeremytammik, could you please post the direct link to the Revit Idea Station wish list item, I just can't find it.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community