明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1229|回复: 6

[源码] ;与参照对象集双向中心对齐--移动源对象

[复制链接]
发表于 2018-6-4 00:22 | 显示全部楼层 |阅读模式
;与参照对象集双向中心对齐--移动源对象
(defun c:zkdq (/ pt1 pt2 pts pts2 pts3 ss ss1)   
        (setq eh-*error*-bak *error*);backup
        (defun *error* (msg)
                (setq *error* eh-*error*-bak);restore
                (setvar "osmode" eh_os_g)
                (command "_.undo" "e")
                (setvar "nomutt" 0)
                (setvar "cmdecho" 1)
                (print msg)   
        )   
        (setvar "cmdecho" 0)
        (command "_.undo" "be")
        (if (< (setq eh_os_g (getvar "osmode")) 16384)
                (setvar "osmode" (+ eh_os_g 16384))
        );if   
        (princ "--与参照对象集双向中心对齐--移动源对象")
        (setq ss (ssget))
        (princ "\n请选择要目标对象:")
        (setvar "nomutt" 1)
        (setq ss1 (ssget))
        (setvar "nomutt" 0)
       
        (setq pt1 (EH-SS-9pt ss 5))
        (setq pts2 (EH-Ent-9pt (ssname ss1 0) '(1 7 3 9)))
        (setq pts3 (EH-Ent-9pt (ssname ss1 1) '(1 7 3 9)))   
       
        (if (< (car (caddr pts2)) (car (car pts3)))
                (setq pts (list
                                                                (nth 2 pts2) (nth 3 pts2)
                                                                (nth 0 pts3) (nth 1 pts3)
                                                        )
                        pt3 (EH-Get-Midpt (EH-Get-Midpt (nth 2 pts2) (nth 3 pts2)) (EH-Get-Midpt (nth 0 pts3) (nth 1 pts3)))
                        pts4 (list (EH-Get-Midpt (nth 2 pts2) (nth 3 pts2))(EH-Get-Midpt (nth 0 pts3) (nth 1 pts3)))
                )
                (setq pts (list
                                                                (nth 2 pts3) (nth 3 pts3)
                                                                (nth 0 pts2) (nth 1 pts2)
                                                        )
                        pt3 (EH-Get-Midpt (EH-Get-Midpt (nth 0 pts2) (nth 1 pts2)) (EH-Get-Midpt (nth 2 pts3) (nth 3 pts3)))
                        pts4 (list (EH-Get-Midpt (nth 0 pts2) (nth 1 pts2))(EH-Get-Midpt (nth 2 pts3) (nth 3 pts3)))        
                )
        )
       
       
       
        (setq pt2 (EH-Pts-9pt pts '5))
        (vl-cmdf "_.move" ss "" pt1 pt2)
       
       
        (setq *error* eh-*error*-bak)
        (command "_.undo" "e")
        (setvar "osmode" eh_os_g)
        (setvar "cmdecho" 1)
        (princ)
)

发表于 2018-6-4 03:55 来自手机 | 显示全部楼层
沙发顶楼主一个
发表于 2018-6-4 07:51 | 显示全部楼层
缺少自定义函数:EH-Ent-9pt、EH-Get-Midpt、EH-Pts-9pt
发表于 2018-6-4 08:17 | 显示全部楼层
缺少自定义函数:
EH-SS-9pt
发表于 2018-6-29 13:54 | 显示全部楼层
"no function definition: EH-SS-9PT"
 楼主| 发表于 2018-9-4 09:08 | 显示全部楼层
那些自定义函数都是很基础的通用函数了,论坛里有很多,就不重复了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-19 19:05 , Processed in 0.208476 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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