.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Gradient Hatch?

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
271 Views, 0 Replies

Gradient Hatch?

I'm trying to create a gradient hatch, but it ends up as a simple SOLID hatch.
The general concept of the code is the following:
The user is asked to select a region by selecting closed planar entities (adding or removing them from the total region). What I want is for the user to be able to see the total region during the selection, by shading it. I've managed to create a hatch corresponding to this region, but its too solid. I need a less rigid shading. To achieve this I try to create a gradient hatch with the following code:

[code]
shadow.SetHatchPattern(HatchPatternType.PreDefined, "SOLID");
shadow.SetGradient(GradientPatternType.PreDefinedGradient, "SPHERICAL");
GradientColor gc1 = new
GradientColor(Autodesk.AutoCAD.Colors.Color.FromColorIndex(
Autodesk.AutoCAD.Colors.ColorMethod.ByColor, 252), 0);
GradientColor gc2 = new
GradientColor(Autodesk.AutoCAD.Colors.Color.FromColorIndex(
Autodesk.AutoCAD.Colors.ColorMethod.ByColor, 252), 1);
GradientColor[] gcs = {gc1, gc2};
shadow.SetGradientColors(gcs);
shadow.ShadeTintValue = 0.5f;

btr.AppendEntity(shadow);
selectionTransaction.AddNewlyCreatedDBObject(shadow, true);
shadow.Associative = true;
Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection objs =
new ObjectIdCollection();
objs.Add(regionId);
shadow.AppendLoop(HatchLoopTypes.Default, objs);
shadow.EvaluateHatch(false);
[/code]

The problem is that the resulting hatch is not gradient. In fact the methods SetGradient, SetGradientColors and ShadeTintValue have no effect. If I omit the first line, an error occurs.

Does anyone know how to create a gradient hatch, or have any idea on how to temporarily show a shaded area?
Thanks
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost