明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1298|回复: 1

求两条线延长相连的命令

[复制链接]
发表于 2008-9-25 08:43:00 | 显示全部楼层 |阅读模式

两条线,移动一条的端点与另一条的端点重合,用鼠标很容易实现,但命令不知道,想做LISP程序如下图让一个端点移动

@---------------------@         @-----------------@          @-------------------------@-----------------------------------@

 

 
发表于 2008-9-25 15:10:00 | 显示全部楼层

比较粗糙的:

(defun c:test ( / poi1 poi2 select1 first_point last_point)
    (setq poi1 (getpoint "\nFirst point:"))
    (setq poi2 (getpoint poi1 "\nFirst point:"))
    (setq select1 (ssget "c" (list (- (car poi1) 0.1) (- (cadr poi1) 0.1)) (list (+ (car poi1) 0.1) (+ (cadr poi1) 0.1))))

    (setq ent (entget (ssname select1 0)))
    (setq first_point (cdr (assoc 10 ent)))
    (setq last_point (cdr (assoc 11 ent)))
    (if (and (= (car poi1) (car first_point)) (= (cadr poi1) (cadr first_point)))
         (command "line" last_point  poi2 "")
  (command "line" first_point poi2 "")
   )
    (command "erase" select1 "")
)

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

本版积分规则

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

GMT+8, 2025-12-26 04:44 , Processed in 0.170095 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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