60001175 Polyface gradient coloring by elevation

Article 60001175
Type Wish
Product Engine
Version 6018
Date Added 6/23/2010 12:00:00 AM
Fixed (7/9/2010 12:00:00 AM)
Submitted by Wayne Romer

Summary

Polyface gradient coloring by elevation

Solution


In version 6019 a new property GradientColors was added in vdPolyFace object.


Description: Get/Set an array of elevations with their colors used for gradient rendering.


Example in C#:


 


//If the first entity in the Model entities is a vdPolyface object
//then select gradient colors for 5 diferent levels between minimum and maximum elevation of the entity bounding box
vdPolyface pf = doc.Model.Entities[0] as vdPolyface;
if(pf != null){
                ElevatedGradientColors elevColors = new ElevatedGradientColors();
                Box bound = pf.BoundingBox;
                int ncolors = 5;
                for (int i = 0; i < ncolors; i++)
                {
                    elevColors.SetAt((i * (bound.ZMax - bound.ZMin) / ncolors)+bound.ZMin, doc.Palette[i].SystemColor);
                }
                pf.GradientColors = elevColors;
}

//GradientColors are supported only with  vdRender.Mode.Shade , vdRender.Mode.ShadeOn and vdRender.Mode.Render

doc.RenderMode = vdRender.Mode.Shade;

 

Send comments on this topic.