乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 190|回复: 14

更新模型空间显示范围

[复制链接]

6

主题

47

帖子

36

银币

初来乍到

Rank: 1

铜币
36
发表于 2010-3-17 16:16:32 | 显示全部楼层 |阅读模式
嗨,
我正在做我的第一个ARX程序。它调整了画框的大小,以便我可以调整它的纵横比。这很好,但我的例程是从LISP内部调用的。我不知道如何使系统变量更新,以便在LISP退出之前进行最大化。我只有默认的“模型空间”视口。我怀疑我需要更改模型空间视口设置,但我不确定如何更改。我已经发布了我的代码,所以你可以看到我正在尝试做什么
  1. static void SetDwgWindow_SetWindow(void) {
  2.         int Width        = 0; // 830
  3.         int Height        = 0; // 564
  4.         acedGetInt (_T("\nEnter a new width in pixels for the drawing window: "), &Width);
  5.         acedGetInt (_T("\nEnter a new height in pixels for the drawing window: "), &Height);
  6.         CRect rect (0, 0, 2 * Width, 2 * Height);
  7.         CRect ChildRect (0, 0, Width, Height);
  8. //
  9. //
  10. //
  11.         CWnd* DocFrame = acedGetAcadDwgView()->GetParent();
  12.         DocFrame->MoveWindow (ChildRect);
  13.         DocFrame->UpdateWindow ();
  14. }//SetDwgWindow

我应该为此使用acdbViewport类吗?我会接受任何我能得到的暗示
肖恩

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

LE3

10

主题

149

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
189
发表于 2010-3-17 17:35:09 | 显示全部楼层
你读过/研究过updateExt()吗?
以下是步骤:
1.定义AcDbViewTableRecord
2.您需要提取extmax()和extmin()
3.从上面的值计算AcGePoint2d的
4.计算/设置视图setCentPoint()
的中心点5.使用setHeight()和setWidth()
定义高度和宽度6.使用acedSetTrentView()
7设置当前视图。并通过调用updateExt()更新扩展阅读有关此内容,看看哪些参数更适合您的使用。
祝你好运,ARX将要求你更多地参与进来。
回复

使用道具 举报

6

主题

47

帖子

36

银币

初来乍到

Rank: 1

铜币
36
发表于 2010-3-17 20:45:00 | 显示全部楼层
嗨,
议员,你戳我的是一根棍子吗?
再次感谢您的帮助。事实上,当我觉得自己有贡献时,我会更加投入,但说实话,我很少需要问问题,因为我很擅长寻找我需要的东西。只是要搜索ARX的信息库要有限得多。
  1. //
  2. //        Test of VP Reset
  3. //
  4.                 AcDbViewTableRecord View;
  5.                 AcDbExtents ExtentsTest;
  6.                 AcGePoint2d ExtentsMax_2d (ExtentsTest.maxPoint()[X], ExtentsTest.maxPoint()[Y]);
  7.                 AcGePoint2d ExtentsMin_2d (ExtentsTest.minPoint()[X], ExtentsTest.minPoint()[Y]);
  8.                 View.setCenterPoint (ExtentsMin_2d + (ExtentsMax_2d - ExtentsMin_2d) / 2.0) ;
  9.                 View.setHeight (ExtentsMax_2d[Y] - ExtentsMin_2d[Y]) ;
  10.                 View.setWidth (ExtentsMax_2d[X] - ExtentsMin_2d[X]) ;
  11. //
  12. //
  13.                 acedSetCurrentView (&View, NULL);
  14.                 acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);
  15. //
  16. //        End of VP Reset
  17. //

它的缩放没有任何不同,所以很明显我做错了什么,尽管在编译期间或运行时我没有收到任何错误或警告。我是否正确使用了UpdateText(),我缺少了什么
肖恩
回复

使用道具 举报

LE3

10

主题

149

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
189
发表于 2010-3-17 20:57:11 | 显示全部楼层
不需要AcDbExtents代码2]
回复

使用道具 举报

27

主题

193

帖子

5

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
300
发表于 2010-3-18 12:46:53 | 显示全部楼层

看看AcadIMouse.cpp文件中的内容是否有帮助。这是相当旧的,可能是VC6,并为R14增加了鼠标滚轮缩放支持。你能相信我每年还是会收到5到6个更新这个程序的请求吗?不管怎样,我想它最后一次更新是在2000年。
我特此将此通知发布到“公共领域”。
回复

使用道具 举报

LE3

10

主题

149

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
189
发表于 2010-3-18 12:58:46 | 显示全部楼层
嘿,巴勃罗,
你做编程多久了?-还是更具体地针对基于AutoCAD的
<em>(也许是时候采访一些沼泽成员了)
回复

使用道具 举报

27

主题

193

帖子

5

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
300
发表于 2010-3-18 13:13:04 | 显示全部楼层

我猜你是在问我? 是的。 我现在变老了,但我想我在89年或90年开始编写Autocad。
回复

使用道具 举报

LE3

10

主题

149

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
189
发表于 2010-3-18 13:19:37 | 显示全部楼层

我想你是在问我?是的。我现在老了,但我想我是在89年或90年开始编程Autocad的。
是的。
哇!好久不见。
回复

