Revit links graphic overrides

Revit links graphic overrides

Anonymous
Not applicable
6,068 Views
24 Replies
Message 1 of 25

Revit links graphic overrides

Anonymous
Not applicable

Hello,

 

Is there a way to access the "Revit links graphic overrides" (cf : picture) from the API. I can't find any properties/methods to manipulate them, and if I use the builtin parameter associated to it (BuiltInParameter.VIS_GRAPHICS_RVT_LINKS) it always returns null. Any idea?

Revit_2017-12-07_13-12-44.png

0 Likes
6,069 Views
24 Replies
Replies (24)
Message 2 of 25

FaustoMendezcom
Enthusiast
Enthusiast

Here is some info about that : http://thebuildingcoder.typepad.com/blog/2009/01/hiding-linked-files.html and http://thebuildingcoder.typepad.com/blog/2008/12/linked-files.html

 

you can also use GetElementOverrides Method http://www.revitapidocs.com/2018/af0a58fc-7bdf-02fb-4a20-944ffbe9057b.htm and SetElementOverrides Method http://www.revitapidocs.com/2018/a6f1ced3-1f1c-dd42-c0ca-f15f301d1cad.htm by view.

 

 

            UIDocument uidoc = this.ActiveUIDocument;
			Document doc = uidoc.Document;
            Autodesk.Revit.DB.View view = doc.ActiveView;
            
            Reference sel = uidoc.Selection.PickObject(ObjectType.Element,"select Revit Link") ;
            Element e =doc.GetElement(sel.ElementId);             

            // Get Element Overrides
            view.GetElementOverrides(e.Id).
            
            OverrideGraphicSettings ogs = new OverrideGraphicSettings();

            //Set Halftone Element
            using (Transaction tx = new Transaction(doc))
                    {
tx.Start("Halftone"); ogs.SetHalftone(true); view.SetElementOverrides(e.Id,ogs); tx.Commit(); }

 

Hope it helps 🙂
-------------------------------------------------------------------------------------
www.faustomendez.com
Message 3 of 25

Anonymous
Not applicable

I don't see any underlay property. Is it included under the transparency one?

Edit : It's not working, the given ovg is wrong. Even though I set Halftone to true manualy from Revit, the one I retrieved through the API is set to false.

0 Likes
Message 4 of 25

FaustoMendezcom
Enthusiast
Enthusiast

looks like is there is not posible in the API yet..

 

here is some info I found :

https://forums.autodesk.com/t5/revit-api-forum/change-revit-link-display-settings-and-design-options...

 

https://forums.autodesk.com/t5/revit-architecture-forum/rvt-link-display-settings-batch-changes/td-p...

 

 

Edit: maybe using a view Template...

 

 

image.png

Hope it helps 🙂
-------------------------------------------------------------------------------------
www.faustomendez.com
0 Likes
Message 5 of 25

Anonymous
Not applicable

That's what I taught...

I found those post too, but they were talking about display settings. Since i'm only interested in halftone and underlay, I had some hope.

I used RevitLookup too, to find that there is a parameter for views and templates about V/G graphics settings Rvt Link. But it always return null...

0 Likes
Message 6 of 25

FaustoMendezcom
Enthusiast
Enthusiast

You can still use Windows Automation API and Revit PostCommand to get and set those fields. 

 

 

 

RevitCommandId vgCmdId = RevitCommandId.LookupCommandId("ID_VIEW_CATEGORY_VISIBILITY");

uidoc.Application.PostCommand(vgCmdId);

 

 Jrn.TabCtrl "Modal , Visibility/Graphic Overrides for 3D View: 3D View And Sheets Start View , 0" _
         , "AFX_IDC_TAB_CONTROL" _
         , "Select" , "Revit Links"

Jrn.Grid "ChildControl; Page , Revit Links , Dialog_Revit_RvtLinkVisibility; ID_TREEGRID_GRID" _
        , "MoveCurrentCell" , "1" , "Halftone"

Jrn.Grid "ChildControl; Page , Revit Links , Dialog_Revit_RvtLinkVisibility; ID_TREEGRID_GRID" _
        , "PartialEdit" , "1" , "Halftone" , "Yes"

Jrn.Grid "ChildControl; Page , Revit Links , Dialog_Revit_RvtLinkVisibility; ID_TREEGRID_GRID" _
        , "MoveCurrentCell" , "1" , "Halftone"

 Jrn.PushButton "Modal , Visibility/Graphic Overrides for 3D View: 3D View And Sheets Start View , 0" _
         , "OK, IDOK"

 

