How can I write overrule rules that don't affect the changes I make through my plugin?

How can I write overrule rules that don't affect the changes I make through my plugin?

Gepaha
Collaborator Collaborator
302 Views
2 Replies
Message 1 of 3

How can I write overrule rules that don't affect the changes I make through my plugin?

Gepaha
Collaborator
Collaborator

Hi!

I apologize upfront for not posting any code, but the question seems quite theoretical and many people have probably experienced this problem.

I've been using the overrule to prevent entities from being modified, deleted, etc. However, when I modify these entities through the plugin I wrote, they are affected by the overrule. A seemingly obvious way to work around this problem is to temporarily disable the overrule, and that's what I've been doing.

Is there a way to distinguish between changes made by the user using AutoCAD commands and those made through the plug-in?

What is the most efficient way to deal with this?

0 Likes
Accepted solutions (1)
303 Views
2 Replies
Replies (2)
Message 2 of 3

ActivistInvestor
Mentor
Mentor
Accepted solution

Disabling/enabling the overrule before/after your app makes changes is the obvious way and results in the least amount of overhead. But you could also simply set/clear a Boolean flag in your app before/after you make changes and check the flag from your overrule as well. Don't make the mistake of using the static Overruling property because it was disabled a long time ago, and no longer works.

0 Likes
Message 3 of 3

Gepaha
Collaborator
Collaborator

I've always used the method of enabling/disabling the overrule, and logically, as you said, it causes overhead, which is why I'm looking for something simpler and better.

Using a boolean flag requires the use of a static variable or static property, probably with a specific class creation.

Actually, I was hoping there was a simpler solution, an already existing implementation. Maybe using the "CMDNAMES" variable in IsApplicable, in short, a one-line code.

Thank you very much for your reply, I will try to implement this with a boolean flag.

0 Likes