How to block?

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
agvs
Posts: 30
Joined: 16 Jun 2016, 11:10

How to block?

Post by agvs » 26 Jul 2016, 09:04

Hi,
I'd like to define(make) "block" between circle and hatch.
This is my source:

Code: Select all

private void button1_Click(object sender, EventArgs e)
{
            //circle
            CreateNewImage();
            CADCircle vCircle = new CADCircle();
            vCircle.Color = Color.Red;
            vCircle.Point = new DPoint(100, 100, 0);
            vCircle.Radius = 20;
            PlaceEntity(vCircle);

            //Hatch
            CAD2DEllipse vEllipse = new CAD2DEllipse();
            vEllipse.CenterPoint = vCircle.Point;
            vEllipse.MajorPoint = new CAD2DPoint(20, 0);
            vEllipse.Radius = 1;
            CAD2DBoundaryList vBoundaryList = new CAD2DBoundaryList();
            vBoundaryList.Add(vEllipse);

            CADCurvePolygon vHatch = new CADCurvePolygon();
            vHatch.BoundaryData.Add(vBoundaryList);
            vHatch.Color = Color.Green;
            cadImage.Converter.Loads(vHatch);
            cadImage.CurrentLayout.AddEntity(vHatch);
/////////////////////////////
//Let me know how to define block with both circle and hatch?
////////////////////////////
}
show me a sample source,please.
Thanks,
JHYoon

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

Re: How to block?

Post by support » 26 Jul 2016, 21:20

Hello,

Please add the following code to your routine:

Code: Select all

            // Create definition of a block that includes circle and hatch
            CADBlock vBlock = new CADBlock();
            vBlock.Name = "MyBlock1";
            vBlock.AddEntity(vCircle);
            vBlock.AddEntity(vHatch);
            // Add the block definition into the BLOCKS section
            cadImage.Converter.Blocks.Add(vBlock);
            cadImage.Converter.Loads(vBlock);

            // Create the block reference and insert it into the point (500, 500, 0) on a current layout
            CADInsert vInsert = new CADInsert();
            vInsert.Block = vBlock;
            vInsert.Point = new DPoint(500, 500, 0);
            cadImage.Converter.Loads(vInsert);
            cadImage.CurrentLayout.AddEntity(vInsert);
            cadImage.GetExtents();
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

agvs
Posts: 30
Joined: 16 Jun 2016, 11:10

Not to scale(control) size of the block?

Post by agvs » 29 Jul 2016, 05:58

Thanks for your reply.
Your answer could help me a lot.
I have another question.

I could find out to control size of the block was possible.
Actually, I don’t want to control size of the block. I mean I want the fixed(size) block in my prgram.

In "Editordemo(demo source)”, What part(function) or variables do I have to check?

Let me know.
Attachments
img.png
img.png (45.46 KiB) Viewed 18007 times

Post Reply