I have big problem with mirroring/rotating function. The problem doesn't exist to one DXF or when I'm trying to mirror whole image (with many DXF's on the canva).
To show what am I talking (writting) about I need to paste some code (the example appies to rotate around Z axis but is doesn't matter):
Code: Select all
TFPoint P,Scale;
P.X = 0;
P.Y = 100;
P.Z = 0;
Scale.X = 1;
Scale.Y = 1;
Scale.Z = 1;
//////////////////////////////////////////////////////////////////////////////
//-----Creating a fixed clamp--------------------
TsgCADImage *vGlobalCADFile;
TsgCADImage *Im1,*Im2;
TObject *vCADFiles[2];
vCADFiles[0] = new TsgCADdxfImage;
Im1 = dynamic_cast<TsgCADImage *>(vCADFiles[0]);
Im1->LoadFromFile("bjmclleft.dxf");
//-----Reading new DXF file----------------------
vCADFiles[1] = new TsgCADdxfImage;
Im2 = dynamic_cast<TsgCADImage *>(vCADFiles[1]);
Im2->LoadFromFile(OpenDialog1->FileName);
//----VERY IMPORTAND PART---------
Im1->Converter->AddXRef(vCADFiles[1],OpenDialog1->FileName,P,Scale,0);
TsgDXFXref *Ref;
Ref = (TsgDXFXref *)Im1->Converter->XRefs->First();
TsgCADImage *RIm = dynamic_cast<TsgCADImage *>(Ref->CADImage);
RIm->Rotate(axisZ,45); // this doesn't works !
RIm->Entities[0]->SetColor(clBlue); // this works properly
RIm->GetExtents();
Im1->Rotate(axisZ,45); // this works properly but rotate whole image (all DXF's)
Im1->GetExtents();
//-------------------------------------------------------------------
vGlobalCADFile = Im1;
vGlobalCADFile->GetExtents();
sgPaintBox->Picture->Graphic = vGlobalCADFile;
sgPaintBox->Invalidate();
sgPaintBox->FitToSize();
Maby someone from you had the same problem and is able to help me.
Thank you for any help.
Best regards,
Mariusz Hyżorek