# Object display mode (with GUID) using python script

**URL:** <https://discourse.mcneel.com/t/object-display-mode-with-guid-using-python-script/151127>\
**Category:** Rhino Developer\
**Tags:** mac, rhino7\
**Created:** [November 24, 2022, 9:55am UTC](https://discourse.mcneel.com/t/object-display-mode-with-guid-using-python-script/151127 "2022-11-24T09:55:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kanika\_Rajain](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/kanika_rajain/32/632562_2.png) [@Kanika\_Rajain](https://discourse.mcneel.com/u/Kanika_Rajain)\
**Post date:** [November 24, 2022, 9:55am UTC](https://discourse.mcneel.com/t/object-display-mode-with-guid-using-python-script/151127/1 "2022-11-24T09:55:06Z")

</div>

I found this:

> **[Object Display Mode](https://developer.rhino3d.com/samples/rhinocommon/object-display-mode/)**
>
> Demonstrates how to set the object display mode of a user-specified mesh or surface.

I have to apply “ghosted” mode for 100 objects. From this script I need to select the display mode for every single object (which I want to avoid).

I don’t want to change the display mode by selecting the object in Rhino. I want to create the object using script and change the display mode at the same time (similar to “setobjectdisplaymode” option).

---

<div class="post-metadata">

**Author:** ![Kanika\_Rajain](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/kanika_rajain/32/632562_2.png) [@Kanika\_Rajain](https://discourse.mcneel.com/u/Kanika_Rajain)\
**Post date:** [November 24, 2022, 10:07am UTC](https://discourse.mcneel.com/t/object-display-mode-with-guid-using-python-script/151127/2 "2022-11-24T10:07:42Z")

</div>

Here is code snippet:

 ![Screen Shot 2022-11-24 at 11.04.57 AM](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/4/f/94fbf47d7418bf165befcc3f17a531c248ab12f5.png)

---

<div class="post-metadata">

**Author:** ![Darryl\_Menezes](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/darryl_menezes/32/334445_2.png) [@Darryl\_Menezes](https://discourse.mcneel.com/u/Darryl_Menezes)\
**Post date:** [November 24, 2022, 1:33pm UTC](https://discourse.mcneel.com/t/object-display-mode-with-guid-using-python-script/151127/3 "2022-11-24T13:33:27Z")

</div>

Hi @Kanika_Rajain ,  
you can use RhinoCommon to override the display mode for your object as follows:

```auto
import rhinoscriptsyntax as rs
import Rhino

ghostedMode = Rhino.Display.DisplayModeDescription.GetDisplayMode(Rhino.Display.DisplayModeDescription.GhostedId)

for k in range(10):
    obj1 = rs.AddSphere([k,0,0],.5)
    rs.ObjectColor(obj1,(255,144,115))
    rhinoObject = rs.coercerhinoobject(obj1)
    rhinoObject.Attributes.SetDisplayModeOverride(ghostedMode);
    rhinoObject.CommitChanges()

```

---

<div class="post-metadata">

**Author:** ![Kanika\_Rajain](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/kanika_rajain/32/632562_2.png) [@Kanika\_Rajain](https://discourse.mcneel.com/u/Kanika_Rajain)\
**Post date:** [November 25, 2022, 7:06am UTC](https://discourse.mcneel.com/t/object-display-mode-with-guid-using-python-script/151127/4 "2022-11-25T07:06:46Z")

</div>

Perfect, thanks!
