How to Explode Text

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

Moderators: SDS, support, admin

Post Reply
AlexBV
Posts: 10
Joined: 08 May 2020, 23:33

How to Explode Text

Post by AlexBV » 09 May 2020, 02:03

I know it is possible to extract the actual coordinates from a Text and MText..
Ho to do it ??
With GetTextPolylines ???
I get the list ...but I do not know how to Extract the entities..

I would appreciate a little Delphi example !!

Thanks

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

Re: How to Explode Text

Post by support » 13 May 2020, 12:15

Hello,

What do you mean by "actual coordinates"? Is a Text/MText located in a block?

Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

AlexBV
Posts: 10
Joined: 08 May 2020, 23:33

Re: How to Explode Text

Post by AlexBV » 23 May 2020, 18:04

>Hello,
>What do you mean by "actual coordinates"? Is a Text/MText located in a block?
>Mikhail

Dear @Mikhail

With the very illustrative code you wrote in other post (exploiting blocks), it is possible to explode MText to Text.
What I need is to get additionally the actual line stroke of each text component, like if I was going to plot it manually (move to (xy) lineto (xy)). without having to use the shx. I know it sounds silly but I am converting each point, line stroke to a 2 parallel and simultaneous and different spaces... (3d to two stereoscopic projections) ..

Thank you so much !!

Alex

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

Re: How to Explode Text

Post by support » 25 May 2020, 19:55

Hello Alex,

There is a TsgDXFConverter.GetTextPolylines function which converts a TsgDXFText object (AText) into a TList of lists of points (AList):

Code: Select all

function TsgDXFConverter.GetTextPolylines(const AText: TsgDXFText; const AList: TList): Integer;
To create polylines from the received TList, use the following procedure:

Code: Select all

  procedure CreatePolylines(ACADImage: TsgCADImage; const AList: TList);
  var
    I, J: Integer;
    vPoly: TsgDXFPolyline;
    vVertex: TsgDXFVertex;
    vContour: TList;
  begin
    for I := 0 to AList.Count - 1 do
    begin
      vPoly := TsgDXFPolyline.Create();
      vPoly.Color := clRed;
      vPoly.Closed := False;
      vContour := AList[I];
      for J := 0 to vContour.Count - 1 do
      begin
        vVertex := TsgDXFVertex.Create();
        vVertex.Point := TFPoint(vContour[J]^);
        vPoly.AddEntity(vVertex);
      end;
      ACADImage.Converter.Loads(vPoly);
      ACADImage.CurrentLayout.AddEntity(vPoly);
    end;
    ACADImage.GetExtents();
    vContour.Free;
  end;
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

AlexBV
Posts: 10
Joined: 08 May 2020, 23:33

Re: How to Explode Text

Post by AlexBV » 26 May 2020, 20:46

Mikhail

This is exactly what I was looking for..

Thank you so much !!

Post Reply