.NET

Reply
Active Contributor
Posts: 31
Registered: ‎09-11-2009
Message 1 of 3 (429 Views)

Problem with overruling transformby

429 Views, 2 Replies
03-01-2011 09:29 PM

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

 

 

Moderator
Alexander.Rivilis
Posts: 1,346
Registered: ‎04-09-2008
Message 2 of 3 (421 Views)

Re: Problem with overruling transformby

03-02-2011 12:40 AM in reply to: jithin.dcs

Is dll-file loaded in AutoCAD without errors? What about security permission?


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Contributor
Posts: 31
Registered: ‎09-11-2009
Message 3 of 3 (417 Views)

Re: Problem with overruling transformby

03-02-2011 01:29 AM in reply to: Alexander.Rivilis

hi,

 

thanks for the reply.

 

Actually that dll is working from a long time from my server.

Usually if any changes need to be done, then i will be making the changes from my computer and building the application and copy the dll to the server. so there are so many other functionalities performed by this dll and those things are still working perfectly, except this part. so there is no errors or security permission issues.. and i tried putting a message box in both Toggleoverrule method and override transformby method. but only the message box in toggleoverrule method has shown.. the other it didnt displayed.

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community