明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: xiaomihu

关于模型空间和图纸空间的转换

[复制链接]
发表于 2004-7-8 11:12:00 | 显示全部楼层
(command "layout" "set" "")这句改了一下,按你的,如果不存在layout1布局,将出错。。。 主要是msapce这句出现错误,因为它作用的不一定是你想要的那个viewport,所以我把其它的VIEWPORT都删了 (defun c:ft (/ p0 p0xx py0y p0x p0y p1 p1xx p1yy p1x p1y p2 p2xx p2yy
p2x p2y a1 a2 lx ly l2) (command "undo" "begin")
(setq CHO (getvar "CMDECHO"))
(setvar "CMDECHO" 0) (command "ucs" "world") ;转到世界坐标系
(setq os (getvar "osmode"))
(setvar "osmode" 37)
(setq p0 (getpoint "\n 请选择插入1点:"))
(setq p1 (getpoint "\n 请选择插入2点:"))
(setq p2 (getpoint "\n 请选择插入3点:"))
(setq a1 (angle p0 p1))
(setq a2 (angle p0 p2))
(setq l2 (distance p0 p2))
(setq lxx (cos (- a2 a1)))
(setq lyy (sin (- a2 a1)))
(setq lx (* lxx l2))
(setq ly (* lyy l2))
(setq p0x (car p0))
(setq p0y (cadr p0))
(setq q2x (+ p0x lx))
(setq q2y (- p0y ly))
(setq q2 (list q2x q2y))
(command "layout" "set" "")
(command "_.erase" "all" "")
(command "RECTANGLE" p0 q2)
(setq e1 (entlast))

(command "mview" "object" e1)
(command "zoom" "a")
(command "MSPACE" p0)
(setvar "ucsfollow" 1)
(command "ucs" "z" p0 p1)
(setvar "ucsfollow" 0)
(command "ucs" "w")
(command "zoom" p0 p2)
(command "PSPACE")
(setvar "CMDECHO" cho)
(setvar "osmode" os)
(command "undo" "end") )
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 15:44 , Processed in 0.171805 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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