明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: tukuitk

大虾接招,难题!!!

  [复制链接]
发表于 2003-10-13 13:58:00 | 显示全部楼层
这个按你的要求编程的话,功能比较容易实现,但很难实现那种光标只在某角度上移动(就象正交那样)的效果
 楼主| 发表于 2003-10-13 14:40:00 | 显示全部楼层
于我心有戚戚焉……
我虽然已实现了,但我觉得实现那种光标只在某角度上移动(就象正交那样)的效果会更好。
我见“天河CAD”有那种效果,那是怎么实现的呢?

***************
  众人拾柴火焰高
***************
 楼主| 发表于 2003-10-13 14:46:00 | 显示全部楼层
难道这是不能解决的问题??????
发表于 2003-10-13 14:57:00 | 显示全部楼层
把你的程序帖上来我看看是什么样的效果,看看我写得效果会不会好点
 楼主| 发表于 2003-10-13 14:59:00 | 显示全部楼层
(setq var (getvar "orthomode"))
(setq errtmp *error*)
(defun *error* (msg)
  (setvar "orthomode" var)
  (command "ucs" "w")
  (princ)
)
(setq *error* errtmp)

(defun c:fc ()
  (setvar "cmdecho" 0)
  (setq se (entsel "\n 选一已知线"))
  (setq ed (entget (car se)))
  (setq ps (cdr (assoc 10 ed)))
  (setq pe (cdr (assoc 11 ed)))
  (setq ang (* (angle ps pe) (/ 180 pi)))
  (command "orthomode" "1")
  (command "ucs" "n" "z" ang)
  (setq p (getpoint "\n 选将画线的第一点 \n"))
  (command "line" p pause "")
  (command "ucs" "w")
  (command "orthomode" var)
  (princ)
)
 楼主| 发表于 2003-10-13 15:00:00 | 显示全部楼层
(setq var1 (getvar "orthomode"))
(setq var2 (getvar "autosnap"))
(setq errtmp *error*)
(defun *error* (msg)
  (command "ucs" "w")
  (setvar "orthomode" var1)
  (setvar "autosnap" var2)  
  (princ)
)
(setq *error* errtmp)
;;;
(defun C:pfx ()
  (setvar "cmdecho" 0)
  (setq se1 (entsel "\n 请选择第一条直线:"))
  (setq se2 (entsel "\n 请选择第二条直线:"))
  (setq x1 (entget (car se1)))
  (setq x2 (entget (car se2)))
  (setq p1s (cdr (assoc 10 x1)))
  (setq p1e (cdr (assoc 11 x1)))
  (setq p2s (cdr (assoc 10 x2)))
  (setq p2e (cdr (assoc 11 x2)))
  (setq g1 (* (angle p1s p1e) (/ 180 pi)))
  (setq g2 (* (angle p2s p2e) (/ 180 pi)))
  (setq an (+ (/ (- g2 g1) 2) g1))
  (setq pj (inters p1s p1e p2s p2e nil))
  (command "ucs" "n" "z" an)
  (setq pok (trans pj 0 1))
  (setvar "orthomode" 1)
  (setvar "autosnap" 0)
  (command "line" pok pause "")
  (command "ucs" "w")
  (setvar "orthomode" var1)
  (setvar "autosnap" var2)
  (princ)
)
 楼主| 发表于 2003-10-13 15:03:00 | 显示全部楼层
请指教。
我是个菜鸟,但很勤劳的。
发表于 2003-10-13 15:09:00 | 显示全部楼层
你用了坐标系转换,我的是方向模糊确定,即鼠标移动时并没有方向限制,就是最后根据鼠标的大致方向确定最终方向。
注意,你的程序自定义*error*没有起作用。
 楼主| 发表于 2003-10-13 15:14:00 | 显示全部楼层
meflying大哥:
我能看看你的程序吗?谢谢!
我不太会用*error*函数,你能指点一下吗?在我上面的程序中应怎样用才是对的呢?
发表于 2003-10-13 15:15:00 | 显示全部楼层
如果是交互操作时,你可以先算出这个角度,然后在command命令中输入这个角度,就会锁定了
如:

line , <pick a point> , <34.676, ....

这时的移动鼠标就会锁定在你输入的角度的方向上了.
不过只是200x才支持
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-2 14:34 , Processed in 0.167705 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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