.NET

Reply
Member
gcoordinate
Posts: 5
Registered: ‎06-08-2011
Message 1 of 6 (287 Views)

How to overrule on custom object?

287 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
gasty1001
Posts: 582
Registered: ‎04-11-2010
Message 2 of 6 (276 Views)

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
gcoordinate
Posts: 5
Registered: ‎06-08-2011
Message 3 of 6 (258 Views)

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
gasty1001
Posts: 582
Registered: ‎04-11-2010
Message 4 of 6 (251 Views)

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*
norman.yuan
Posts: 1,064
Registered: ‎04-27-2009
Message 5 of 6 (232 Views)

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
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 6 of 6 (212 Views)

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
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.