overruled!

Here's a sample using the new overrule classes  in the .net API. All vertical lines are overruled to display as red and horizontal as blue. Of course you can set your own criteria, line length, circle diameter etc. To top it off its, surprisingly fast, I didn't notice any slowdowns at all. Powerful stuff really

Command class

[code]
using _AcAp = Bricscad.ApplicationServices;
using _AcDb = Teigha.DatabaseServices;
// alias
using _AcTrx = Teigha.Runtime;
[assembly: _AcTrx.CommandClass(typeof(Overruled.Command))]

namespace Overruled
{
  public static class Command
  {
    internal static Overruler mDrawOverrule = null;

    [_AcTrx.CommandMethod("doit")]
    public static void doit()
    {
      if (mDrawOverrule == null)
      {
        mDrawOverrule = new Overruler();
        _AcTrx.Overrule.AddOverrule(_AcTrx.RXObject.GetClass(typeof(_AcDb.Line)), mDrawOverrule, false);
        _AcTrx.Overrule.Overruling = true;
      }
      else
      {
        _AcTrx.Overrule.RemoveOverrule(_AcTrx.RXObject.GetClass(typeof(_AcDb.Line)), mDrawOverrule);
        _AcTrx.Overrule.Overruling = false;
        mDrawOverrule = null;
      }
      _AcAp.Application.DocumentManager.MdiActiveDocument.Editor.Regen();
    }
  }
}

[/code]

Overrule class

[code]

using _AcAp = Bricscad.ApplicationServices;
using _AcDb = Teigha.DatabaseServices;
// alias
using _AcTrx = Teigha.Runtime;


[assembly: _AcTrx.CommandClass(typeof(Overruled.Command))]

namespace Overruled
{
  public static class Command
  {
    internal static Overruler mDrawOverrule = null;

    [_AcTrx.CommandMethod("doit")]
    public static void doit()
    {
      if (mDrawOverrule == null)
      {
        mDrawOverrule = new Overruler();
        _AcTrx.Overrule.AddOverrule(_AcTrx.RXObject.GetClass(typeof(_AcDb.Line)), mDrawOverrule, false);
        _AcTrx.Overrule.Overruling = true;
      }
      else
      {
        _AcTrx.Overrule.RemoveOverrule(_AcTrx.RXObject.GetClass(typeof(_AcDb.Line)), mDrawOverrule);
        _AcTrx.Overrule.Overruling = false;
        mDrawOverrule = null;
      }
      _AcAp.Application.DocumentManager.MdiActiveDocument.Editor.Regen();
    }
  }
}

[/code]

Comments

  • Woops, that code did not come out right.  Here is the solution attached!.. now that we can : )

    netload the Overruled.dll in the release folder and type doit : )

    Overruled.zip

This discussion has been closed.