记忆移动程序,谁能帮我调一下?
本帖最后由 半听可乐 于 2012-8-28 10:39 编辑记忆移动程序,美中不足的是默认正交模式,能不能改一下?
承蒙楼下Andyhon 兄出手正交问题已解决,(setvar "orthomode" 1)改为(setvar "orthomode"0)之后,如果移动较远则前后移动的图元会错位,即便在源程序上临时切换正交模式也会出现同样问题,这是为什么呢?
;;;-------------------------------------------------------------------------------------------------------------------
;;; ★DB_REMMOVE 记忆移动,定向定距移动(默认正交,待修改)
;;; By luyu9635 2012.06深圳
;;;-------------------------------------------------------------------------------------------------------------------
(defun c:DB_REMMOVE (/ ss p1 p2 mbd gr temp)
(setvar "orthomode" 1)
(if (not movedist)
(setq movedist 3)
)
(if (not moveang0)
(setq moveang0 pi)
)
(if (setq ss (ssget)
p1 (getpoint "\n指定基点:")
)
(progn
(initget 128)
(setq
p2 (getpoint p1 (strcat "\n指定第二点<" (rtos movedist) ">:"))
)
(cond ((= (type p2) 'LIST);鼠标点,直接到鼠标点位
(setq moveang0 (angle p1 p2))
(setq movedist (distance p1 p2)
mbd (polar p1 moveang0 movedist)
)
)
((= (type p2) 'STR);键盘输入,按象皮筯方向移动
(setq gr(cadr(grread 1)))
(if (> (abs (- (car gr)(car p1))) (abs (- (cadr gr)(cadr p1))))
(setq temp(list (car gr)(cadr p1)))
(setq temp(list (car p1)(cadr gr)))
)
(setq moveang0 (angle p1 temp))
(setq movedist (atof p2)
mbd (polar p1 moveang0 movedist)
)
)
((= (type p2) nil);空格,默认上次的方向和距离
(setq mbd (polar p1 moveang0 movedist))
)
)
(command "move" ss "" p1 mbd)
)
)
(princ)
)
1#
(command "move" ss "" p1 mbd)
==>
(command "move" ss "" "none" p1 "none" mbd)
(默认正交,待修改)
(setvar "orthomode" 1)
==>
(setvar "orthomode" 0)
楼主,能否告诉我如何悬赏。我也发了个帖子求助,可是不知道如何悬赏 Andyhon 发表于 2012-8-26 20:50 static/image/common/back.gif
(默认正交,待修改)
(setvar "orthomode" 1)
==>
朋友,新问题出现了,附件中,有劳了 关掉捕捉看看
(defun c:DB_REMMOVE (/ ss p1 p2 mbd gr temp)
(setvar "orthomode" 1)
(setvar "osmode" 0);;这里加上 kwok 发表于 2012-8-30 00:48 static/image/common/back.gif
关掉捕捉看看
(defun c:DB_REMMOVE (/ ss p1 p2 mbd gr temp)
(setvar "orthomode" 1)
试了很多遍,其中某一次还是有一点点错位,想不起具体操作 了,不过话说回来,取消了捕捉很不方便的 ...试了很多遍...想不起具体操作了...
等抓到了,再把样图+画面+命令列的讯息(含必要的鼠标回应)一并上传...
看得出楼主要的移动的功能多了一个记忆上次距离角度的功能,所以本人觉得从CAD移动功能方面入手就可以,无需太复杂,修改如下,不知是否合楼主正解!
;;;-------------------------------------------------------------------------------------------------------------------
;;; ★DB_REMMOVE 记忆移动,定向定距移动
;;; By luyu9635 2012.06深圳
;;;-------------------------------------------------------------------------------------------------------------------
(defun c:DB_REMMOVE (/ ss p1 p2 mbd gr temp ent pt ppt)
;;;(setvar "orthomode" 1)
(if (not movedist)
(setq movedist 3)
)
(if (not moveang0)
(setq moveang0 pi)
)
(if (setq ss (ssget)
p1 (getpoint "\n指定基点:")
)
(progn
(command "point" p1)
(setq ss (ssadd (setq ent (entlast)) ss))
(setq p2 (polar p1 moveang0 movedist))
(command "move" ss "" p1 pause)
(setq pt (trans(cdr (assoc 10 (entget ent))) 0 1))
(setq ppt (list (- (car pt) (car p1)) (- (cadr pt) (cadr p1)) 0))
(if (equal p1 ppt)(command "move" ss "" pt p2))
(setq pt (trans(cdr (assoc 10 (entget ent))) 0 1))
(setq movedist (distance p1 pt) moveang0 (angle p1 pt))
(entdel ent)
)
)
(princ)
) yetianyun 发表于 2012-8-31 15:52 static/image/common/back.gif
看得出楼主要的移动的功能多了一个记忆上次距离角度的功能,所以本人觉得从CAD移动功能方面入手就可以,无需 ...
你这个也有同样的bug:前后两次移动有错位,而且比我发的错位严重哦