找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 490|回复: 0

[LISP程序]:;;;线段在上方---一个问题

[复制链接]
发表于 2003-6-19 16:05:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
;;;线段在上方
(defun c:cheng_upline(/ e0 ss e1 p0 p1 p2 p3 p4 p5 p6 loop i x y x1 x2 r m)
  (setq e0 (entsel "\n选择在上方的线段:"))  
  (setq ss (ssget "x" '((0 . "LINE"))))
  (ssdel (car e0) ss)
  (setq loop (sslength ss))
  (setq p1 (cdr (assoc 10 (entget (car e0)))))
  (if (= "LINE" (cdr (assoc 0 (entget (car e0)))))
    (progn
     (setq p2 (cdr (assoc 11 (entget (car e0)))))
    )
  )   
  ;(setq w (cdr (assoc 41 (entget (car e0)))))
  (setq width (getreal "\n输入打断间距<50>:"))
  (if (or (= "" width) (= nil width)) (setq width 100))  
  (setq i 0)
  (setq m 0)
  (command "zoom" "w" "0,0" "1,1")  
  (repeat loop
    (setq e1 (ssname ss i))
    (setq i (+ i 1))   
    (if (= "LINE" (cdr (assoc 0 (entget e1))))
        (progn
          (setq p3 (cdr (assoc 10 (entget e1))))
                       (setq p4 (cdr (assoc 11 (entget e1))))
        )
    )
    (setq p0 (inters p1 p2 p3 p4))
    (if (/= p0 nil)
        (progn          
          (setq x (car p0))
              (setq y (car(cdr p0)))
          (setq r (angle p3 p4))
          (setq x1 (- x (* width (cos r))))
          (setq x2 (- y (* width (sin r))))
          (setq p5 (list x1 x2 0.0))
          (setq x1 (+ x (* width (cos r))))
          (setq x2 (+ y (* width (sin r))))
          (setq p6 (list x1 x2 0.0))          
          (if (or (equal p1 p3) (equal p1 p4) (equal p2 p3) (equal p2 p4) (equal p1 p0) (equal p2 p0))
            (princ)
            (progn
              (command "break" e1 p5 p6)
              (setq m (+ m 1))
            )
          )
        )   
    )
  )
  (command "zoom" "p")
  (princ "\n总共完成") (princ m) (princ "项。")
  (princ)
)

一个问题:
为什么必须在程序中加入指令:
(command "zoom" "w" "0,0" "1,1")
(command "zoom" "p")
才能正确的完成该函数!?
如果去掉这两个指令则出错!!!
在AUTOCAD R14+天正+晓东工具 调试。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2025-9-26 11:15 , Processed in 0.273347 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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