明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1525|回复: 2

求助

[复制链接]
发表于 2003-5-12 21:54:00 | 显示全部楼层 |阅读模式
命令行提示
参数错误:二维三维/nil
请问是那一方面的错误
 楼主| 发表于 2003-5-12 21:56:00 | 显示全部楼层

程序如下

(defun c:dyzc ()
  (setq oldmode (getvar "osmode"))
  (setvar "osmode" 0)       
  (setq p1 (getpoint "\n请输入基点:"))
  (setq a (getreal "\n 请输入定位销直径:"))
  (defun sub_chk_layer()
   (setq chklay (tblsearch "layer" "str"))
   (if (= chklay nil)
       (command "layer" "n" "str" "c" "4" "str" "")
   )
   (setq chklay (tblsearch "layer" "txt"))
   (if (= chklay nil)
       (command "layer" "n" "txt" "c" "3" "txt" "")
   )
   (setq chklay (tblsearch "layer" "dim"))
   (if (= chklay nil)
       (command "layer" "n" "dim" "c" "5" "dim" "")
   )
   (setq chklay (tblsearch "layer" "hat"))
   (if (= chklay nil)
       (command "layer" "n" "hat" "c" "6" "hat" "")
   )
   (setq chklay (tblsearch "layer" "cen"))
   (if (= chklay nil)
       (command "layer" "n" "cen" "c" "1" "cen" "lt" "center" "cen" "")
   )
   (setq chklay (tblsearch "layer" "hid"))
   (if (= chklay nil)
       (command "layer" "n" "hid" "c" "2" "hid" "lt" "hidden" "hid" "")
   )
  )
  (defun cen()
    (command "layer" "s" "cen" ""))
  (defun hid()
    (command "layer" "s" "hid" ""))
  (defun str()
    (command "layer" "s" "str" ""))
  (defun txt()
    (command "layer" "s" "txt" ""))
  (defun dim()
    (command "layer" "s" "dim" ""))
  (defun hat()
    (command "layer" "s" "hat" ""))

   
(cond
  ((= a 16)  (progn (setq d 16.20) (setq s 14.0)  (setq r 10.0) (setq r1 1.50) (setq l1 (getreal "\n l=(30 0r 40 or 55):")) (setq l (getreal "\n L=(55 0r 65 or 80):")) (setq l2 8.0)(setq c 2.50)  (setq h 3.0) (setq d1 13.50) (setq d2 10.90) (setq d3 10.0)(setq b 5.0)))
  ((= a 20)  (progn (setq d 19.60) (setq s 17.0)  (setq r 12.0) (setq r1 1.50) (setq l1 (getreal "\n l=(40 0r 55 or 70):")) (setq l (getreal "\n L=(70 0r 85 or 100):")) (setq l2 10.0)(setq c 2.50) (setq h 3.0) (setq d1 16.50) (setq d2 14.90) (setq d3 12.0)(setq b 5.0)))
  ((= a 24)  (progn (setq d 25.40) (setq s 22.0)  (setq r 16.0) (setq r1 1.50) (setq l1 (getreal "\n l=(50 or 65 or 85):")) (setq l (getreal "\n L=(85 or 100 or 120):")) (setq l2 12.0)(setq c 3.0)  (setq h 4.0)(setq d1 21.0) (setq d2 17.40) (setq d3 16.0) (setq b 6.50)))
  ((= a 30)  (progn (setq d 31.20) (setq s 27.0)  (setq r 20.0) (setq r1 2.0)  (setq l1 (getreal "\n l=(65 or 75 or 95):")) (setq l (getreal "\n L=(100 or 120 or 140):")) (setq l2 15.0)(setq c 3.50) (setq h 5.0)(setq d1 26.0) (setq d2 22.20) (setq d3 20.0)(setq b 7.50)))
  ((= a 36)  (progn (setq d 36.90) (setq s 32.0)  (setq r 24.0) (setq r1 2.0)  (setq l1 (getreal "\n l=(65 or 85 or 105):")) (setq l (getreal "\n L=(120 or 140 or 160):")) (setq l2 18.0)(setq c 3.50) (setq h 5.0)(setq d1 31.0) (setq d2 28.20) (setq d3 21.0)(setq b 7.50)))         
  (t (alert "\n没有此值") (exit))
)
  (setq a3 (- r (sqrt (- (* r r) (/ (* d3 d3) 4.0)))))
  (setq
        p2 (polar p1 (* pi 0.50) (- (* a 0.50) c))
        p3 (polar p2 (* pi 0.75) (* 1.4142 c))
        p4 (polar p3 pi (- l1 c b (/ (- a d2) 2.0)))
        p5 (polar p4 (* 1.25 pi) (* 0.7071 (- a d2)))
        p6 (polar p5 pi (- b r1))
        p7 (polar p6 (* pi 0.75) (* 1.4142 r1))
        p8 (polar p7 (* pi 0.50) (- (/ (- d d1) 2.0) r1))
        p9 (polar p8 pi h)
        p10 (polar p9 pi (- l l1 l2 h (* 0.288675 (- d d1))))
               p11 (polar p10 (* pi 1.166667) (* 0.288675 (- d d1)))
        p12 (polar p11 (* pi 1.5) (- (/ (- d1 d3) 2.0) 1.0))
        p13 (polar p14 (* pi 1.25) 1.4142)
        p14 (polar p13 pi (- l2 1.0 a3))
        p15 (polar p1 pi (- l r))
        p16 (polar p14 (* pi 1.50) d3)
        p17 (polar p13 (* pi 1.50) d3)
        p18 (polar p12 (* pi 1.50) (+ d3 2.0))
        p19 (polar p11 (* pi 1.50) d1)
        p20 (polar p10 (* pi 1.50) d)
        p21 (polar p9 (* pi 1.50) d)
        p22 (polar p8 (* pi 1.50) d)
        p23 (polar p7 (* pi 1.50) (+ d2 r1 r1))
        p24 (polar p6 (* pi 1.50) d2)
        p25 (polar p5 (* pi 1.50) d2)
        p26 (polar p4 (* pi 1.50) a)
        p27 (polar p3 (* pi 1.50) a)
        p28 (polar p2 (* pi 1.50) (- a c c))
        p29 (polar p9 (* pi 1.50) (/ d 4.0))
        p30 (polar p29 pi (- l l1 l2 h (* 0.288675 (- d d1))))
        p31 (polar p21 (/ pi 2.0) (/ d 4.0))
        p32 (polar p32 pi (- l l1 l2 h (* 0.288675 (- d d1))))
        p33 (polar p1 (* pi 2.0) 1.0)
        p34 (polar p1 pi (+ l 1.0))                        
   )
  (setq a1 (/ (+ (- (* 0.098958 d d) (* 0.16667 d d1)) (* 0.08333 d1 d1)) (* 0.577735 (- d d1))))
  (setq a2 (/ (+ (* 0.0833333 (- d d1) (- d d1))) (* 0.577735 (- d d1))))  
(sub_chk_layer)
(str)
  (command "pline" p2 p3 p4 p5 p25 p26 p27 p28 "c")
  (command "pline" p5 p6 p24 p25 "")
  (command "line" p3 p27 "")
  (command "line" p4 p26 "")
  (command "pline" p8 p10 p11 p19 p20 p22 "c")
  (command "pline" p13 p14 p16 p17 "c")
  (command "line" p14 p16 "")
  (command "line" p29 p30 "")
  (command "line" p31 p32 "")
; (command "arc" p6 "en" p7 "a" 90 "")
; (command "arc" p23 "en" p24 "a" 90 "")
; (command "arc" p12 "en" p13 "a" 90 "")
; (command "arc" p17 "en" p18 "a" 90 "")
; (command "arc" p14 "ce" p15 p16 "")
; (command "arc" p30 "en" p11 "r" a1 "")
; (command "arc" p30 "en" p31 "r" a2 "")
; (command "arc" p31 "en" p19 "r" a1 "")
(cen)
(command "line" p33 p34 "")
(setvar "osmode" oldmode)

            
)
发表于 2003-5-13 08:51:00 | 显示全部楼层

你的P13和P14不可以这样付值,必须先给P14或P13付值

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

本版积分规则

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

GMT+8, 2024-11-26 11:31 , Processed in 0.161932 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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