使用道具 举报

6

主题

47

帖子

36

银币

初来乍到

Rank: 1

铜币
36
发表于 2010-3-18 15:34:41 | 显示全部楼层
只是一个更新,
绘图以调整大小的绘图窗口为中心,但它仍然看到旧的客户端窗口尺寸。Pkohut在我面前放了很多信息,我将在带着更多问题回来之前浏览一下。
下面我发布了我的代码和一个LISP片段,显示了如何使用ARX。如果您尝试一下,您会发现问题。
  1.         static void SetDwgWindow_SetWindow(void) {
  2. //
  3. //        Set Variables
  4. //
  5. //                                                 Client          Borders,Sliders,Ect.
  6.                 int Width        = 0; // ViewAreaWidth(802) + 28 = Width = 830
  7.                 int Height        = 0; // ViewAreaHeight(493) + 71 = Height = 564
  8.                 acedGetInt (_T("\nEnter a new width in pixels for the drawing window: "), &Width);
  9.                 acedGetInt (_T("\nEnter a new height in pixels for the drawing window: "), &Height);
  10.                 CRect rect (0, 0, 2 * Width, 2 * Height);
  11.                 CRect ChildRect (0, 0, Width, Height);
  12.                 AcGePoint3d Min (0, 0, 0);
  13.                 AcGePoint3d Max (830, 564, 0);
  14. //
  15. //        Resize Document Frame
  16. //
  17.                 CWnd* DocFrame = acedGetAcadDwgView()->GetParent();
  18.                 DocFrame->MoveWindow (ChildRect);
  19.                 DocFrame->UpdateWindow ();
  20. //
  21. //        Test of VP Reset
  22. //
  23.                 AcDbViewTableRecord View;
  24.                 AcGePoint3d ExtentsMax = acdbHostApplicationServices()->workingDatabase()->extmax();
  25.                 AcGePoint3d ExtentsMin = acdbHostApplicationServices()->workingDatabase()->extmin();
  26.                 AcGePoint2d ExtentsMax_2d (ExtentsMax[X], ExtentsMax[Y]);
  27.                 AcGePoint2d ExtentsMin_2d (ExtentsMin[X], ExtentsMin[Y]);
  28.                 View.setCenterPoint (ExtentsMin_2d + (ExtentsMax_2d - ExtentsMin_2d) / 3.0) ;
  29.                 View.setHeight (ExtentsMax_2d[Y] - ExtentsMin_2d[Y]) ;
  30.                 View.setWidth (ExtentsMax_2d[X] - ExtentsMin_2d[X]) ;
  31. //
  32. //
  33.                 acedSetCurrentView (&View, NULL);
  34.                 acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);
  35. //
  36. //        End of VP Reset
  37. //
  38.         }//SetDwgWindow
  39. LISP snippet
  40. (defun C:Test ()
  41. (command "SetWindow" "830" "564")
  42. (command "._Zoom" "Extents")
  43. (getstring "Press any key to continue: ")
  44. ); Defun

再次感谢您的帮助。
肖恩
回复

使用道具 举报

LE3

10

主题

149

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
189
发表于 2010-3-18 17:36:42 | 显示全部楼层
不知道这是否是你想做/拥有的东西 - 试一试,看看是否有效。
  1. static void zoomExtents()
  2. {
  3.         AcDbViewTableRecord view;
  4.         AcGePoint3d max = acdbHostApplicationServices()->workingDatabase()->extmax(),
  5.         min = acdbHostApplicationServices()->workingDatabase()->extmin();
  6.         AcGePoint2d max_2d (max[X], max[Y]);
  7.         AcGePoint2d min_2d (min[X], min[Y]);
  8.         view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0);
  9.         view.setHeight(max_2d[Y] - min_2d[Y]);
  10.         view.setWidth (max_2d[X] - min_2d[X]);
  11.         acedSetCurrentView (&view, NULL);
  12.         acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);
  13. }
  14. static void SetDwgWindow_SetWindow(void) {
  15.         //
  16.         // Set Variables
  17.         //
  18.         // Client Borders,Sliders,Ect.
  19.         int Width = 0; // ViewAreaWidth(802) + 28 = Width = 830
  20.         int Height = 0; // ViewAreaHeight(493) + 71 = Height = 564
  21.         acedGetInt (_T("\nEnter a new width in pixels for the drawing window: "), &Width);
  22.         acedGetInt (_T("\nEnter a new height in pixels for the drawing window: "), &Height);
  23.         CRect rect (0, 0, 2 * Width, 2 * Height);
  24.         CRect ChildRect (0, 0, Width, Height);
  25.         AcGePoint3d Min (0, 0, 0);
  26.         AcGePoint3d Max (830, 564, 0);
  27.         //
  28.         // Resize Document Frame
  29.         //
  30.         CWnd* DocFrame = acedGetAcadDwgView()->GetParent();
  31.         DocFrame->MoveWindow (ChildRect);
  32.         DocFrame->UpdateWindow ();
  33.         zoomExtents();
  34.         DocFrame->SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0L);
  35.         DocFrame->SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0L);
  36.         DocFrame->SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0L);
  37. }//SetDwgWindow

回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-5 21:53 , Processed in 0.353905 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表