Snap to Intersections

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

Moderators: SDS, support, admin

Post Reply
techrasoft
Posts: 10
Joined: 20 Oct 2005, 07:54
Location: USA

Snap to Intersections

Post by techrasoft » 24 Dec 2005, 07:24

Hi,
I posted a little while ago about snapping to end points. The answer given was very helpful. How can I snap to intersections of lines where two lines cross? There is no point stored...How can this be done?

Thanks.

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

Post by support » 26 Dec 2005, 14:39

Hello,

This task is quite difficult and we need a couple of days to prepare the answer.

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 » 30 Dec 2005, 18:20

Hello,

For calculation of points of mutual crossing of lines it is necessary to start a cycle of pass on Entity and for everyone Entity to start other cycle of pass on Entity.

Delphi code:

Code: Select all

<b>var</b>
  FEntity: TsgDXFEntity;
  FConverter: TsgDXFConverter;
  FCADParams: TsgCADIterate;
  FCADParams2: TsgCADIterate;
...

<b>procedure</b> ReadCADEntities2(Entity: TsgDXFEntity);
<b>begin</b>
  <b>if</b> Entity <b>is</b> TdxfDXFLine <b>then</b>
     GetIntersectingPoint(Entity, FEntity, imPoint); //This is intersection point
<b>end</b>;

<b>procedure</b> ReadCADEntities(Entity: TsgDXFEntity);
<b>begin</b>
  <b>if</b> Entity <b>is</b> TdxfDXFLine <b>then</b>
  <b>begin</b> 
    FEntity := Entity;
    FConverter.Iterate(ReadCADEntities2, FCADParams2);
  <b>end</b>;
<b>end</b>;

<b>procedure</b> StartSearchIntersection;
<b>begin</b>
  FConverter.Iterate(ReadCADEntities, FCADParams);
<b>end</b>;
Sergey

techrasoft
Posts: 10
Joined: 20 Oct 2005, 07:54
Location: USA

Post by techrasoft » 31 Dec 2005, 22:02

Is it possible for the software to iterate through only the points shown on the screen?

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

Post by support » 05 Jan 2006, 12:54

Hello,

The following code must help you (Delphi code):

Code: Select all

<b>var</b>
...
  FDXFImage: TsgDXFImage;
...

<b>function</b> IsEntityVisible(AEntity: TsgDXFEntity);
<b>var</b>
  vRect: TRect;
<b>begin</b>
  vRect.TopLeft := FDXFImage.GetPoint(Entity.Box.TopLeft);
  vRect.BottomRight := FDXFImage.GetPoint(Entity.Box.BottomRight);
  Result := RectVisible(FCanvas.Handle, vRect);
<b>end;</b>
The described on December 30th functions should be changed to:

Code: Select all

<b>procedure</b> ReadCADEntities2(Entity: TsgDXFEntity);
<b>begin</b> 
  <b>if</b> (Entity is TdxfDXFLine) <b>and</b> (IsEntityVisible(Entity)) <b>then</b>
     GetIntersectingPoint(Entity, FEntity, imPoint); //This is intersection point
<b>end;</b>

<b>procedure</b> ReadCADEntities(Entity: TsgDXFEntity);
<b>begin</b> 
  <b>if</b> (Entity <b>is</b> TdxfDXFLine) <b>and</b> (IsEntityVisible(Entity)) <b>then</b>
  <b>begin</b> 
    FEntity := Entity;
    FConverter.Iterate(ReadCADEntities2, FCADParams2);
  <b>end;</b>
<b>end;</b>
Sergey.

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

Post Reply