找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 672|回复: 4

[求助] 求大神看这段程序为什么显示参数过多,谢谢

[复制链接]
发表于 2019-3-3 16:57:40 | 显示全部楼层 |阅读模式

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

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

×
(defun c:bearing1 (/ d x y id std x1 y1)
  (defun getdata ()
    (setq ra (atof (get_tile "ra_box")))
    (setq rb (atof (get_tile "rb_box")))
    (setq b (atof (get_tile "b_box")))
    (setq r1 (atof (get_tile "r1_box")))
    (setq alf (atof (get_tile "alf_box")))
    (setq x (atof (get_tile "X_box")))
    (setq y (atof (get_tile "Y_box")))
    (setvar "cmdecho" 0)
    (setval "layer" "m" "solid" "")
    (setq id (load_dialog "C:\Users\\Administrator\\Desktop\\新建文本文档.dcl"))
    (if (< id 0)
      (exit)
    )
    (setq j 30
          l 10
          b 9
          r1 0.6
          alf 0
          x 0
          y 0
          std 3
          p0 (list 0 O)
    )
    (while (> std 1)
      (if (not (new_dialog "bearing1" id))
        (exit)
      )                                       ; 初始化对话框bearin,
      (setq x1 (dimx_tile "image"))    ; 设置x1为图像宽
      (setq y1 (dimy_tile "image"))    ; 设置y1为图像高
      (start_image "image")               ; 开始建 立图像
      (slide_image 0 0 x1 y1 "D:\\bearing1.sld")
      (end_image)                       ; 图像建 立完毕
      (set_tile "j_box" (rtos J 2 2))
      (set_tile "l_box" (rtos l 2 2))
      (set_tile "b_box" (rtos b 2 2))
      (set_tile "r1_box" (rtos r1 2 2))
      (set_tile "alf_box" (rtos alf 2 2))
      (set_tile "x_box" (rtos x 2 2))
      (set_tile "y_box" (rtos y 2 2))
      (setq p0 (list x y))
      (action_tile "pick" "(getdata)(done-dialog 2)")
      (action_tile "p_a" "(getdata)(done-dialog 3)")
      (action_tile "accept" "(getdata)(done-dialog 1)")
      (action_tile "cancel" "(done-dialog 0)")
      (setq std (start_dialog))
      (if (= std 2)
        (prong (initget 1) (setq p0 (getpoint "定位点:"))
               (setq x (car p0)
                     y (cadr p0)
               )
        )
      )
      (if (= std 3)
        (progn                               ; 用光标确定螺旋角
          (initget 1)
          (setq ang (getangle p0 "输入螺旋角:"))
          (setq alf (* 180.0 (/ ang pi)))
        )
      )
    )
    (if (> std 0)
      (progn
        (setvar "osmode" 0)               ; 关闭目标捕捉状态
        (setvar "cmdecho" 0)
        (setq a1 (- ra rb))
        (setq b1 (* 0.5 b))
        b2
        (* 0.5 b1)
        a2
        (* 0.5 a1)
        a3
        (* 0.5 a2)
      )
      (setq p1 (polar p0 (+ alf (* 0.5 pi)) b2))
      (setq p2 (polar p0 (+ alf (* 0.5 pi)) b1)) ; p1-p16用于绘制直线
      (setq p3 (polar p0 (+ alf (* -0.5 pi)) b2))
      (setq p4 (polar p0 (+ alf (* -0.5 pi)) b1))
      (setq p5 (polar p2 alf rb))
      (setq p6 (polar p1 alf rb))
      (setq p7 (polar p4 alf rb))
      (setq p8 (polar p3 alf rb))
      (setq p9 (polar p2 alf ra))
      (setq p10 (polar p1 alf ra))
      (setq p11 (polar p4 alf ra))
      (setq p12 (polar p3 alf ra))
      (setq p16 (polar p6 alf a3))
      (setq p15 (polar p8 alf a3))
      (setq p13 (polar p16 alf a2))
      (setq p14 (polar p15 alf a2))
      (command "linetype" "set" "bylayer" " ") ; 设置新实体为随层
      (command "line" p2 p9 " ")
      (command "line" p1 p10 " ")
      (command "line" p9 p10 " ")
      (command "line" p4 p11 " ")
      (command "line" p3 p12 " ")
      (command "line" p11 p12 " ")
      (command "line" p5 p6 " ")
      (command "line" p7 p8 " ")
      (command "line" p15 p16 " ")
      (command "line" p13 p14 " ")
      (setq c1 (polar p9 (+ alf (* -0.5 pi)) (* 0.1 b1))) ; 设置倒圆角点
      (setq c2 (polar p9 (+ alf pi) (* 0.1 b1)))
      (setq c3 (polar p11 (+ alf (* 0.5 pi)) (* 0.1 b1)))
      (setq c4 (polar p11 (+ alf pi) (* 0.1 b1)))
      (command "fillet" "r" r1 "fillet" c1 c2)
      (command "fillet" "r" r1 "fillet" c3 c4)
      (setq pm1 (polar p15 (+ alf (* -0.5 pi)) 5)) ; 剖面线点
      (setq pm1 (polar p16 (+ alf (* 0.5 pi)) 5))
      (command "bhatch" "p" "ansi31" "2" "90" pm1 "") ; 绘制剖面线
      (command "bhatch" "p" "ansi31" "2" "0" pm2 "")
      (command "linetype" "set" "center" "") ; 设置新实体为中心线
      (setq p18 (polar p4 (+ alf (* -0.5 pi)) (* 0.1 b))) ; 剖面线点
      (setq p17 (polar p2 (+ alf (* 0.5 pi)) (* 0.1 b)))
      (setq p20 (polar p0 alf (+ ra (* 0.1 b1))))
      (setq p19 (polar p0 (+ alf pi) (* 0.1 b1)))
      (command "lind" p19 p20 "")
      (command "lind" p17 p18 "")
      (command "linetype" "set" "bylayer" "") ; 设置新实体为随层
      (setvar "dinscale" 5)               ; 开始尺寸标注
      (setq t1 (polar p7 (+ alf (* -0.5 pi)) b1))
      (setq t2 (polar p7 (+ alf (* -0.5 pi)) (* 0.5 b1)))
      (setq t3 (polar p10 alf (* 0.5 b1)))
      (setq t4 (polar p4 (+ alf (* 0.5 pi)) b2))
      (setq t5 (polar p4 (+ alf pi) (* 0.5 a2)))
      (command "dimlinear" p4 p11 "h" t1)
      (command "dimlinear" p4 p7 "h" t2)
      (command "dimlinear" P2 p4 "v" t3)
      (command "dimlinear" p13 p14 "v" t5)
      (princ)
    )
  )
  (unload_dialog id)
  (princ)
)



