Prod.: Engine, ver.: 6, ID: 60000550, HowTo : Create 2 circles in lines start and end points in a plane perpendicular to the line

HowTo : Create 2 circles in lines start and end points in a plane perpendicular to the line

Article60000550
TypeHowTo
ProductEngine
Version6
Date Added6/18/2008
Submitted byAtuL Gupta
Keywords

Subject

Create 2 circles in lines start and end points in a plane perpendicular to the line

Summary

How can I create 2 circles in lines start and end points in a plane perpendicular to the line ?

Solution

Try a code like:

private void button3_Click(object sender, EventArgs e)

{
//create a line

VectorDraw.Professional.vdFigures.vdLine line = new VectorDraw.Professional.vdFigures.vdLine();

line.SetUnRegisterDocument(vdFramedControl.BaseControl.ActiveDocument);

line.setDocumentDefaults();

line.StartPoint = new VectorDraw.Geometry.gPoint(2, 3, 4);

line.EndPoint = new VectorDraw.Geometry.gPoint(7, 8, 2);

line.PenColor.SystemColor = Color.Red;

line.PenWidth = .1;

vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(line);

//create a circle at the StartPoin of the previous line

VectorDraw.Professional.vdFigures.vdCircle circle_SP = new VectorDraw.Professional.vdFigures.vdCircle();

circle_SP.SetUnRegisterDocument(vdFramedControl.BaseControl.ActiveDocument);

circle_SP.setDocumentDefaults();

circle_SP.Center = new VectorDraw.Geometry.gPoint(line.StartPoint);

circle_SP.Radius = (double)1.0;

//Set the circle's Extrusion vector to have the direction StartPoint ---> EndPoint

circle_SP.ExtrusionVector = new VectorDraw.Geometry.Vector(new VectorDraw.Geometry.gPoint(line.StartPoint), new VectorDraw.Geometry.gPoint(line.EndPoint));

vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(circle_SP);

//create a circle at the EndPoint of the previous line

VectorDraw.Professional.vdFigures.vdCircle circle_EP = new VectorDraw.Professional.vdFigures.vdCircle();

circle_EP.SetUnRegisterDocument(vdFramedControl.BaseControl.ActiveDocument);

circle_EP.setDocumentDefaults();

circle_EP.Center = new VectorDraw.Geometry.gPoint(line.EndPoint);

circle_EP.Radius = (double)1.0;

//Set the circle's Extrusion vector to have the direction EndPoint ---> StartPoint

circle_EP.ExtrusionVector = new VectorDraw.Geometry.Vector(new VectorDraw.Geometry.gPoint(line.EndPoint), new VectorDraw.Geometry.gPoint(line.StartPoint));

vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(circle_EP);

vdFramedControl.BaseControl.ActiveDocument.CommandAction.Zoom("E", null, null);

vdFramedControl.BaseControl.ActiveDocument.CommandAction.Zoom("S", (double)0.8, null);

MessageBox.Show("Circles with the right extrusion VectorDraw created. Adding some thickness to the circles just to show the results");

circle_SP.Thickness = 0.8;

circle_EP.Thickness = 0.8;

vdFramedControl.BaseControl.ActiveDocument.Redraw(false);

}