.NET

Reply
Member
5 Posts
0 Kudos
Registered: ‎06-08-2011
Post 1 of 6

How to overrule on custom object?

292 Views, 5 Replies
08-09-2012 06:53 AM

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.

Distinguished Mentor
582 Posts
91 Kudos
Registered: ‎04-11-2010
Post 2 of 6

Re: How to overrule on custom object?

08-09-2012 09:15 AM 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

Member
5 Posts
0 Kudos
Registered: ‎06-08-2011
Post 3 of 6

Re: How to overrule on custom object?

08-09-2012 04:26 PM in reply to: gasty1001

Thank you.

 

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

Distinguished Mentor
582 Posts
91 Kudos
Registered: ‎04-11-2010
Post 4 of 6

Re: How to overrule on custom object?

08-09-2012 07:14 PM 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

 

 

*Expert Elite*
1,087 Posts
217 Kudos
Registered: ‎04-27-2009
Post 5 of 6

Re: How to overrule on custom object?

08-10-2012 06:53 AM 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().

Valued Mentor
370 Posts
175 Kudos
Registered: ‎05-06-2012
Post 6 of 6

Re: How to overrule on custom object?

08-10-2012 10:29 PM in reply to: gcoordinate

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.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!