
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am about to write the function using Overrule API to temporary override object’s colour to ByLayer for all entities in the drawing.
At this moment I just have simple class for testing (just to check if it is possible) and so far I can see problem with complex entities.
Entities such as Line, Polyline even BlockReferences work fine but complex objects like HATCH, MTEXT and LEADER do not change colour as set in SetAttribute method.
Below is simple class I was testing.
public class ByLayerColorOverrule : DrawableOverrule
{
public override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.Drawable drawable, Autodesk.AutoCAD.GraphicsInterface.WorldDraw wd)
{
base.WorldDraw(drawable, wd);
return true;
}
public override int SetAttributes(Drawable d, DrawableTraits t)
{
int b = base.SetAttributes(d, t);
if (d is Entity)
{
// Set color to index 256 - By Layer
t.Color = 256;
}
return b ;
}
}
Any idea what I am doing wrong?
Thank you,
Richard
Solved! Go to Solution.