明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2035|回复: 18

[求助]请老师帮忙,此段函数错在哪里呀?

  [复制链接]
发表于 2004-12-23 14:41:00 | 显示全部楼层 |阅读模式
y1 (User 1 "" "\n输入柱断面Y方向偏心距离:" y1)
)
(setq pt2 (getpoint "\n输入参考轴线 <X轴>:"));;;注,我只想选择一条直线。用点选。
(setq exis (ssget pt2));;;用点选只含一条直线的选择集
(setq dote (ssname exis 0));;;我的意思是想从选择集中取出直线
(setq dote1 (entget dote));;;获得直线的定义数据
(setq ptstart (cdr (assoc 10 dote1));;;找出直线的起点值
ptend (cdr (assoc 11 dote1));;;找出直线的终点值
)
(setq ang (angle 'ptstart 'ptend));;;求出这直线的角度用来它用
上面这一段是我其中的一段函数,老是提示出错。请老师指导。谢谢。
发表于 2004-12-23 15:43:00 | 显示全部楼层
单选,何不用entsel的方式
 楼主| 发表于 2004-12-23 16:41:00 | 显示全部楼层
啊,有这命令的呀,谢谢指点。
 楼主| 发表于 2004-12-23 16:57:00 | 显示全部楼层
这样还是不对呀,要出错呀,倒底错在什么地方呀?我的全文如下, (defun C:cz ( / exis dote ptstart ptend ang pt1 r1 ptx p1 p2 p3 p4 c1)
(cmdla0)
(setq no1 (User 1 "" "\n设定柱断面宽度或直径B<D>:" no1)
no2 (User 1 "" "\n设定柱断面高度<当H=0时为圆柱>:" no2)
)
(setq x1 (User 1 "" "\n输入柱断面X方向偏心距离:" x1)
y1 (User 1 "" "\n输入柱断面Y方向偏心距离:" y1)
)
(setq exis (entsel "\n输入参考轴线 <X轴>:"))
(setq dote (entget exis))
(setq ptstart (cdr (assoc 10 dote))
ptend (cdr (assoc 11 dote))
)
(setq ang (angle 'ptstart 'ptend))
(setvar "clayer" "梁柱")
(setvar "osmode" 32)
(setq pt1 (getpoint "\n选择柱插入点:"))
(setvar "osmode" 0)
(setq r1 (/ no1 2))
(setq ptx (polar pt1 ang (+ x1 r1)))
(setq p1 (polar ptx (+ ang (/ pi 2)) (+ (/ no2 2) y1))
p2 (polar p1 ang (- 0 no1))
p3 (polar p2 (- ang (/ pi 2)) no2)
p4 (polar p3 ang no1)
)
(setvar "plinewid" 0)
(if (/= no2 0)
(command "_.pline" p1 p2 p3 p4 "c" "")
(command "_.circle" pt1 r1 "")
)
(setq c1 (entlast))
(setvar "clayer" "填充")
(command "-bhatch" "s" c1 "" "p" "solid" "" "a" "" "s" "" "i" "" "" "")
(command "solid" p1 p2 p4 p3 "")
(cmdla1)
(princ)
)
(defun CMDLA0 ()
(setq angd (getvar "angdir"))
(setq angb (getvar "angbase"))
(setq cmdech (getvar "CMDECHO"))
(setq oom (getvar "orthomode"))
(setq osm (getvar "osmode"))
(SETQ LA (getvar "clayer"))
(setq rmode (getvar "regenmode"))
(setq pw (getvar "plinewid"))
(setvar "regenmode" 0)
(setvar "CMDECHO" 0)
(setvar "angdir" 0)
(setvar "angbase" 0)
(princ)
)
(defun CMDLA1 ()
(setvar "angdir" angd)
(setvar "angbase" angb)
(setvar "CMDECHO" cmdech)
(setvar "orthomode" oom)
(setvar "osmode" osm)
(setvar "clayer" LA)
(setvar "regenmode" rmode)
(setvar "plinewid" pw)
(princ))
(defun User (bit kwd msg def / inp)
(if def
(setq msg (strcat "\n" msg "<" (rtos def 2) ">: ")
bit (* 2 (fix (/ bit 2))))
(setq msg (strcat "\n" msg ": ")))
(initget bit kwd)
(setq inp (getreal msg))
(if inp inp def)
)
发表于 2004-12-23 17:00:00 | 显示全部楼层
这样不行!要这样 (setq exis (car (entsel "\n输入参考轴线 <X轴>:")))
(setq dote (entget exis))
(setq ptstart (cdr (assoc 10 dote))
ptend (cdr (assoc 11 dote))
)
(setq ang (angle 'ptstart 'ptend))
 楼主| 发表于 2004-12-23 17:04:00 | 显示全部楼层
输入参考轴线 &lt;X轴&gt;:; 错误: 参数类型错误: 二维/三维点: PTSTART


还是不行呀,加入(car 提示上面这样了。
发表于 2004-12-23 17:06:00 | 显示全部楼层
(setq exis (car (entsel "输入参考轴线 &lt;X轴&gt;:")))
发表于 2004-12-23 17:10:00 | 显示全部楼层
不对呀!在我的机器上能行啊。是不是用的全角括弧?
 楼主| 发表于 2004-12-23 17:12:00 | 显示全部楼层
<BR>上面的CAR加上去是不是指只提取图元名。entsel是不是包括了,图元名加,自己输入的点坐标?
发表于 2004-12-23 17:14:00 | 显示全部楼层
xstlf发表于2004-12-23 17:12:00上面的CAR加上去是不是指只提取图元名。entsel是不是包括了,图元名加,自己输入的点坐标?

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

本版积分规则

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

GMT+8, 2024-11-18 01:35 , Processed in 0.161762 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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