.NET

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

How to overrule on custom object?

260 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.

Valued Mentor
gasty1001
Posts: 451
Registered: ‎04-11-2010
Message 2 of 6 (249 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 (231 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.

Valued Mentor
gasty1001
Posts: 451
Registered: ‎04-11-2010
Message 4 of 6 (224 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: 970
Registered: ‎04-27-2009
Message 5 of 6 (205 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 (185 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community