Restrict change to certain properties

victor_backstrom
Community Visitor

Restrict change to certain properties

victor_backstrom
Community Visitor
Community Visitor

We are developing a plug-in/add-in for AutoCAD 2023 using C# / .NET. Our goal is to restrict users from editing certain properties in the property window.

 

We've noticed that when a property is modified in the dialog, only the "OnLockModeChanged" event seems to trigger. Interestingly, the OnObjectModified event doesn't fire (except when saving the document).

 

So far, our only workaround has been to call e.Veto() within the OnLockModeChanged event.

 

Moreover, neither the OnCommandWillStart nor the OnCommandEnded events trigger when properties are changed.

 

Any ideas?

0 Likes
Reply
233 Views
2 Replies
Replies (2)

norman.yuan
Mentor
Mentor

You can look into ObjectOverrule, which might be helpful/useful. Here is an article about what you want to achieve:

 

https://drive-cad-with-code.blogspot.com/2020/05/prevent-certain-properties-of-entity.html 

 

However, from my experience, not all properties can be prevented from being changed with the code shown in the article, for some reasons.  So, depending on what properties you are targeting, you make sure you test it specifically.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes

ActivistInvestor
Advisor
Advisor

Autodesk completely disabled the static Overruling property because it was causing massive problems, as a result of those using it not realizing that changing it disables or enables all Overrules,  not just the overrule that changes it. 

 

To enable or disable a given Overrule, you must call Add/RemoveOverrule(). 

0 Likes