Hope it helps 🙂
-------------------------------------------------------------------------------------
www.faustomendez.com
0 Likes
Message 7 of 25

jeremytammik
Autodesk
Autodesk

Dear Fausto,

 

Thank you for this important hint!

 

I think a lot of people would be very interested in using this combination of PostCommand with a bit of .NET Automation API to drive numerous workflows.

 

I would like to promote this idea to a blog post on The Building Coder, if you don't mind.

 

Do you have anything more to add to this code snippet, other, similar, examples to share, or any other useful information that could usefully be included?

 

Thank you!

 

Cheers,

 

Jeremy



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

0 Likes
Message 8 of 25

FaustoMendezcom
Enthusiast
Enthusiast

sure, I will write an example and more post more info. 

 

Thank you. 

Hope it helps 🙂
-------------------------------------------------------------------------------------
www.faustomendez.com
0 Likes
Message 9 of 25

jeremytammik
Autodesk
Autodesk

Dear Fausto,

 

I grabbed what you provided so far and shared that, for safety's sake:

 

http://thebuildingcoder.typepad.com/blog/2017/12/magic-number-magic-automation-and-magic-season.html...

 

Thank you!

 

Cheers,

 

Jeremy



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

0 Likes
Message 10 of 25

Anonymous
Not applicable

Dear Fausto,

 

Could you please tell me how you manage to send Journal commands to a running Revit session?

Best Regards,
Ahmed Nabil

Message 11 of 25

Anonymous
Not applicable

Does there happen to be any videos available that show this process in action?

Message 12 of 25

SwainStrain
Enthusiast
Enthusiast

Hi everyone,

 

I just wanted to check if there is any news about this subject.

I am dealing with the same problem, I got how to launch the Visibility/Graphics modal window through the Postable command, but how can I manage the following steps? (Select the Revit Links tab and change the value of the Halftone property?)

This is my Journal file, how can I simulate the Jrn.TabCtrl, Jrn.Grid and Jrn.PushButton actions?

 

SwainStrain_0-1651500338426.png

 

Thank you very much!

Message 13 of 25

patrickD2V99
Observer
Observer

Did you ever figure this out?

Message 14 of 25

Ta7a
Enthusiast
Enthusiast

hello

 

how to deal with journal commands in C#

 

best regards!

0 Likes
Message 15 of 25

jeremy_tammik
Alumni
Alumni

> how to deal with journal commands in C#

  

First of all, please be aware that use of the journal file for customisation and programming purposes is not officially supported, so if you make use of it, it is at your own risk, and the risk of your customers.

  

The Building Coder shared some experiences in the journal category, and the latest is from Harry Mattison:

    

    

Could you please tell me how you manage to send Journal commands to a running Revit session?

  

I do not believe you can. You can supply a journal file to the copmmand line starting up Revit.exe, but not to a running session, afaik.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 16 of 25

samernajjar
Contributor
Contributor

There has been an update in Revit 2024.2, 2025 and there seems to be some level of access available to control the Visibility Graphics override for Revit Links.
It is still undocumented in https://www.revitapidocs.com/ though

samernajjar_0-1719352122569.png

 

Message 17 of 25

steven.williams.as
Advocate
Advocate

Revit API Docs has the functions documented now: SetLinkOverrides Method (revitapidocs.com)

However, it still does not appear to control Halftone or Underlay: RevitLinkGraphicsSettings only has a ByHostView/ByLinkView for display settings.

0 Likes
Message 18 of 25

jeremy_tammik
Alumni
Alumni

Afaik, RevitApiDocs has not been updated since Revit 2024.0, so you will have to check the Revit API help file in the SDK to look for documentation on newer functionality.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 19 of 25

Luffy11
Participant
Participant

Hi @steven.williams.as , I tried the GetLinkOverrides method, but it returns None. Do you know why? My purpose is to retrieve the overrides of Revit links in a view of a model, then use SetLinkOverrides to set them to the same view in another model (assuming I have two open documents with the same view and links).

Luffy11_1-1756119731700.png

 

 

 

0 Likes
Message 20 of 25

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Luffy11 ,

 

I am unable to reproduce the issue on my end. 

We already have sample code demonstrating how to use the GetLinkOverrides method. You can pass Id of RevitLinkType or RevitLinkInstance.


For example, if you have one Revit Link Type with multiple Revit Link Instances, the result of the GetLinkOverrides method depends on the Id you provide. The method will return the corresponding RevitLinkGraphicsSettings—either for the Revit Link Type itself or for the each specific Revit Link Instance in the view.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes