Page 1 of 1

How to block?

Posted: 26 Jul 2016, 09:04
by agvs
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

Re: How to block?

Posted: 26 Jul 2016, 21:20
by support
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

Not to scale(control) size of the block?

Posted: 29 Jul 2016, 05:58
by agvs
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.