Page 1 of 1

Scale DXF to map resolution.

Posted: 30 Dec 2014, 13:54
by h.o.o.k
Hello, please can you help me?. I need import DXF file on which is draw MAP of plants. But i need gets actual file "map scale" and calculate new scale.
Etc. I need view map in scale 1:58000 (in JTSK coords system , units are meters). I know that DXF file is in same coords system (JTSK). But i dont know how works scaling. In manual this information missing :( Our componaty bought CADVCL 10.0 Import. Can you help me please? I need samo theory about scaling. Thank you very much.

Peter

Please so sorry for my english.

Re: Scale DXF to map resolution.

Posted: 02 Jan 2015, 15:52
by Bjoerk
Hello Peter,
to get an answer in this forum is definitely Lotterie and in the manual is quasi "every information missing". :mrgreen:
I have no Idea of JTSK (seems to be special Czech stuff?). Maybe, try like this: Have a Look at the
ImportExample, add to the Points the Viewport and multiply the coordinates with a Factor.

In my Software, I have it like this:

Code: Select all

  // CADImage.IsWithoutBorder = true,
  // DrawingExtents = CADImage.GetDrawingExtents,
  // P from CADIterate (ImportLine, ImportPolyLine ect..),
  // Factor = ScaleFactor * UnitFactor,
  // ScaleFactor = 1 / 58000,
  // UnitFactor = 1? (dxfUnitToMM),
  P.X := (P.X + ViewPort.X - DrawingExtents.Left) * Factor;
  P.Y := (DrawingExtents.Top - P.Y - ViewPort.Y) * Factor;
To get just a Scaled Graphic of the dxf:

Code: Select all

 
  // CADImage.IsWithoutBorder = true
  // Factor = ScaleFactor * UnitFactor,
  // ScaleFactor = 1 / 58000,
  // UnitFactor = 1? (dxfUnitToMM)
  FRect.Left := 0;
  FRect.Top := 0;
  FRect.Right := Round(FFactor * PixelsPerInch / 25.4 * FsgCADImage.AbsWidth);
  FRect.Bottom := Round(FFactor * PixelsPerInch / 25.4 * FsgCADImage.AbsHeight);
  FMetafile.Width := FRect.Right;
  FMetafile.Height := FRect.Bottom;
  MC := TMetafileCanvas.Create(FMetafile, 0);
  try
    MC.StretchDraw(FRect, FsgCADImage);
  finally
    MC.Free;
  end;
Hope it helps, kind regards, happy New Year from Mannheim,

Thomas

Re: Scale DXF to map resolution.

Posted: 03 Jan 2015, 13:00
by h.o.o.k
Hello Thomas, thank you very much for reply.
Really, manual for CadSoft is very pure :(( I have this library few days in hand and understand it everytihing from code is hardcore :(

Yes, JTSK is special czech coording system like WGS84 etc. But this not important for solution.

I´ll try your sample code.

Thank you , and all good to this new year :)

Peter.

Re: Scale DXF to map resolution.

Posted: 05 Jan 2015, 17:06
by support
Hello,

We were on holidays, so we couldn't answer on time. Thanks to Thomas for his post.

Mikhail