Prod.: Engine, ver.: 6, ID: 60001574, HowTo : vdArc object is not scaled properly with cmdScale

HowTo : vdArc object is not scaled properly with cmdScale

Article60001574
TypeHowTo
ProductEngine
Version6
Date Added12/12/2011
Submitted byTien Huat Lee
Keywords

Subject

vdArc object is not scaled properly with cmdScale

Summary

vdArc object is not scaled properly with cmdScale

Solution

These arcs are not scaled properly because they are not 2D arcs, they have a z value. So these arcs are not scaled by cmdScale as cmdScale scales only in X and Y and not Z !!

It is better to use the vdMatric object and TransformBy method to scale the entities instead of using cmdScale (that only scale the X and Y and not Z).

So instead of using cmdScale (like in Simplecad or VDFCAD) use a code like :
      Matrix mat = new Matrix();
      mat.ScaleMatrix(0.01, 0.01, 0.01); // Scale it in X, Y and Z by 0.01
 
      foreach (vdFigure item in DOC.Model.Entities)
      {
          item.Transformby(mat);
          item.Update();
          item.Invalidate();
      }
  
Also when you do the scaling you can alter the equality to a smaller value and re-set it back to original value, like :
Double OldEqual = Globals.Default3DMatrixEquality;
Globals.Default3DMatrixEquality = 0.000001;
      Matrix mat = new Matrix();
      mat.ScaleMatrix(0.01, 0.01, 1);
     
 
      foreach (vdFigure item in DOC.Model.Entities)
      {
          item.Transformby(mat);
          item.Update();
          item.Invalidate();
      }
Globals.Default3DMatrixEquality = OldEqual ;