.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with overruling transformby

2 REPLIES 2
Reply
Message 1 of 3
jithin.dcs
958 Views, 2 Replies

Problem with overruling transformby

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

 

 

2 REPLIES 2
Message 2 of 3

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

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 3 of 3

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.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost