1 public class MoveRotateScaleJig : DrawJig 2 { 3 public static List<Entity> entities = new List<Entity>(); 4 private int step = 1; 5 private int totalStepNum = 3; 6 7 public Point3d moveStartPnt; 8 public static Point3d moveEndPnt; 9 public Double rotateAngle; 10 public Double scaleFactor; 11 12 public MoveRotateScaleJig(Point3d basePnt) 13 { 14 moveStartPnt = basePnt; 15 moveEndPnt = moveStartPnt; 16 rotateAngle = 0; 17 scaleFactor = 1; 18 } 19 20 public Matrix3d Transformation 21 { 22 get 23 { 24 return Matrix3d.Scaling(scaleFactor, moveEndPnt). 25 PostMultiplyBy(Matrix3d.Rotation(rotateAngle, Vector3d.ZAxis, moveEndPnt)). 26 PostMultiplyBy(Matrix3d.Displacement(moveStartPnt.GetVectorTo(moveEndPnt))); 27 } 28 } 29 30 public void AddEntity(Entity ent) 31 { 32 entities.Add(ent); 33 } 34 35 public void TransformEntities() 36 { 37 Matrix3d mat = Transformation; 38 foreach (Entity ent in entities) 39 { 40 ent.TransformBy(mat); 41 } 42 } 43 44 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw) 45 { 46 Matrix3d mat = Transformation; 47 48 WorldGeometry geo = draw.Geometry; 49 if (geo != null) 50 { 51 geo.PushModelTransform(mat); 52 53 foreach (Entity ent in e
c#+CAD动态移动效果
最新推荐文章于 2023-04-04 01:04:12 发布