jamsan 发表于 2003-12-17 15:31:00

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

自从试装了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))
)
)

meflying 发表于 2003-12-18 12:47:00

程序开头加上(setvar "osmode" 0)再试试
页: [1]
查看完整版本: 求助关于Rectangle命令不能正常执行