Problem with overruling transformby

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I implemented Overruling of Transformby, and it works perfectly when i debug the project. The problem is, if i copy this project output dll to my server and try to run it from there, then this overruling option stops working.
Actually i want to overrule move command, because for some of the block references and their attribute references i dont want to perform move operation. I am checking for an xdata as a condition. and it works perfectly when i run locally from my visual studio C# application. i am attaching the c# code here.
public static void ToggleOverrule()
{
try
{
// Initialize Overrule if first time run
if (_drawOverrule == null)
{
_drawOverrule = new OverruleTest();
ObjectOverrule.AddOverrule(RXClass.GetClass(typeof(BlockReference)), _drawOverrule, true);
ObjectOverrule.AddOverrule(RXClass.GetClass(typeof(AttributeReference)), _drawOverrule, true);
}
else
{
Overrule.Overruling = true;
TransformOverrule.Overruling = true;
}
DocumentManager.MdiActiveDocument.Editor.Regen();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
This toggle overrule method is adding the overrules for block reference and attribute reference, and i am calling toggle overrule method in my doc_commandWillStart reactor
static void doc_CommandWillStart(object sender, CommandEventArgs e)
{
if (e.GlobalCommandName == "MOVE")
{
// Method to initialize transform overrule
ToggleOverrule();
}
}
My overrule method is in a different class
/// <summary>
/// Method to perform Overruling of transform command
/// </summary>
public class OverruleTest : TransformOverrule
{
static public OverruleTest theOverrule = new OverruleTest();
//Autodesk.AutoCAD.DatabaseServices.Database db = HostApplicationServices.WorkingDatabase;
public override void TransformBy(Entity e, Matrix3d mat)
{
if (e is BlockReference)
{
if (e.XData != null)
{
bool bCheck = false;
TypedValue[] trAr = e.XData.AsArray();
foreach (TypedValue tp in trAr)
{
// checking whether this equipment is wired or not
if (tp.Value.ToString().Contains(" - Wire") && e is BlockReference)
{
bCheck = true;
break;
}
}
// If the equipment is not wired, then disable the overrule
if (bCheck == false)
{
Overrule.Overruling = false;
TransformOverrule.Overruling = false;
}
}
DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nCannot Move...Wired Equipment...");
}
else if (e is AttributeReference)
{
DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n.");
}
}
}
Here i am performing the xdata check and all.
So what could be the problem ..why it is not working in my server system.
thanks
Jithin Shyam S