Add Hatch to Ellipse
Posted: 05 Dec 2008, 07:20
Hello,
I have a .dxf file just contain 1 ellipse entity.
how can i add hatch on it ?
I have a .dxf file just contain 1 ellipse entity.
how can i add hatch on it ?
CADSoftTools - AutoCAD DWG DXF HPGL (PLT) SVG CGM STEP IGES STL SAT viewers, converters and developer tools. Delphi and C# source code.
https://cadsofttools.com/forum/
Code: Select all
private void btnAddHatchOnEllipsePoints_Click(object sender, System.EventArgs e)
{
if(this.cadImage == null)
{
this.cadImage = new CADImage();
this.cadImage.InitialNewImage();
this.cadImage.UseDoubleBuffering = false;
}
this.cadImage.UseDoubleBuffering = false;
int entCount = this.cadImage.Converter.GetCounts(CADImport.FaceModule.ConvSection.Entities);
for(int i=0;i<entCount;i++)
{
if(this.cadImage.Converter.GetSection(CADImport.FaceModule.ConvSection.Entities).Entities[i] is
CADEllipse)
{
CADEllipse entEllipse =
(CADEllipse)this.cadImage.Converter.GetSection(CADImport.FaceModule.ConvSection.Entities).Entities[i];
CADHatch Hatch = new CADHatch();
Hatch.HatchName = "ANSI31";
CAD2DBoundaryList v2DBList = new CAD2DBoundaryList();
v2DBList.BoundaryType = 7;// Polyline type
Hatch.BoundaryData.Add(v2DBList);
CAD2DPolyline v2DPolyline = new CAD2DPolyline();
v2DBList.Add(v2DPolyline);
CAD2DPoint ent2DPoint;
DPoint Point;
for(int j=0;j<entEllipse.PolyPoints.Count;j++)
{
Point = (DPoint)entEllipse.PolyPoints[j];
ent2DPoint = new CAD2DPoint(Point.X,Point.Y);
v2DPolyline.Vertexes.Add(ent2DPoint);
}
v2DPolyline.Closed = true;
Hatch.Color = Color.Azure;
HatchPatternData vHPData = new HatchPatternData();
vHPData.baseP = new DPoint(0, 0, 0);
vHPData.offset = new DPoint(300, 300, 0);
vHPData.lineAngle = 40.0f;
vHPData.isDash = false;
vHPData.lines = null;
vHPData.dashNum = 0;
Hatch.HatchPatternData.Add(vHPData);
Hatch.Loaded(this.cadImage.Converter);
this.cadImage.CurrentLayout.Entities.Add(Hatch);
this.cadImage.Converter.OnCreate(Hatch);
}
}
this.ResizeLayout();
}
The common way is just as it was shown in the code example. Generally saying every new hatch requires personal solution.Is there a common way to add hatch on diffrent kind entity ? (such as circle, ellipse, PolyLine ....)
We have found this problem.I have another question :
I use the “MergeFilesDemoSite” program to merge 3 dxf files and save as a new .dxf file, but when I open the new .dxf file with “ViewerControlDemo “ program I got nothing (cann’t see anything), could you tell me the cause?
The problem has been solved.We have found this problem.I have another question :
I use the “MergeFilesDemoSite” program to merge 3 dxf files and save as a new .dxf file, but when I open the new .dxf file with “ViewerControlDemo “ program I got nothing (cann’t see anything), could you tell me the cause?
We will inform you when it is solved.