Linked File, Custom Color Override In Host File

Linked File, Custom Color Override In Host File

Anonymous
Not applicable
1,461 Views
5 Replies
Message 1 of 6

Linked File, Custom Color Override In Host File

Anonymous
Not applicable
Hello Autodesk folks!
 
I have a question regarding the Revit API.
Is there a way to get the custom color override of an object from a linked file? 
 
I have applied the color override in Revit to the linked file however the color is applied to the host file. I've tried using the GetElementOverrides function in the View class, but the ID for the object is from the linked file and the view is from the host file, so it can't find the object or the settings.
 
For example, in the screenshot below, the furniture has a pink color override which I'd like to detect.
RevitCustomColorOverrideSettingsScreenshot.png
Please let me know which API call I should be using to achieve this goal.
 
Thank you!
 
0 Likes
1,462 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

Dear Scott,

 

Thank you for your query.

 

I am a bit confused by your wording and what exactly you are trying to achieve.

 

You say, 'a pink colour override which I would like to detect.'

 

Would you also like to apply it, or is detecting it enough? Why do you want to detect it? To achieve what?

 

The pink colour override that you display in the screen snapshot... is that a setting in the host file or the linked file?

 

I assume in the linked file, or you would be able to determine it, wouldn't you?

 

Do you have code showing how to determine what you are after in the host file?

 

Can't you run the same code in the linked file?

 

Best regards,

 

Jeremy

 



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

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hello Jeremy,

 

Thank you for your reply, sorry for the confusion in my original post. Allow me to clarify what I meant.

 

I have a host file that has a linked file attached to the host. Within this host file, I apply a color override to the linked file using the RVT Link Display settings. I select the Model Categories tab and apply the color override to the furniture category specifically. Within the Model Categories, there is an option to set the override using the Host View, Link View, or <custom>. I chose the <custom> option, so it does not come from the linked file views or from one of the existing host views. So what I am trying to do is detect when the <custom> is used on those specific objects from that linked file and send that color information to my own program. I have already sent the model information to my own program so I just need to apply the same colors to those same furniture objects.

 

I can already get the color overrides in both the host and linked file views using the following code:

{
Category categoryOfInterest = curDocument.Settings.Categories.get_Item(categoryOfInterestName);
OverrideGraphicSettings settings = targetView.GetCategoryOverrides(categoryOfInterest.Id);
}

where curDocument is one of the loaded Documents, and targetView is a View3D from that Document.

 

However, any color overrides in the <custom> settings are ignored. If the targetView is from the host file, GetCategoryOverrides returns the settings for the host file (not the <custom> settings). If the targetView is from the LinkedFile, it returns the settings for the linked file (still not the <custom> settings).

 

I've attached a sample Revit host file (colorOverrideTestFile_HOST.rvt) built from samples that come with Revit 2019. It has a linked file with a color override (colorOverrideTestFile_LINK1.rvt) that is also attached, and a link file without a color override (the rac basic file that comes with Revit) that is not attached. I've also included a sample plugin that I've been using for simple tests that is based on the sample plugin AllViews that is provided with the Revit 2019 SDK. The sample plugin has two approaches that it uses: the one given above that calls GetCategoryOverrides and one that tries to find the information in the material data of output by through the CustomExporter API (I have no idea if this second approach is relevant, which is why it's commented out in the sample plugin).

 

If you open colorOverrideTestFile_HOST.rvt, the furniture in the host file is colored blue due to the override, the furniture from colorOverrideTestFile_LINK1.rvt is red due to the override in that linked file, and the furniture in rac basic is green due to the <custom> settings. If you run the "All Views" external command from the sample plugin, it will find the blue and red overrides, but it will not find the green one. What I'm hoping for is that there is some bit of code that I can add to this sample plugin (and eventually, the actual plugin for our program that I'm working on) that will allow it to find the green color override.

 

I really appreciate your assistance with this issue. Our clients will be incredibly happy if we can get the <custom> working for them.

 

~ Scott

0 Likes
Message 4 of 6

jeremytammik
Autodesk
Autodesk

Dear Scott,

 

Thank you for your update, clarification and sample material.

 

I logged the issue REVIT-141157 [API access to <custom> colour setting in host and linked file] with our development team for this on your behalf as it requires further exploration. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

Best regards,

 

Jeremy

 



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

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hello Jeremy,

 

Thank you for your time and attention to this matter. I appreciate you submitting this issue for consideration. I will be sure to follow up moving forward. 

 

Best Regards, 

 

~ Scott

0 Likes
Message 6 of 6

jeremytammik
Autodesk
Autodesk

Dear Scott,

 

Thank you for your update, appreciation and patience.

 

The development team analysed the issue REVIT-141157 [API access to <custom> colour setting in host and linked file] in depth and came to the following conclusion:

 

There is unfortunately no way to get this information from the API right now. This is something we have to consider as an enhancement for a future release. As you saw, for views set to <By Linked View>, you could pull the information out of the linked document. But <Custom> really demands we provide a link-specific override.

 

Thank you for the very detailed request, by the way. It's very helpful to understanding what you want to do!

 

Sorry for the bad news and thank you again for raising this issue.

 

Best regards,

 

Jeremy

 



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

0 Likes