乐筑天下

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

[编程交流] Changeing layout's viewpo

[复制链接]

1

主题

1

帖子

0

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 21:57:12 | 显示全部楼层 |阅读模式
I have few hundreds of  autocad drawings which are maps. My customer changed his coordinate system for maps and wants me to change all the old maps to new coordinate system.  He didn't accept that I define new UCS for those maps but insists that I must move and rotate all the objects in the map to new position in World UCS. Bigger problem than moving and rotate all objects was elevation numbers which were normal acad text objects containing earth surface elevation as number.
 
I made a VBA program and solved those problems with it.
 
But a new problem came out. Every drawing has 10 to 40 layouts and now every viewport in those layouts points at wrong place in model space.
 
I have been trying to work out how to fix it with VBA but without success. So is here anybody who can help me with this problem?
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 22:54:23 | 显示全部楼层
This may be a way the variable Viewctr is the center pt of a viewport so read all viewports first and then translate to new co-ords and reset the zoom center for each layout then do your move plan. Note Viewctr changes as you go to each viewport.
 
Use zoom c newcpt  must be in model space. lisp (command "zoom" "c" newpt "") Note provided you have not zoomed in the viewport the scale should be correct
 
Almost forget need to check that viewport is not locked.
 
Not tested a lisp version
  1. (setq doc (vla-get-activedocument (vlax-get-acad-object)))(vlax-for lay (vla-get-Layouts doc)(setq plotabs (cons (vla-get-name lay) plotabs)))(foreach tabname plotabs (setvar "ctab" tabname)(command "mspace")(setq cpt (getvar "viewctr"))(setq cpt (list (+ x (car cpt))(+ y (cadr cpt))(+ z (caddr cpt))))(command "z" "c" cpt ""))
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

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

铜币
260
发表于 2022-7-6 23:08:57 | 显示全部楼层
 
Next time just wblock the entire drawing after you define the new UCS.  In the new drawing, the world coordinate system (WCS) is set parallel to the user coordinate system (UCS).
http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-F26FC1CE-45C9-4C85-9DB9-19B6A597D87B
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 14:00 , Processed in 0.313032 second(s), 58 queries .

© 2020-2025 乐筑天下

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