- /// <summary>
- /// 旋转的函数.
- /// </summary>
- /// <param name="ent"></param>
- /// <param name="basePt"></param>
- /// <param name="angle"></param>
- public static void Rotate(Entity ent, Point3d basePt, Double angle)
- {
- if (angle != 0)
- {
- Matrix3d mt = Matrix3d.Rotation(angle, Vector3d.ZAxis, basePt);
- ent.TransformBy(mt);
- }
- }
复制代码-
- /// <summary>
- /// 旋转的函数.
- /// </summary>
- /// <param name="id"></param>
- /// <param name="basePt"></param>
- /// <param name="angle"></param>
- public static void Rotate(ObjectId id, Point3d basePt, Double angle)
- {
- Matrix3d mt = Matrix3d.Rotation(angle, Vector3d.ZAxis, basePt);
- Database db = HostApplicationServices.WorkingDatabase;
- using (Transaction trans = db.TransactionManager.StartTransaction())
- {
- Entity ent = (Entity)trans.GetObject(id, OpenMode.ForWrite);
- ent.TransformBy(mt);
- trans.Commit();
- }
- }
|