明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1570|回复: 1

求助关于Rectangle命令不能正常执行

[复制链接]
发表于 2003-12-17 15:31:00 | 显示全部楼层 |阅读模式
自从试装了CAD2002后,rectangle就有问题。尤其在输入的点为0.xx时,总是显示成一条直线,莫名其妙。更可恨,这几天再试Lisp时编的一段小程序在别人的机子上正常,在我这儿就不正常,比如让它显示40个列,只显示10个!求各位大侠指点迷津,不胜感激。
(我把别人的程序拷过来覆盖了CAD目录下所有文件,还是不行。现在换成CAD2000也还是不正常)

(defun niu_draw_dots()
  (setq LeftDown (getpoint "请指定开始点!"))
  (setq width (getreal "请输入点的宽度"))
  (setq height (getreal "请输入点的高度"))
  (setq WidthPitch (getreal "请输入点的宽度Pitch"))
  (setq HeightPitch (getreal "请输入点的高度Pitch"))
  (setq ColNum (getint "请输入列数目"))
  (setq RowNum (getint "请输入行数目"))
  (setq strRightTop (strcat "@+" (rtos width 2 3) ",+" (rtos height 2 3)))
    ;转换为小数格式,精度3位
  (setq x (car LeftDown)) ;起始x
  (setq y (car (cdr LeftDown))) ;起始y
    ;指定对角点
  (setq RepeatTimes ColNum);开始画最底行
  (repeat repeattimes
    (command "rectangle" (list x y) strRightTop)
    (setq x (+ x WidthPitch))
      ;将x和y的值各增加20
   )
    ;开始画左列
  (setq RepeatTimes (- RowNum 1))
  (setq x (car LeftDown))
  (setq y (car (cdr LeftDown)))
  (setq y (+ y HeightPitch))
  (repeat repeattimes
    (command "rectangle" (list x y) strRightTop)
    (setq y (+ y HeightPitch))
  )
    ;开始画顶行
  (setq RepeatTimes (- ColNum 1))
  (setq x (car LeftDown))
  (setq y (car (cdr LeftDown)))
  (setq x (+ x WidthPitch))
  (setq y (+ y (* HeightPitch (- RowNum 1))))
    ;y=y+(RowNum-1)*HeightPitch
  (repeat repeattimes
    (command "rectangle" (list x y) strRightTop)
    (setq x (+ x WidthPitch))
  )
    ;开始画右列
  (setq RepeatTimes (- RowNum 1))
  (setq x (car LeftDown))
  (setq y (car (cdr LeftDown)))
    ;x=x+(ColNum-1)*WidthPitch
  (setq x (+ x (* WidthPitch (- ColNum 1))))
  (setq y (+ y HeightPitch))
  (repeat repeattimes
    (command "rectangle" (list x y) strRightTop)
    (setq y (+ y HeightPitch))
  )
)
发表于 2003-12-18 12:47:00 | 显示全部楼层
程序开头加上(setvar "osmode" 0)再试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-2 08:39 , Processed in 0.168662 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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