I want to change display of custom object using overrule.
First I made a class implements from polyline.
class BoundaryPolyline : Autodesk.AutoCAD.DatabaseServices.Polyline { }
Second I made a polylineJig to draw my custom polyline(BoundaryPolyline).
public class PolylineJig : EntityJig { public PolylineJig(Point3dCollection p3ds) : base(new BoundaryPolyline()) { ... } ... }
And then add overrule on BoundaryPolyline to change display of it.
Overrule.AddOverrule(RXObject.GetClass(typeof(BoundaryPolyline)), mydrawOverrule, false);
But when I loaded dll, fired overrule and redraw. All polyline display were changed.
Then I found that 'RXObject.GetClass(typeof(BoundaryPolyline)'
was return 'Polyline' but not 'BoundaryPolyline'.
So I am here for help. How to overrule on custom object.
Thanks.
Hi,
Bad news, You can't create custom objects with .NET API, but, good news, you can use the overrulle API with polylines. What you did it's no more than generate an alias for polylines.
Gaston Nunez
Thank you.
Do you know how to add overrule on parts of polylines but not all.
Hi,
I think you can do it listing the segments of the polyline in the WorlDraw override function and taking some action based on the index of each segment, calling WorldDraw.Geometry.XX for the overrulled representation.
Gaston Nunez
Overrule class has various methods to set up filter to target specific entities. Check out Overrule.SetXXXXFilter() methods. You can use ObjectId, Xdata, or ExtensionDictionary as filtering target, or implement IsApplicable() method with whatever logic you defined in conjunction with SetCustomFilter().
Norman Yuan
You might want to keep in mind, that overrules that change the appearance of a drawing can be a bad thing if you must send the drawing to others who do not have or cannot load your plug-in. For example, AutoCAD LT users will not see your overrules custom graphics.
DrawableOverrule is fine for some things, but don't make the mistake of using it to affect how a drawing appears and expect it to appear that way wherever the drawing goes.