Page 1 of 1

Fit CADImport.DRect to CADPictureBox

Posted: 15 Mar 2016, 19:03
by Bath
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

Re: Fit CADImport.DRect to CADPictureBox

Posted: 21 Mar 2016, 15:34
by support
Hello Bath,
I have a list of DRect of each drawing
Could you specify the values stored in DRect instances for each drawing?


Mikhail

Re: Fit CADImport.DRect to CADPictureBox

Posted: 21 Mar 2016, 19:20
by Bath
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).

Re: Fit CADImport.DRect to CADPictureBox

Posted: 22 Mar 2016, 10:06
by support
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

Re: Fit CADImport.DRect to CADPictureBox

Posted: 22 Mar 2016, 15:01
by Bath
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 ?