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

How to overrule on custom object?

5 REPLIES 5
Reply
Message 1 of 6
gcoordinate
784 Views, 5 Replies

How to overrule on custom object?

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.

Tags (1)
5 REPLIES 5
Message 2 of 6
hgasty1001
in reply to: gcoordinate

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

Message 3 of 6
gcoordinate
in reply to: hgasty1001

Thank you.

 

Do you know how to add overrule on parts of polylines but not all.

Message 4 of 6
hgasty1001
in reply to: gcoordinate

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

 

 

Message 5 of 6
norman.yuan
in reply to: gcoordinate

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().

Message 6 of 6

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.

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