Flooded figure
Moderators: SDS, support, admin
Flooded figure
Hello, Sergey
What TsgDXFEntity can I use for creating flooded region with more then 4 Points (like in TsgDXFSolid)? I mean something like TsgDXFPolyLine but flooded.
And is it possible to floodfill this figure by transparent color? I want entities that are in this region to be visible.
Alex
What TsgDXFEntity can I use for creating flooded region with more then 4 Points (like in TsgDXFSolid)? I mean something like TsgDXFPolyLine but flooded.
And is it possible to floodfill this figure by transparent color? I want entities that are in this region to be visible.
Alex
Flooded figure
Hello Alex,
The following code shows how to add flooded region with more then 4 points:
Sergey.
The following code shows how to add flooded region with more then 4 points:
Code: Select all
uses
... DXFImage, SGImage, DXFConv, sgConsts;
type
TForm1 = class(TForm)
...
btnOpen: TButton;
sgImage1: TsgImage;
OpenDialog1: TOpenDialog;
procedure btnOpenClick(Sender: TObject);
private
{ Private declarations }
...
procedure TForm1.btnOpenClick(Sender: TObject);
var
vImg: TsgDXFImage;
vHatch: TsgCADCurvePolygon;
vBoundaryList: Tsg2DBoundaryList;
vPoly: Tsg2DPolyline;
begin
if not OpenDialog1.Execute then
Exit;
sgImage1.LoadFromFile(OpenDialog1.FileName);
if not(sgImage1.Picture.Graphic is TsgDXFImage) then Exit;
vImg := TsgDXFImage(sgImage1.Picture.Graphic);
vHatch := TsgCADCurvePolygon.Create;
vImg.CurrentLayout.AddEntity(vHatch);
vHatch.SetColor(clGreen);
vBoundaryList := Tsg2DBoundaryList.Create;
vHatch.BoundaryData.Add(vBoundaryList);
vBoundaryList.BoundaryType := 7;
vPoly := Tsg2DPolyline.Create;
vBoundaryList.Add(vPoly);
vPoly.Closed := True;
vPoly.AddVertex(MakeF2DPoint(0, 0));
vPoly.AddVertex(MakeF2DPoint(100, 100));
vPoly.AddVertex(MakeF2DPoint(200, 100));
vPoly.AddVertex(MakeF2DPoint(300, 100));
vPoly.AddVertex(MakeF2DPoint(400, 300));
vPoly.AddVertex(MakeF2DPoint(400, 100));
vPoly.AddVertex(MakeF2DPoint(600, 0));
vImg.Converter.Loads(vHatch);
vImg.CurrentLayout.PaperSpaceBlock.IsLoaded := False;
vImg.Converter.Loads(vImg.CurrentLayout);
vImg.RefreshCurrentLayout;
sgImage1.Refresh;
end;
end.
Transparency is supported for SVG only. Support of other formats will be added in future versions of the library.And is it possible to floodfill this figure by transparent color? I want entities that are in this region
to be visible.
Sergey.
Flooded figure
Hi Alex,
Brush is a Windows term. It is necessary to create hatch pattern in needs to change flooding style. Here goes example:
Currently we prepare CADImportVCL v.6.0. It will include updated but definitely restricted Editor demo.
We'll inform you when new version will be available.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
How can i change the brush style for flooding?
Brush is a Windows term. It is necessary to create hatch pattern in needs to change flooding style. Here goes example:
Code: Select all
uses
... DXFImage, SGImage, DXFConv, sgConsts;
type
TForm1 = class(TForm)
...
btnOpen: TButton;
sgImage1: TsgImage;
OpenDialog1: TOpenDialog;
procedure btnOpenClick(Sender: TObject);
private
{ Private declarations }
...
procedure TForm1.btnOpenClick(Sender: TObject);
var
vImg: TsgDXFImage;
vHPData: PsgHatchPatternData;
vHatch: TsgCADHatch;
v2DBList: Tsg2DBoundaryList;
v2DPolyline: Tsg2DPolyline;
begin
if not OpenDialog1.Execute then
Exit;
sgImage1.LoadFromFile(OpenDialog1.FileName);
if not(sgImage1.Picture.Graphic is TsgDXFImage) then Exit;
vImg := TsgDXFImage(sgImage1.Picture.Graphic);
vHatch := TsgCADHatch.Create;
vImg.CurrentLayout.PaperSpaceBlock.IsLoaded := False;
vImg.CurrentLayout.AddEntity(vHatch);
vHatch.HatchName := 'ANSI31';
v2DBList := Tsg2DBoundaryList.Create;
v2DBList.BoundaryType := 7;// Polyline type
vHatch.BoundaryData.Add(v2DBList);
v2DPolyline := Tsg2DPolyline.Create;
v2DBList.Add(v2DPolyline);
v2DPolyline.AddVertex(MakeF2DPoint(0, 0));
v2DPolyline.AddVertex(MakeF2DPoint(100, 100));
v2DPolyline.AddVertex(MakeF2DPoint(200, 100));
v2DPolyline.AddVertex(MakeF2DPoint(300, 100));
v2DPolyline.AddVertex(MakeF2DPoint(400, 300));
v2DPolyline.AddVertex(MakeF2DPoint(400, 100));
v2DPolyline.AddVertex(MakeF2DPoint(600, 0));
v2DPolyline.Closed := True;
vHatch.SetColor(clBlue);
New(vHPData);
vHPData.BaseP := MakeFPoint(0, 0, 0);
vHPData.Offset := MakeFPoint(-0.1, 0.1, 0);
vHPData.LineAngle := 45.0;
vHPData.IsDash := False;
vHPData.Lines := nil;
vHPData.DashNum := 0;
vHatch.HatchPatternData.Add(vHPData);
vImg.Converter.Loads(vHatch);
vImg.Converter.Loads(vImg.CurrentLayout);
vImg.RefreshCurrentLayout;
sgImage1.Refresh;
end;
end.
As we said in some previous post, Editor serves just to demonstrate editing abilities. It is not full functional editor.And one more thing: after I add TsgCADCurvePolygon I can't select it neither in mmSelect mode nor in mmMultiSelect mode. Why? And how to make possibe to select this Entity?
Currently we prepare CADImportVCL v.6.0. It will include updated but definitely restricted Editor demo.
We'll inform you when new version will be available.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Hi, Sergey
About changing brush style :
In my VCL component there is no such properties of this properties TsgCADHatch. And I can't compile important line:
I thought that I have the last version of component. Isn't it? I have CADImportVCL_site_beta_010906.
Alex.
About changing brush style :
Code: Select all
vHatch.HatchName
vHatch.HatchPatternData
Code: Select all
vHatch.HatchPatternData.Add(vHPData);
Alex.
And one more thing: if I make flooded figure by your previous way I even can't delete it from TsgDXFImage. I make it that way:
But Flooded stays on FsgImage. Why?
Alex
Code: Select all
var
Flooded : TsgCADCurvePolygon;
...
TsgDXFImage(FsgImage.Picture.Graphic).Converter.DeleteEntity(Flooded, True);
Alex
Hi Alex,
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Please try updated library available at: http://www.cadsofttools.com/download/cadimportvcl.zipHi, Sergey
About changing brush style :
vHatch.HatchName
vHatch.HatchPatternData
In my VCL component there is no such properties of this properties TsgCADHatch. And I can't compile important line:
vHatch.HatchPatternData.Add(vHPData);
I thought that I have the last version of component. Isn't it? I have CADImportVCL_site_beta_010906.
Alex.
It is necessary to use the following line:And one more thing: if I make flooded figure by your previous way I even can't delete it from TsgDXFImage. I make it that way:
var
Flooded : TsgCADCurvePolygon;
...
TsgDXFImage(FsgImage.Picture.Graphic).Converter.DeleteEntity(Flooded, True);
But Flooded stays on FsgImage. Why?
Alex
Code: Select all
FsgImage.Invalidate;
Please post questions to the forum or write to support@cadsofttools.com
Flooded figure
Hi, Sergey
Please try updated library available at: http://www.cadsofttools.com/download/cadimportvcl.zip
Now i'm using licensed DXFImportVCL and i need updated component for check changes that you've made in new library.
How soon will we have updated library for our bought component?
Alex
Please try updated library available at: http://www.cadsofttools.com/download/cadimportvcl.zip
Now i'm using licensed DXFImportVCL and i need updated component for check changes that you've made in new library.
How soon will we have updated library for our bought component?
Alex
Hi, Alex!
Please contact to our executive manager Evgeny Chuzhakin on info@cadsofttools.com with a reference to this topic. He will answer you at once after receiving your inquiry.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Please contact to our executive manager Evgeny Chuzhakin on info@cadsofttools.com with a reference to this topic. He will answer you at once after receiving your inquiry.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com