ActualGraphic and LineWeight

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

Moderators: support, SDS, admin

Post Reply
FieldConsult
Posts: 54
Joined: 14 Mar 2015, 22:33

ActualGraphic and LineWeight

Post by FieldConsult » 07 Aug 2017, 03:42

The ActualGraphic function does not consider the LineWeight of the Entities.

If you want to export the current graphic to an image file, the resulting image includes all the elements with the standard LineWeight and not with the included in the design.

For example, if a line with a LineWeight of 0.5 is drawn and later export the design to a image, in the resulting image that line appears with a LineWeight of by Default. That is thinner than in the drawing

Any idea???

Another problem is that the ActualGraphic function returns what is being displayed on the screen, the size you see and not the portion that is shown in the design, this is the same as making a print screen. What is needed, is to get the portion of the design displayed. For example, if you want to print the displayed portion of the design, you must adjust the size of the application to the size you want to get printed, this means that if you perform the same procedure with a full screen application, you get a image size very different to if the same process is carried out with the same application reduced in size, that is, the image included in the printing page will be of different size.

???????????

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

Re: ActualGraphic and LineWeight

Post by support » 07 Aug 2017, 21:20

Hello,

With regards to the lineweight, in the raster image exported from TsgDrawingNavigator.ActualGraphic it appears the same as in the displayed drawing. Please try the code below and the .dwg file from lineweights_triangle.zip.

Code: Select all

function DrawToBitmap(AGraphic: TGraphic): TBitmap;
begin
  Result := TBitmap.Create;
  Result.Width := AGraphic.Width;
  Result.Height := AGraphic.Height;
  Result.Canvas.StretchDraw(Rect(0, 0, AGraphic.Width, AGraphic.Height), AGraphic);
end;


procedure TForm1.miSaveViewAsBMPClick(Sender: TObject);
var
  vBitmap: TBitmap;
begin
  with SavePictureDialog1 do
  begin
    FileName := '';
    Filter := 'Bitmaps (*.bmp)';
    if Execute then
    begin
      vBitmap := DrawToBitmap(FDNavigator.ActualGraphic);
      vBitmap.SaveToFile(SavePictureDialog1.FileName + '.bmp');
    end;
  end;
end;
Mikhail
lineweights_triangle.zip
Test drawing: triangle which consists of 3 lines with different lineweights (0.5, 1.0 and 2.0 mm)
(6.43 KiB) Downloaded 733 times
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

FieldConsult
Posts: 54
Joined: 14 Mar 2015, 22:33

Re: ActualGraphic and LineWeight

Post by FieldConsult » 07 Aug 2017, 22:34

Thanks for the example, I can see the difference.
The ActualGraphic function, mentioned in another post and included with your demos, for get the actual image showing, was the wrong process.

Remain yet the problem for get the actual image is showing so, zoom, scale and width.

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

Re: ActualGraphic and LineWeight

Post by support » 08 Aug 2017, 20:56

Sorry, it is not quite clear what you mean by this:
Remain yet the problem for get the actual image is showing so, zoom, scale and width.
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

FieldConsult
Posts: 54
Joined: 14 Mar 2015, 22:33

Re: ActualGraphic and LineWeight

Post by FieldConsult » 08 Aug 2017, 21:10

It means that the problem of obtaining an image of the current state of visualization of the design remains to be solved.

The given procedure gets an image of the whole design, without considering the resolution of the screen or the size of the application, which is exactly what is needed.

But if you zoom to a part of the design, it is not possible to get an image of that state of visualization, imitating the Layout function in AutoCAD.

I hope this clarifies the indicated sentence.

Thank!!

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

Re: ActualGraphic and LineWeight

Post by support » 10 Aug 2017, 15:13

Hello,

To obtain a visible part of the drawing through TsgDrawingNavigator.ActualGraphic, you need to set a TsgDrawingNavigator.ViewRectMode property value to True.


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

FieldConsult
Posts: 54
Joined: 14 Mar 2015, 22:33

Re: ActualGraphic and LineWeight

Post by FieldConsult » 10 Aug 2017, 22:43

Thanks for the info, but when I setting the property to True, I can get the actual graphic which is different depending on the shape of the application, the resulting image is much larger if the application is higher than wide and the image has a lot of free space, that is, the design is placed at the center of the image and the rest is filled with the background color.

The actualgraphic function get the shape of the navigator and not the design of the CADImage.

Thanks!

Post Reply