.NET

.NET

Reply
Active Contributor
31 Posts
0 Kudos
Registered: ‎09-11-2009
Post 1 of 3

Problem with overruling transformby

525 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
1,465 Posts
277 Kudos
Registered: ‎04-09-2008
Post 2 of 3

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
31 Posts
0 Kudos
Registered: ‎09-11-2009
Post 3 of 3

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.

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!