Adding entity into another entity

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
roman
Posts: 43
Joined: 11 Aug 2011, 11:43

Adding entity into another entity

Post by roman » 11 Aug 2011, 11:51

Hello,

how can I do the following:

There' a drawing with a closed polyline and I schould add a rectangle inside this polygone.
- Is it possibile to add an entity inside another entity, e.g. entity.AddEntity(). - If I use AddEntity i can't see the rectangle.
- Is there a method / class which can tell me if an entity fits inside another one / if two lines are crossing.

Thank you
Roman

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Adding entity into another entity

Post by support » 11 Aug 2011, 17:06

Hello Roman.
Entity placement on drawing defined by coordinates. Rectangle inside closed polyline doesn't belong to polyline's child entities but the separate entity. Just create new CADPolyLine or CADLWPolyLine object with correspond coordinates:

Code: Select all

    if (this.cadImage == null)
    {
        this.cadImage = new CADImage();
        this.cadImage.InitialNewImage();
    }
    this.cadImage.UseDoubleBuffering = false;

    CADLWPolyLine Poly = new CADLWPolyLine();
    Poly.Closed = true;
    Poly.Color = Color.Red;

    CADVertex Vert = new CADVertex();
    Vert.Point = new DPoint(0, 0, 0);
    Poly.AddEntity(Vert);

    Vert = new CADVertex();
    Vert.Point = new DPoint(100, 0, 0);
    Poly.AddEntity(Vert);

    Vert = new CADVertex();
    Vert.Point = new DPoint(100, 100, 0);
    Poly.AddEntity(Vert);

    Vert = new CADVertex();
    Vert.Point = new DPoint(0, 100, 0);
    Poly.AddEntity(Vert);

    Poly.Loaded(this.cadImage.Converter);
    this.cadImage.Converter.OnCreate(Poly);
    this.cadImage.CurrentLayout.AddEntity(Poly);

    this.cadPictBox.Invalidate(); 
There isn't any provided method to check entities placement/crossing. Such functionality can be realized using entities properties.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply