乐筑天下

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

[编程交流] 在Paperspa上绘制坐标范围

[复制链接]

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 10:32:17 | 显示全部楼层 |阅读模式
我创建了在土地注册局注册的地图。他们要求所有地图以坐标格式显示地图窗口的范围(见附图)。问题是坐标在纸空间中,但相对于模型空间中视口的范围。因此,如果我在视口内平移并重新生成坐标,坐标就会更新。
 
我最好怎么做?可以使用字段来完成吗?我已经研究了VSMAX和VSMIN变量,但我认为这是不正确的,因为这些值似乎有点偏离。
 
我只是想,也许我可以通过使用VIEWCTR和视口比例来计算范围,并将其写入块属性。。
 
以前有人做过这样的事吗???
113218p6kap2662jj6jqz7.jpg
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 10:41:15 | 显示全部楼层
一段时间以来,我一直在使用下面的lisp在modelspace中绘制视口,我刚刚意识到,实际上我需要的所有信息都已经在那里了。我的问题是,有时它不能正确地绘制边界。
 
  1. ;;***************************************************************************
  2. ;                 VBORD.LSP V1.0 by Zoltan Toth
  3. ;    ZOTO Technologies,
  4. ;    23 Greenhills Dve,
  5. ;    Melton 3337.
  6. ;    E-MAIL: [email="zoltan.toth@ains.net.au"]zoltan.toth@ains.net.au[/email]
  7. ;       WWW: [url]http://www.ains.net.au/zoto/[/url]
  8. ;;*****************************************************************************
  9. ;    Draws a border to the extents of the current viewport in layer
  10. ;    DEFPOINTS so it will not plot. Layer DEFPOINTS will be created if
  11. ;    needed. Useful for creating a border in Model space to indicate the
  12. ;    extents of a Paper space viewport when working with TILEMODE = 1.
  13. ;    This is done by changing Tilemode to zero, making a viewport current
  14. ;    with the MSPACE command and then running VBORD. The border will be
  15. ;    created automatically. Layer DEFPOINTS is sort of a "child" of layer
  16. ;    0 so anything you do to layer 0 will affect objects on layer
  17. ;    DEFPOINTS as well. For some reason, you can't make changes to
  18. ;    DEFPOINTS alone.
  19. ;
  20. ;    Since most monitors have a slightly different dot pitch in the
  21. ;    vertical and horizontal directions, a variable called PIX_RATIO is
  22. ;    used to correct this. To determine what value PIX_RATIO should have,
  23. ;    open a drawing and change TILEMODE to 0 if it isn't already and
  24. ;    create a viewport whose X and Y dimensions are the values of your
  25. ;    screen resolution ie. If your resolution is 1024x768 then your
  26. ;    viewport dimensions should be 1024 drawing units wide and 768
  27. ;    drawing units high. Make that viewport active and run VBORD with
  28. ;    PIX_RATIO at the default value of 1.0. Then TILEMODE to 1 and you
  29. ;    should see the rectangle created by VBORD. You may need to zoom out
  30. ;    if you can't see it. Run the CAL command and at the:
  31. ;         >> Expression:
  32. ;    prompt, key in:
  33. ;         (1024/768)/(dist(end,end)/dist(end,end))
  34. ;    and hit <return>. The "(1024/768)" is assuming a video resolution of
  35. ;    1024x768. If yours is different, key that in.
  36. ;
  37. ;    After you hit <return>, you will be faced with what looks like a
  38. ;    pickbox the size of your APERTURE setting and a prompt on the command
  39. ;    line:
  40. ;         >> Select entity for _END snap:
  41. ;    Pick the top left hand corner of the VBORD rectangle, then the top
  42. ;    right corner of the rectangle, the top right again and then the bottom
  43. ;    right corner. This compares the ratio of your video resolution ratio
  44. ;    to the ratio of the width and height of the border drawn by VBORD - a
  45. ;    ratio of ratios if you will. Once done, CAL will display a number on
  46. ;    the command line which should be fairly close to 1. This is the value
  47. ;    for PIX_RATIO.
  48. ;
  49. ;    Make sure that you have configured the video display in AutoCAD to
  50. ;    produce round circles and square squares prior to calculating the
  51. ;    value for PIX_RATIO. Altering the video display ratio in the AutoCAD
  52. ;    configuration will require you to recalculate PIX-RATIO.
  53. ;    Should you have different machines on a network with different
  54. ;    PIX-RATIO requirements, and they use the same VBORD.LSP, you can put
  55. ;    in a COND function linked to either the _PKSER or LOGINNAME SETVAR to
  56. ;    set PIX_RATIO according the the machine.
  57. ;;***************************************************************************
  58. ;define program and localize variables
  59. (defun C:VBORD(/ CLAY2 PWID2 X_CEN YCEN SCRHGT X_DIM Y_DIM XY_RATIO PIX_RATIO
  60.                 SCRWID LEFTEX RIGHTEX BOTEX TOPEX PT2 PT3 PT4 PT5
  61.              )
  62. (setq PIX_RATIO 1.0 ;set PIX_RATIO to horizontal/vertical dot pitch ratio of monitor
  63.       CMD2 (getvar "CMDECHO")                      ;save current command echo status
  64.       CLAY2 (getvar "CLAYER")                                    ;save current layer
  65.       PWID2 (getvar "PLINEWID")                         ;save current POLYLINE width
  66. )
  67. (setvar "CMDECHO" 0)                                       ;turn off command echoing
  68. (command "._UCS" "_VIEW")                                         ;align UCS to view
  69. (setq X_CEN (car (getvar "VIEWCTR"))                 ;get X value of viewport centre
  70.       Y_CEN (cadr (getvar "VIEWCTR"))                ;get Y value of viewport centre
  71.       SCRHGT (getvar "VIEWSIZE")                ;get height of viewport in dwg units
  72.       X_DIM (car (getvar "SCREENSIZE"))            ;get height of viewport in pixels
  73.       Y_DIM (cadr (getvar "SCREENSIZE"))            ;get width of viewport in pixels
  74.       XY_RATIO (/ X_DIM Y_DIM)             ;calculate width:height ratio of viewport
  75.       SCRWID (* SCRHGT XY_RATIO PIX_RATIO) ;calculate width of viewport in dwg units
  76.       LEFTEX (- X_CEN (/ SCRWID 2.0))                    ;\  calculate left,
  77.       RIGHTEX (+ X_CEN (/ SCRWID 2.0))                   ; \ right,  
  78.       BOTEX (- Y_CEN (/ SCRHGT 2.0))                     ; / bottom and
  79.       TOPEX (+ Y_CEN (/ SCRHGT 2.0))                     ;/  top extents of viewport
  80.       PT2 (list LEFTEX BOTEX 0.0)                    ;bottom left corner of viewport
  81.       PT3 (list RIGHTEX BOTEX 0.0)                  ;bottom right corner of viewport
  82.       PT4 (list RIGHTEX TOPEX 0.0)                     ;top right corner of viewport
  83.       PT5 (list LEFTEX TOPEX 0.0)                       ;top left corner of viewport
  84. )
  85. (command "._LAYER" "_MAKE" "CCC_LAYOUT_Viewport_Border" "")           ;set current layer to DEFPOINTS
  86. (command "._PLINE" PT2 "_WIDTH" "0.0" "" PT3 PT4 PT5 "_CLOSE")          ;draw border
  87. (command "._UCS" "_PREVIOUS")                                  ;restore previous UCS
  88. (setvar "CMDECHO" CMD2)                                 ;restore command echo status
  89. (setvar "CLAYER" CLAY2)                                      ;restore previous layer
  90. (setvar "PLINEWID" PWID2)                           ;restore previous POLYLINE width
  91. (princ)                                                                ;exit quietly
  92. )
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 10:52:15 | 显示全部楼层
事实证明,我没有更新显示器的PIX_比率设置,这就是为什么有时不能正确绘制的原因。
 
这里有点单向对话。。。。。嗯!!!!!
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 10:58:21 | 显示全部楼层
我创建了一个具有属性的块来代替顶部图像中的坐标。如何更新服装?
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 11:06:39 | 显示全部楼层
我从上面的代码中看到,坐标被保存为变量PT2-PT5。如果要“去本地化”它们,可以在属性中使用字段(字段名>LispVariable)。每次需要更新时,都需要运行lisp并重新生成。
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 11:13:11 | 显示全部楼层
你说的“去本地化”是什么意思?如何设置它以使用LispVariables?我需要在CAD中创建新的LispVariable吗?ti与Diesel表达式有关吗?
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 11:23:57 | 显示全部楼层
当变量被声明为局部变量时,lisp例程完成后,它的值将返回到原始值(很可能为零)。如果未声明,则保留在例程中分配的值。当变量位于表达式中紧跟在(defun…下面红色的变量)之后的/之后时,它将被本地化
如果从表达式中删除它们,则可以在字段中使用它们
  1. 2

113220vv9zayyy9mn9ymyn.jpg
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 11:32:15 | 显示全部楼层
我使用带有LispVariables的字段快速制作了一个dwg。您需要运行lisp例程(在从本地化中删除变量之后),然后执行regenall。
请注意,这一次仅适用于1个视口。
 
希望对你有用
测验图纸
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 11:35:19 | 显示全部楼层
谢谢你。太棒了。这将为我们的下一份工作节省很多时间。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 17:43 , Processed in 0.537919 second(s), 73 queries .

© 2020-2025 乐筑天下

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