CAD Import VCL and Rotate
Moderators: SDS, support, admin
CAD Import VCL and Rotate
Hi there!
I am using your Example on Rotation from the documentation file. I have somehow translated it to C++ as:
<i>sgDXFImage->Rotate(axisZ,dAngle);
TRect R = Rect(0, 0, sgCADImage->Width, sgCADImage->Height);
sgCADImage->Canvas->StretchDraw(R,sgDXFImage);</i>
The rotation itself works fine, but my problem is that after rotating the image, there is always a part of the image not shown. This means if the width is larger then the height of the image after rotating 90 degrees the upper and lower part of the image is not shown. After rotating another 90 degrees everything is fine. Hope you got an idea of my problem and maybe you can help.
Cheers
Stephan
I am using your Example on Rotation from the documentation file. I have somehow translated it to C++ as:
<i>sgDXFImage->Rotate(axisZ,dAngle);
TRect R = Rect(0, 0, sgCADImage->Width, sgCADImage->Height);
sgCADImage->Canvas->StretchDraw(R,sgDXFImage);</i>
The rotation itself works fine, but my problem is that after rotating the image, there is always a part of the image not shown. This means if the width is larger then the height of the image after rotating 90 degrees the upper and lower part of the image is not shown. After rotating another 90 degrees everything is fine. Hope you got an idea of my problem and maybe you can help.
Cheers
Stephan
After CAD drawing's rotation the rect (where CAD darwings is displayed, for example below this is sgPaintBox) size has to be renewed.
We reccomend to follow the next way (based on the CADImportVCL CBuilder Demo Viewer):
- - -
Yours faithfully,
Pavel Poltavets,
senior developer Soft Gold Ltd.
We reccomend to follow the next way (based on the CADImportVCL CBuilder Demo Viewer):
Code: Select all
{ Drawing's rotation on 15 degrees clockwise)
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TsgDXFImage *vImg;
if (sgPaintBox->Picture->Graphic->InheritsFrom(__classid(TsgDXFImage)))
{
vImg = dynamic_cast<TsgDXFImage *>(sgPaintBox->Picture->Graphic);
vImg->Rotate(axisZ, -15);
/* Apply new extents */
vImg->GetExtents();
// 1 way
sgPaintBox->Width = vImg->Width;
sgPaintBox->Height = vImg->Height;
//...
// or 2 way
//sgPaintBox->Align = alClient;
//...
}
}
Yours faithfully,
Pavel Poltavets,
senior developer Soft Gold Ltd.