How can I use TsgDXFHatch In D7?

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
lhasha
Posts: 3
Joined: 25 Nov 2005, 11:00

How can I use TsgDXFHatch In D7?

Post by lhasha » 25 Nov 2005, 11:06

how to hatch a circle or a Rect? show me a demo,pleaese!

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 25 Nov 2005, 18:16

Hello,

CADImportVCL (http://www.cadsofttools.com/download/CADImportVCL.zip) in correspondent lib folders (for different Delphi and C++ Builder versions) containes DXFImage.pas. We would like you to pay attention on

Code: Select all

procedure TsgDXFImage.DrawHatch(Sender: TObject);
in DXFImage.pas module.

Sergey.

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

lhasha
Posts: 3
Joined: 25 Nov 2005, 11:00

Post by lhasha » 28 Nov 2005, 06:00

hi,
There is no Demo for DrawHatch(Sender: TObject) in "CADImportVCL.zip".
And can not compile the souce including TsgDXFImage.DrawHatch.
would you please give me a Demo with DrawHatch?

lhasha.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 29 Nov 2005, 11:12

Dear lhasha,

We have no special Demo program that demonstrates the way of drawing Hatches. Module DXFImage.pas is being used in View demo for drawing all types of hatches from CAD files (AutoCAD: DWG, DXF; Hewlett-Packard HPGL; Scalable Vector Graphics: SVG; Computer Graphics Metafile: CGM) . This functionality is implemented in mentioned above

Code: Select all

procedure TsgDXFImage.DrawHatch(Sender: TObject);
This demo is available in CADImportVCL package:

for Delphi:
CADImportVCL\Delphi\Demos\Viewer

for C++ Builder 6.0:
CADImportVCL\CBuilder\BCB6\Viewer

Module DXFImage.pas is in correspondent Lib folders:

for Delphi:
CADImportVCL\Delphi\Lib[2005win32] [7][6][5][4][3]

for C++ Builder:
CADImportVCL\CBuilder\BCB[6]\Lib [5][4]

Sergey

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

lhasha
Posts: 3
Joined: 25 Nov 2005, 11:00

Post by lhasha » 01 Dec 2005, 06:54

Dear Sergey,
I am very sorry that I can not find any Code about "DrawHatch" in the "CADImportVCL\Delphi\Demos\Viewer".
Althougth there is " procedure TsgDXFImage.DrawHatch(Sender: TObject);" in TsgDXFImage.pas,but you can not use the procedur "DrawHatch".

I feel very depressed.

Lhasha.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 01 Dec 2005, 12:48

Dear lhasha,

We need a couple of days to prepare a special demo with example of creating hatches.

Sergey.

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

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 26 Sep 2007, 11:18

Hello!

The following code works with <b>CAD Import VCL v.6.1</b>:

Code: Select all

<b>procedure</b> TForm1.btnHatchOnPolyClick(Sender: TObject);
<b>var</b>
  vPolyHatch: TsgCADCurvePolygon;
  v2DBList: Tsg2DBoundaryList;
  v2DPoly: Tsg2DPolyline;
  vPoly: TsgDXFPolyline;
  vVertex: TsgDXFVertex;
  K, J, CNt: Integer;
  vImg: TsgDXFImage;
<b>begin
  if</b> sgPaintBox.Picture.Graphic <b>is</b> TsgDXFImage <b>then</b>
    vImg := TsgDXFImage(sgPaintBox.Picture.Graphic)
  <b>else</b>
    Exit;

  CNt := vImg.CurrentLayout.Count - 1;
  <b>for</b> K :=0 <b>to</b> CNt <b>do
  begin
    if</b> vImg.CurrentLayout.Entities[K] <b>is</b> TsgDXFPolyline <b>then
    begin</b>
      vPoly := TsgDXFPolyline(vImg.CurrentLayout.Entities[K]);
      vPolyHatch := TsgCADCurvePolygon.Create;
      vImg.CurrentLayout.AddEntity(vPolyHatch);
      vPolyHatch.Color := clRed;
      v2DBList := Tsg2DBoundaryList.Create;
      vPolyHatch.BoundaryData.Add(v2DBList);
      v2DBList.BoundaryType := 7;<i><font color="blue">// Polyline type</i></font id="blue">
      v2DPoly := Tsg2DPolyline.Create;
      v2DBList.Add(v2DPoly);

      <b>for</b> J := 0 <b>to</b> vPoly.Count - 1 <b>do
      begin</b>
        vVertex := TsgDXFVertex(vPoly.Entities[J]);
        v2DPoly.AddVertex(MakeF2DPoint(vVertex.Point.X , vVertex.Point. Y));
      <b>end</b>;
      <b>if</b> vPoly.Closed <b>then
      begin</b>
        vVertex := TsgDXFVertex(vPoly.Entities[0]);
        v2DPoly.AddVertex(MakeF2DPoint(vVertex.Point.X , vVertex.Point. Y));
      <b>end</b>;
        <b>if</b> Assigned(vImg.Converter.OnCreate) <b>then</b>
          vImg.Converter.OnCreate(vPolyHatch);
        vImg.Converter.Loads(vPolyHatch);
    <b>end</b>;
  <b>end</b>;
  vImg.GetExtents;
  sgPaintBox.Invalidate;
<b>end</b>;
Sergey.

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

Post Reply