How to make truly NOT splitted arcs

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

Moderators: SDS, support, admin

Post Reply
AlexUS
Posts: 53
Joined: 05 Dec 2006, 14:44

How to make truly NOT splitted arcs

Post by AlexUS » 07 Dec 2006, 13:31

Dear Sergey!
Thank you for your answers. I have one more question.

Code: Select all

<b>procedure</b> TfmMain.btnSplittedArcClick(Sender: TObject);
<b>begin</b>
   TsgDXFImage(FManager.sgImage.Picture.Graphic).UseWinEllipse := not btnSplittedArc.Down;
<b>end</b>;
It means that all arcs on image will be splitted/not splitted.
But in fact it makes not splitted only circles and separate arcs.

This property doesn't work on Ellipses and SpLines and on Arcs that were used in Polyline.
How to make all these elements smooth?

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

Post by support » 07 Dec 2006, 16:28

Hello AlexUS,

Property <b>UseWinEllipse</b> works only for simple arcs, circles and ellipses.

<b>property</b> TsgDXFImage.UseWinEllipse: Boolean
<b>Description</b>
Set <b>UseWinEllipse</b> to True for drawing most of the arcs and circles in the image using <b>GDI Windows</b> functions such as Ellipse, Arc, etc., not linearized. If <b>UseWinEllipse</b> is False (default) all the arcs and circles in the image will be drawn as a row of lines.
<b>Note</b>:
<ul><li>Dotted arcs and circles are always linearized.</li>
<li>Arcs and circles in the 3D drawings (property Is3D is True) are always linearized.</li></ul>
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">How to make all these elements smooth?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Please try the following:
<i>Demo <b>Viewer</b>, Unit1.pas: add new button and load a file with ars, ellipses and splines</i>:

Code: Select all

...
<b>var</b>
  Form1: TForm1;
  Img: TsgDXFImage;

<b>procedure</b> TForm1.Button1Click(Sender: TObject);
<b>var</b>
  I, J: Integer;
<b>begin</b>
  Img.Converter.NumberOfPartsInSpline := 2;
  Img.Converter.NumberOfPartsInCircle := 5;
  sgPaintBox.Invalidate;
<b>end</b>;
Sergey.

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

AlexUS
Posts: 53
Joined: 05 Dec 2006, 14:44

Post by AlexUS » 07 Dec 2006, 17:23

No, Sergey. I need to meke it the other.

<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
Img.Converter.NumberOfPartsInSpline := 2;
Img.Converter.NumberOfPartsInCircle := 5;
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

It makes circles and Splines linearized. But I need to make them smooth (not splitted). All Splines by default consist of 24 parts, but I want to make them continuous. Is it possible?

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

Post by support » 07 Dec 2006, 17:53

Have you tried to set another values, for instance:

Code: Select all

Img.Converter.NumberOfPartsInSpline := 48;
Img.Converter.NumberOfPartsInCircle := 48;
Sergey

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

AlexUS
Posts: 53
Joined: 05 Dec 2006, 14:44

Post by AlexUS » 08 Dec 2006, 13:14

Hi, Sergey!
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Have you tried to set another values, for instance:


Img.Converter.NumberOfPartsInSpline := 48;
Img.Converter.NumberOfPartsInCircle := 48;<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Yes, of cource I tried these values (they are default when file is opened)
These values just make more number of parts in arc or in ellipse. It's possible to set them equal to 200 or more but in fact arc and ellipse will stay polyline and it will slow down programm.
I found that property of TsgDXFImage UseWinEllipse doesn't work correctly even with simple circles. I've sent you e-mail with file. I think there is problem in Converter.VPort. Why do you demand it to be (0,0,1)? What if VPort.Z changes?

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

Post by support » 08 Dec 2006, 16:08

Hi Alex,

Thank you for the file.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Yes, of cource I tried these values (they are default when file is opened)
These values just make more number of parts in arc or in ellipse. It's possible to set them equal to 200 or more but in fact arc and ellipse will stay polyline and it will slow down programm.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Please find <b>procedure</b> TsgDXFImage.DrawCircle(Sender: TObject); in the <b>DXFImage.pas</b> and change it as the following lines:

Code: Select all

<b>begin</b>
  Self := Drawing;
  <b>if</b> FUseWinEllipse <b>and</b> (<b>not</b> Converter.Is3D)
    <b>and</b> C.Lines.IsSolid <b>and</b> (Converter.VPort.X = 0)
      <b>and</b> (Converter.VPort.Y = 0) <b>and</b> (Converter.VPort.Z > 0) <b>and</b> (<b>not</b> IsDrawingRotated) <b>then</b>
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I found that property of TsgDXFImage UseWinEllipse doesn't work correctly even with simple circles. I've sent you e-mail with file. I think there is problem in Converter.VPort. Why do you demand it to be (0,0,1)? What if VPort.Z changes?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
VPort defines a direction in which a drawing is viewed. Commonly a drawing is being deformed when changing viewing direction relative to the screen flat co-ordinate system. The reason of such behaviour is that WinAPI can draw only 2-D ellipses. That is why we always split ellipses etc. to polylines.
Furthermore, every file may contain any number of inserted blocks (INSERTs) which have their own rotation angles. It is not clear how to draw arcs, ellipses and circles in such inserted blocks using WinAPI.
BTW: AutoCAD (R) splits such arcs, ellipses and circles on polyline segments too.

Sergey.

AlexUS
Posts: 53
Joined: 05 Dec 2006, 14:44

Post by AlexUS » 13 Dec 2006, 13:27

Hi, dear Sergey
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">VPort defines a direction in which a drawing is viewed. Commonly a drawing is being deformed when changing viewing direction relative to the screen flat co-ordinate system. The reason of such behaviour is that WinAPI can draw only 2-D ellipses. That is why we always split ellipses etc. to polylines.
Furthermore, every file may contain any number of inserted blocks (INSERTs) which have their own rotation angles. It is not clear how to draw arcs, ellipses and circles in such inserted blocks using WinAPI.
BTW: AutoCAD (R) splits such arcs, ellipses and circles on polyline segments too.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

But can you make in Editor smooth drawing of SplitLines, Circles, Ellipses, etc. in case when Vport is (0,0,>0)?

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

Post by support » 15 Dec 2006, 14:44

Hello Alex,

It is necessary to use the following line in your code:

Code: Select all

TsgDXFImage(sgImage.Picture.Graphic).UseWinEllipse := True;
Sergey.

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

Post Reply