# Change Property without re-evaluating [duplicate]

I am working with ContourPlot3D, and my expression takes a long time to evaluate (nearly 20 minutes). So I am wondering if there is a method to changing format properties of an object without having to run through all the calculations again. For example, given the following command (where I use Pause to simulate a somewhat long evaluation):

 x = ContourPlot3D[(Pause[.5]; x^2 + y^2), {x, -3, 3}, {y, -3, 3},
{z, -3, 3},   Contours -> {3}, ContourStyle -> Orange]


Now let's say I actually wanted x to have a Red ContourStyle, is there a way to modify x to have a red contour without having to re-evaluate the entire expression.

• for that specific example you can just do x /. Orange-> Red. I'm sure you want something more general though. – george2079 Jul 29 '15 at 21:09

When you evaluate a ContourPlot3D expression, it will become a Graphics3D expression containing a collection of graphics primitives like Point, Line, and (more complicated) GraphicsComplex.

In your case the expression looks something like this:

Graphics3D[
GraphicsComplex[ ... ],
<options>
]


And your color Orange is in the GraphicsComplex, in the second argument:

GraphicsComplex[
<list of points>,
<list of graphics directives and primitives>
]


Specifically, this second argument of GraphicsComplex contains this graphics directive:

Directive[Rule[Lighting, Automatic], RGBColor[1, 0.5, 0]]


This means that the graphics primitives that come after it are to be rendered with 'Automatic' lighting and Orange (RGBColor[1,0.5,0] face colors. In this case there is only one 'Orange' color, so the replacement rule by @george2079 will work fine. In the more general case you will need to seek out the part of the Graphics3D expression you wish to modify. Functions that help looking at Graphics3D expressions in their unrendered form are:

InputForm[x]
FullForm[x]


This will spit out a lot of data, mostly numbers, which you can condense a bit by replacing lists of numbers (integers or reals) with 'Nothing' (a 10.2 function):

FullForm[x /. {{_Real ..} :> Nothing, {_Integer ..} :> Nothing, _Line :> Nothing}]


This gives the output below, which is still a lot of data to look at, but you can double/triple/etc click on any part of the expression to see what belongs where:

• I closed this question as "already has an answer here:" as I think it has been reasonably addressed there. (But I also voted for your answer.) If you feel that Graphics3D deserves special attention I encourage you to post in that original question instead for better future visibility. – Mr.Wizard Jul 29 '15 at 22:28