通过加载这段驱动程序实现在对话框输入参数画出推力滚子轴承,附件是对话框

新建文本文档.odcl

1.02 KB, 下载次数: 1, 下载积分: D豆 -1 , 活跃度 1

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 19个

财富等级: 恭喜发财

发表于 2019-3-3 17:27:01 | 显示全部楼层
你调用的是 (setq id (load_dialog "C:\Users\\Administrator\\Desktop\\新建文本文档.dcl"))

怎么附件是 ODCL的呢?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 55个

财富等级: 招财进宝

发表于 2019-3-4 07:54:11 | 显示全部楼层
错误百出啊
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 55个

财富等级: 招财进宝

发表于 2019-3-4 09:30:58 | 显示全部楼层
(defun c:bearing1 (/ d x y id std x1 y1)
(defun getdata ()
    (setq ra (atof (get_tile "ra_box")))
    (setq rb (atof (get_tile "rb_box")))
    (setq b (atof (get_tile "b_box")))
    (setq r1 (atof (get_tile "r1_box")))
    (setq alf (atof (get_tile "alf_box")))
    (setq x (atof (get_tile "X_box")))
    (setq y (atof (get_tile "Y_box")))
);end fun
    (setvar "cmdecho" 0)
    ;(setvar "layer" "m" "solid" "")
    (setq id (load_dialog "C:\\Users\\hanjianwen\\Desktop\\新建文本文档.dcl"))
    (if (< id 0)
      (exit)
    )
    (setq j 30
          l 10
          b 9
          r1 0.6
          alf 0
          x 0.0
          y 0.0
          std 3
          p0 (list 0 0)
    )
    (while (> std 1)
      (if (not (new_dialog "bearing1" id))
        (exit)
      )                                       ; 初始化对话框bearin,
      (setq x1 (dimx_tile "image"))    ; 设置x1为图像宽
      (setq y1 (dimy_tile "image"))    ; 设置y1为图像高
      (start_image "image")               ; 开始建 立图像
      (slide_image 0 0 x1 y1 "C:\\Users\\hanjianwen\\Desktop\\UXC.sld")
      (end_image)                       ; 图像建 立完毕
     
        (set_tile "ra_box" (rtos J 2 2))
      (set_tile "rb_box" (rtos l 2 2))
      (set_tile "b_box" (rtos b 2 2))
      (set_tile "r1_box" (rtos r1 2 2))
      (set_tile "alf_box" (rtos alf 2 2))
      (set_tile "X_box" (rtos x 2 2))
      (set_tile "Y_box" (rtos y 2 2))
      (setq p0 (list x y))
      (action_tile "pick" "(getdata)(done_dialog 2)")
      (action_tile "p_a" "(getdata)(done_dialog 3)")
      (action_tile "accept" "(getdata)(done_dialog 1)")
      (action_tile "cancel" "(done_dialog 0)")
      (setq std (start_dialog))
      (if (= std 2)
        (progn (initget 1) (setq p0 (getpoint "定位点:"))
               (setq x (car p0)
                     y (cadr p0)
               )
        )
      )
      (if (= std 3)
        (progn                               ; 用光标确定螺旋角
          (initget 1)
          (setq ang (getangle p0 "输入螺旋角:"))
          (setq alf (* 180.0 (/ ang pi)))
        )
      )
    );end if std>1

    (if (> std 0)
      (progn
        (setvar "osmode" 0)               ; 关闭目标捕捉状态
        (setvar "cmdecho" 0)
        (setq a1 (- ra rb))
        (setq b1 (* 0.5 b)
                b2 (* 0.5 b1)
                a2 (* 0.5 a1)
                a3 (* 0.5 a2)
              )
      (setq p1 (polar p0 (+ alf (* 0.5 pi)) b2))
      (setq p2 (polar p0 (+ alf (* 0.5 pi)) b1)) ; p1-p16用于绘制直线
      (setq p3 (polar p0 (+ alf (* -0.5 pi)) b2))
      (setq p4 (polar p0 (+ alf (* -0.5 pi)) b1))
      (setq p5 (polar p2 alf rb))
      (setq p6 (polar p1 alf rb))
      (setq p7 (polar p4 alf rb))
      (setq p8 (polar p3 alf rb))
      (setq p9 (polar p2 alf ra))
      (setq p10 (polar p1 alf ra))
      (setq p11 (polar p4 alf ra))
      (setq p12 (polar p3 alf ra))
      (setq p16 (polar p6 alf a3))
      (setq p15 (polar p8 alf a3))
      (setq p13 (polar p16 alf a2))
      (setq p14 (polar p15 alf a2))
      ;(command "linetype" "set" "bylayer" "") ; 设置新实体为随层
      (command "line" p2 p9 "")
      (command "line" p1 p10 "")
      (command "line" p9 p10 "")
      (command "line" p4 p11 "")
      (command "line" p3 p12 "")
      (command "line" p11 p12 "")
      (command "line" p5 p6 "")
      (command "line" p7 p8 "")
      (command "line" p15 p16 "")
      (command "line" p13 p14 "")
      (setq c1 (polar p9 (+ alf (* -0.5 pi)) (* 0.1 b1))) ; 设置倒圆角点
      (setq c2 (polar p9 (+ alf pi) (* 0.1 b1)))
      (setq c3 (polar p11 (+ alf (* 0.5 pi)) (* 0.1 b1)))
      (setq c4 (polar p11 (+ alf pi) (* 0.1 b1)))
      (command "fillet" "r" r1 "fillet" c1 c2)
      (command "fillet" "r" r1 "fillet" c3 c4)
      (setq pm1 (polar p15 (+ alf (* -0.5 pi)) 5)) ; 剖面线点
      (setq pm1 (polar p16 (+ alf (* 0.5 pi)) 5))
      (command "bhatch" "p" "ansi31" "2" "90" pm1 "") ; 绘制剖面线
      (command "bhatch" "p" "ansi31" "2" "0" pm2 "")
      ;(command "linetype" "set" "center" "") ; 设置新实体为中心线
      (setq p18 (polar p4 (+ alf (* -0.5 pi)) (* 0.1 b))) ; 剖面线点
      (setq p17 (polar p2 (+ alf (* 0.5 pi)) (* 0.1 b)))
      (setq p20 (polar p0 alf (+ ra (* 0.1 b1))))
      (setq p19 (polar p0 (+ alf pi) (* 0.1 b1)))
      (command "lind" p19 p20 "")
      (command "lind" p17 p18 "")
      ;(command "linetype" "set" "bylayer" "") ; 设置新实体为随层
      ;(setvar "dinscale" 5)               ; 开始尺寸标注
      (setq t1 (polar p7 (+ alf (* -0.5 pi)) b1))
      (setq t2 (polar p7 (+ alf (* -0.5 pi)) (* 0.5 b1)))
      (setq t3 (polar p10 alf (* 0.5 b1)))
      (setq t4 (polar p4 (+ alf (* 0.5 pi)) b2))
      (setq t5 (polar p4 (+ alf pi) (* 0.5 a2)))
      (command "dimlinear" p4 p11 "h" t1)
      (command "dimlinear" p4 p7 "h" t2)
      (command "dimlinear" P2 p4 "v" t3)
      (command "dimlinear" p13 p14 "v" t5)
      (princ)
    )
  );end if std>0
  (unload_dialog id)
  (princ)
)
;SETVAR 之类的都不对,就忽略了,自己查书去吧
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 55个

财富等级: 招财进宝

发表于 2019-3-4 09:36:15 | 显示全部楼层
是这样的码 123.png
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-23 14:38 , Processed in 0.183281 second(s), 40 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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