Fit CADImport.DRect to CADPictureBox

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Bath
Posts: 22
Joined: 17 Feb 2009, 19:08

Fit CADImport.DRect to CADPictureBox

Post by Bath » 15 Mar 2016, 19:03

Hi,
my CADImage contains several drawings and I have a list of DRect of each drawing.
I would like to show selected DRect of particular drawing in CADPictureBox.
I tried to convert the coordinates using the GetPoint, but I can't calculate the correct ImageScale or can't set center image in CADPictureBox, so drawing is somewhere in black darkness....

Can you help me to fit part of CADImage specified by DRect to window of CADPictureBox?

Thanks for any help
Bath

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

Re: Fit CADImport.DRect to CADPictureBox

Post by support » 21 Mar 2016, 15:34

Hello Bath,
I have a list of DRect of each drawing
Could you specify the values stored in DRect instances for each drawing?


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

Bath
Posts: 22
Joined: 17 Feb 2009, 19:08

Re: Fit CADImport.DRect to CADPictureBox

Post by Bath » 21 Mar 2016, 19:20

One DRect has location and size of one drawing. All drawings are in one CADImage.
DRect represent paper size (A0 to A4) and orientation (landccape or portrait).

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

Re: Fit CADImport.DRect to CADPictureBox

Post by support » 22 Mar 2016, 10:06

DRect represent paper size (A0 to A4)
DRect structure operates with CAD units, therefore, using a paper size which is measured in mm (inches) is not quite correct.


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

Bath
Posts: 22
Joined: 17 Feb 2009, 19:08

Re: Fit CADImport.DRect to CADPictureBox

Post by Bath » 22 Mar 2016, 15:01

There is large area in my CADImage (loaded from dwg file) where are several drawings with a frame (rectangle), mostly its borders are four CADLines.
CADImage units are millimeters. (CADImage.Milimeters=True)
The list of DRects is created on the fly from a CADEntityCollection of CADImage by reading coordinates of CADLines, e.g. horizontal lines width are 210 and vertical lines height are 297, lines are joined to each other , so I have DRect 210 x 297 and its location.
CADImage.Extends, CADLines and later list of DRects have same units.
It seems that they are in CAD units, actually the same as millimeters. Or not?

In CADViewer sample after CADImage is loaded, all (large area of) image (DRect = Image.Extends) is shown fitted to window in CADPictureBox. I’d like to show part of image given by DRect item of list of DRect(s) to see particular DRect maximal zoomed to CADPictureBox.DisplayRectangle.
How to convert the coordinates (Pixels? CADUnits? MMToPixels?), calculate scale and center zoomed (DRect) part of image in CADPictueBox ?

Post Reply