I am currently preparing an example to try to stress the Overrule methods in an attempt to discover their limits and also acquire knowledge.
As soon as I finish the code, I will post it here.
I've recently embarked on a journey to delve deeper into the capabilities of AutoCAD's .NET API, particularly focusing on the concept of overrules to customize object behaviors and graphical representations. The fruit of this exploration is a GitHub repository that I've put together, which you can find here:
Flex_Tube on GitHub.While working with overrules, I stumbled upon a challenge that I think is worth discussing. When a document is opened by a different department, the custom graphical representations and behaviors might not be applied. This means that a polyline could potentially be exploded, and the extension dictionary might get lost. From my perspective, there are two possible solutions to this:
1 - Distributing a .dll that contains the overrule methods (excluding editing methods). This, however, requires the end-user to have a CAD version that supports .dll file loading.
2 - Creating an anonymous block containing the modified object's graphical representation and freezing the involved layers. The question then becomes: when should this conversion method be executed? What's the most suitable event for this action?
It's also worth noting that the overrule method for grips is commented out in the Commands class, as it occasionally exhibits unpredictable behavior, but is fun to test.
I'm sharing this repository not only as a resource, but also as an invitation for feedback and contributions. If you have the opportunity, I would appreciate it if you could test the code and maybe even contribute. Additionally, I'm eager to hear from more experienced developers who might have ideas on how to further refine and improve the code and/or my way of programming.
I look forward to your thoughts and contributions on this project.
Best regards, Luís Augusto.
Edit:
I forgot some important things:
1 - The FLEX command must be applied to polylines.
2 - Polylines must have rounded corners.
3 - The tube diameter must respect the polyline curves, otherwise the graphic representation may not be adequate or expected.
The size of the text on the tube can be changed with the TEXTSIZE variable.
As this is a code example, the dimensions are in millimeters for me. I don't know if this is linked to Cultura Corrente, but I inserted an mm at the end of the text.
It may be that in different locations this behavior is different.