Page 1 of 1

Flooded figure

Posted: 17 Jan 2007, 14:27
by AlexUS
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

Flooded figure

Posted: 17 Jan 2007, 19:55
by support
Hello Alex,

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.
And is it possible to floodfill this figure by transparent color? I want entities that are in this region

to be visible.
Transparency is supported for SVG only. Support of other formats will be added in future versions of the library.

Sergey.

Posted: 18 Jan 2007, 11:53
by AlexUS
Hi, Serey
Thank you it works. How can i change the brush style for flooding?

Alex.

Posted: 18 Jan 2007, 13:09
by AlexUS
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?

Flooded figure

Posted: 19 Jan 2007, 17:41
by support
Hi Alex,
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.
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?
As we said in some previous post, Editor serves just to demonstrate editing abilities. It is not full functional editor.
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

Posted: 22 Jan 2007, 16:48
by AlexUS
Hi, Sergey
About changing brush style :

Code: Select all

vHatch.HatchName
vHatch.HatchPatternData
In my VCL component there is no such properties of this properties TsgCADHatch. And I can't compile important line:

Code: Select all

 vHatch.HatchPatternData.Add(vHPData);
I thought that I have the last version of component. Isn't it? I have CADImportVCL_site_beta_010906.

Alex.

Posted: 22 Jan 2007, 16:56
by AlexUS
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:

Code: Select all

var
Flooded : TsgCADCurvePolygon;
...
TsgDXFImage(FsgImage.Picture.Graphic).Converter.DeleteEntity(Flooded, True);
But Flooded stays on FsgImage. Why?
Alex

Posted: 19 Mar 2007, 15:22
by support
Hi Alex,
Hi, 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.
Please try updated library available at: http://www.cadsofttools.com/download/cadimportvcl.zip
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
It is necessary to use the following line:

Code: Select all

FsgImage.Invalidate;
Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Flooded figure

Posted: 20 Mar 2007, 11:43
by AlexUS
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

Posted: 20 Mar 2007, 13:54
by support
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