明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 732|回复: 0

[图形系统] viewport下设置ucs怎么不能直接显示旋转啊?

[复制链接]
发表于 2018-2-1 19:50 | 显示全部楼层 |阅读模式
  1. using (Transaction trans = db.TransactionManager.StartTransaction())
  2.                     {

  3.                             try
  4.                             {

  5.                                 ObjectId ucsId = NewUCS(name);
  6.                                 ucsId.SetUCSOrigin(Point3d.Origin);

  7.                                 double rot = (Math.Atan(dy / dx) / Math.PI * 180);
  8.                                 ucsId.RotateUCS(rot, Vector3d.ZAxis);
  9.                                 //将活动空间切换到图纸空间
  10.                                 db.TileMode = false;
  11.                                 ed.SwitchToPaperSpace();
  12.                                 //新建一个常规矩形视口
  13.                                 Viewport vport = new Viewport();
  14.                                 //设置视口的中点
  15.                                 vport.CenterPoint = new Point3d(104.4705, 74.3514, 0);

  16.                                 vport.Width = 200;//视口的宽度
  17.                                 vport.Height = 136;//视口的高度   

  18.                                 db.AddToPaperSpace(vport);//将视口添加到图纸空间
  19.                                 //修改视口的观察方向

  20.                                 vport.ViewCenter = 中点;
  21.                                 vport.ViewDirection = new Vector3d(0, 0, 0);
  22.                                 vport.UcsFollowModeOn = true;
  23.                                 vport.UpgradeOpen();


  24.                                 //ed.SwitchToModelSpace();//切换到模型空间   
  25.                                 vport.On = true;//启用新建的视口  
  26.                                 ed.SetCurrentVPort(vport);//将新视口置为当前
  27.                                 vport.SetUcs(ucsId);
  28.                                 ed.ZoomExtents();
  29.                                 trans.Commit();
  30.                             }
  31.                             catch (Autodesk.AutoCAD.Runtime.Exception ex)
  32.                             {
  33.                                 //放弃事务
  34.                                 trans.Abort();
  35.                                 MessageBox.Show(string.Format("捕获到未处理异常:{0}\r\n异常信息:{1}\r\n异常堆栈:{2}", ex.GetType(), ex.Message, ex.StackTrace));
  36.                             }

  37.                 }
这样设置ucs,视口并没有旋转。麻烦大神解答一下。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-3-29 21:53 , Processed in 0.193623 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表