明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1249|回复: 5

[求助]

[复制链接]
发表于 2010-5-9 09:29:00 | 显示全部楼层 |阅读模式

本人编写的CAD自动分图程序,但是加载CAD后运行不了,请高手们给指点指点!!谢谢大家了!!急用!!!

(setq t1 (getpoint "\n拾取起始点:"))
(setq t3 (getcorner t1 "\n拾取t的对角点:"))
(setq t2 (list(car t3) (cdr t1)))
(setq t4 (list(car t1) (cdr t3)))
(command"line" t1 t2 t3 t4 "c")
(setq chang (distance t1 t2))
(setq kuan (distance t2 t3))
(setq chang (- (car t2) (car t1)))
(setq kuan(- (cdr t2) (cdr t3)))
(if(< kuan 474000) (setq n1 (rtos (+ (/ chang 420000) 1 ) 2 0 )))
(setq i 1)
 (setq x1 (car t1))
(setq y1 (cdr t1))
(repeat n1 (PROGN
   (setq x1i (+ xi 420000))
   (setq y1i (- yi 474000))
   (setq xiyi (list xi yi))
(command"osnap" "off")
(setq s (ssget "w" (xi yi) (x1i y1i)))
  (setq th 0)
  (setq xxx 0)
  (setq name (ssname s 0))
  (setq a (entget name))
  (setq tt (assol 0 a))
  (setq tt (car t1))
(if (=tt "text") (PROGN
  (setq tx (assol a))
  (setq tx (cdr tx))
  (setq llen (strlen tx))
    (setq tx1 (substr tx 1 llen ))
    ))
(while (/=xxx nil))
(if (<th 10)(setq thh (strcat "0" (rtos th 2 0 ))))
(if (>=th 10)(setq thh (rtos th 2 0 ))))
    (setq namel (strcat tx1 thh))
    (setq th (+ th 1))
    (setq p1 xiyi)
    (setq xxx p1 )
(if (/=p1 nil)(PROGN
    (setq p2 x1iy1i)
(setq mmm (strcat "e:/fengtu /""A3""namel"))
(command "wblak" mmm "p1" w "p1 p2")
(command "oops")
   (setq xi (+ xi 420000))
))

(if( and (< kuan 474000) (< kuan 700000) (setq n2 (rtos (+ (/ chang 758000) 1 ) 2 0)))
(setq i 1)
 (setq x1 (car t1))
(setq y1 (cdr t1))
(repeat n1 (PROGN
   (setq x1i (+ xi 758000))
   (setq y1i (- yi 700000))
   (setq xiyi (list xi yi))
(command"osnap" "off")
(setq s (ssget "w" (xi yi) (x1i y1i)))
  (setq th 0)
  (setq xxx 0)
  (setq name (ssname s 0))
  (setq a (entget name))
  (setq tt (assol 0 a))
  (setq tt (car t1))
(if (=tt "text") (PROGN
  (setq tx (assol a))
  (setq tx (cdr tx))
  (setq llen (strlen tx))
    (setq tx1 (substr tx 1 llen ))
    ))
(while (/=xxx nil))
(if (<th 10)(setq thh (strcat "0" (rtos th 2 0 ))))
(if (>=th 10)(setq thh (rtos th 2 0 ))))
    (setq namel (strcat tx1 thh))
    (setq th (+ th 1))
    (setq p1 xiyi)
    (setq xxx p1 )
(if (/=p1 nil)(PROGN
    (setq p2 x1iy1i)
(setq mmm (strcat "e:/fengtu /""A3""namel"))
(command "wblak" mmm "p1" w "p1 p2")
(command "oops")
   (setq xi (+ xi 420000))
))

(if(and (< kuan 700000) (<kuan 1046000) (setq n3 (rtos (+ (/ chang 1452000) 1 ) 2 0)))
(setq i 1)
 (setq x1 (car t1))
(setq y1 (cdr t1))
(repeat n1 (PROGN
   (setq x1i (+ xi 1452000))
   (setq y1i (- yi 1046000))
   (setq xiyi (list xi yi))
(command"osnap" "off")
(setq s (ssget "w" (xi yi) (x1i y1i)))
  (setq th 0)
  (setq xxx 0)
  (setq name (ssname s 0))
  (setq a (entget name))
  (setq tt (assol 0 a))
  (setq tt (car t1))
(if (=tt "text") (PROGN
  (setq tx (assol a))
  (setq tx (cdr tx))
  (setq llen (strlen tx))
    (setq tx1 (substr tx 1 llen ))
    ))
(while (/=xxx nil))
(if (<th 10)(setq thh (strcat "0" (rtos th 2 0 ))))
(if (>=th 10)(setq thh (rtos th 2 0 ))))
    (setq namel (strcat tx1 thh))
    (setq th (+ th 1))
    (setq p1 xiyi)
    (setq xxx p1 )
(if (/=p1 nil)(PROGN
    (setq p2 x1iy1i)
(setq mmm (strcat "e:/fengtu /""A3""namel"))
(command "wblak" mmm "p1" w "p1 p2")
(command "oops")
   (setq xi (+ xi 420000))
))

(if(and (<kuan 1046000) (< kwan 1540000) (setq n4 (rtos (+ (/ chang 1948000) 1 ) 2 0)))
(setq i 1)
 (setq x1 (car t1))
(setq y1 (cdr t1))
(repeat n1 (PROGN
   (setq x1i (+ xi 1948000))
   (setq y1i (- yi 1540000))
   (setq xiyi (list xi yi))
(command"osnap" "off")
(setq s (ssget "w" (xi yi) (x1i y1i)))
  (setq th 0)
  (setq xxx 0)
  (setq name (ssname s 0))
  (setq a (entget name))
  (setq tt (assol 0 a))
  (setq tt (car t1))
(if (=tt "text") (PROGN
  (setq tx (assol a))
  (setq tx (cdr tx))
  (setq llen (strlen tx))
    (setq tx1 (substr tx 1 llen ))
    ))
(while (/=xxx nil))
(if (<th 10)(setq thh (strcat "0" (rtos th 2 0 ))))
(if (>=th 10)(setq thh (rtos th 2 0 ))))
    (setq namel (strcat tx1 thh))
    (setq th (+ th 1))
    (setq p1 xiyi)
    (setq xxx p1 )
(if (/=p1 nil)(PROGN
    (setq p2 x1iy1i)
(setq mmm (strcat "e:/fengtu /""A3""namel"))
(command "wblak" mmm "p1" w "p1 p2")
(command "oops")
   (setq xi (+ xi 420000))
))

(if( > kuan 1540000) (PROGN
   (setq n5 (rtos (/ kuan 2) 2 0)
   (setq x0 (car t1))
   (setq y1 (cdr t1))
   (setq y0 (- y1 n5))
   (setq t0 (list x0 y0))
   (setq y11 (+ y0 974000))
   (setq t11 (list x0 y11))
   (setq x12 (+ X0 1948000))
   (setq t12 (list x12 y11))
   (setq y13 (- y11 1546000))
   (setq t13 (list x12 y13))
   (setq t14 (list x0 y13))
(command "line" t11 t12 t13 t14 "c")
(setq i 1)
 (setq x1 (car t1))
(setq y1 (cdr t1))
(repeat n1 (PROGN
   (setq x1i (+ xi 1948000))
   (setq y1i (- yi 1540000))
   (setq xiyi (list xi yi))
(command"osnap" "off")
(setq s (ssget "w" (xi yi) (x1i y1i)))
  (setq th 0)
  (setq xxx 0)
  (setq name (ssname s 0))
  (setq a (entget name))
  (setq tt (assol 0 a))
  (setq tt (car t1))
(if (=tt "text") (PROGN
  (setq tx (assol a))
  (setq tx (cdr tx))
  (setq llen (strlen tx))
    (setq tx1 (substr tx 1 llen ))
    ))
(while (/=xxx nil))
(if (<th 10)(setq thh (strcat "0" (rtos th 2 0 ))))
(if (>=th 10)(setq thh (rtos th 2 0 ))))
    (setq namel (strcat tx1 thh))
    (setq th (+ th 1))
    (setq p1 xiyi)
    (setq xxx p1 )
(if (/=p1 nil)(PROGN
    (setq p2 x1iy1i)
(setq mmm (strcat "e:/fengtu /""A3""namel"))
(command "wblak" mmm "p1" w "p1 p2")
(command "oops")
   (setq xi (+ xi 420000))

本帖子中包含更多资源

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

x
发表于 2010-5-9 09:33:00 | 显示全部楼层
请先上传调试此程序用的配合文件(*.Dwg)
 楼主| 发表于 2010-5-9 09:39:00 | 显示全部楼层
?是CAD图纸吗?
 楼主| 发表于 2010-5-9 09:54:00 | 显示全部楼层

?

发表于 2010-5-9 10:03:00 | 显示全部楼层
您在调试此程序时作用中的Drawing
 楼主| 发表于 2010-5-9 10:06:00 | 显示全部楼层

不明白,能具体解释一下吗?谢谢!!真的等着

急用!!

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

本版积分规则

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

GMT+8, 2024-10-2 01:24 , Processed in 0.165424 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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