doubolin1 发表于 2014-3-2 22:15:03

我的是cad2010 64位,天正给排水2014,使用选择易时出现
命令: ss
请选择样板实体(H-Help/ N-打开块属性显示/
B-打开动态块特性显示,当前状态:块属性关闭,动态块特性关闭):sl:dialog{label="我的选择易v1.29--By 小菜";
:column{
:boxed_column{label="过滤条件";
:boxed_column{label="通用";
:row{fixed_width=true;
:toggle{key="0";label="实体类型";width=14;}
:popup_list{edit_width=6;key="pop0";list= "=\n<>";}
:edit_box{value="TCH_DIMENSION2";key="txt0";edit_width=16;allow_accept=true;}
:popup_list{key="inf0";edit_width=12;list="当前实体\n所有实体\n视
口\n线和圆弧\n各种线\n类型多选...";}
}
:row{fixed_width=true;
:toggle{key="6";label="实体线型";width=14;}
:popup_list{edit_width=6;key="pop6";list= "=\n<>";}
:edit_box{value="ByLayer";key="txt6";edit_width=16;allow_accept=true;}
:popup_list{key="inf6";edit_width=12;list="实体线型\n所有线型\n当前线型\n线型多选...";}
}
:row{fixed_width=true;
:toggle{key="8";label="所在图层";width=14;}
:popup_list{edit_width=6;key="pop8";list= "=\n<>";}
:edit_box{value="AXIS";key="txt8";edit_width=16;allow_accept=true;}
:popup_list{key="inf8";edit_width=12;list="实体图层\n所有图层\n当前图层\n图层多选...";}
}
:row{fixed_width=true;
:toggle{key="62";label="实体颜色";width=14;}
:popup_list{edit_width=6;key="pop62";list= "=\n<\n>\n<=\n>=\n<>\n&\n&=";}
:edit_box{value="256";key="txt62";edit_width=16;allow_accept=true;}
:popup_list{key="inf62";edit_width=12;list="随层\n随块\n红色\n黄色\n绿色\n青色\n蓝色\n紫色\n黑白\n
其它...";}
}
:row{fixed_width=true;
:toggle{key="370";label="实体线宽";width=14;}
:popup_list{edit_width=6;key="pop370";list= "=\n<\n>\n<=\n>=\n<>\n&\n&=";}
:edit_box{value="-1";key="txt370";edit_width=16;allow_accept=true;}
:edit_box{value="容差";key="txta370";edit_width=12.3;allow_accept=true;}
}
}
:boxed_column{label="天正尺寸";
:row{fixed_width=true;
:toggle{key="47";label="天正比例";width=14;}
:popup_list{edit_width=6;key="pop47";list= "=\n<\n>\n<=\n>=\n<>";}
:edit_box{value="80.0";key="txt47";edit_width=16;allow_accept=true;}
:edit_box{value="容差";key="txta47";edit_width=12.3;allow_accept=true;}
}
}
:boxed_column{label="附加过滤";
:row{fixed_width=true;
:toggle{key="FJ1";label="显示颜色";width=14;}
:popup_list{edit_width=6;key="popFJ1";list="=\n/=\n<\n>\n<=\n>=";}
:edit_box{value="3";key="txtFJ1";edit_width=16;allow_accept=true;}
:popup_list{key="infFJ1";edit_width=12;list="绿色\n随层\n随块\n红色\n黄色\n青色\n蓝色\n紫色\n黑白\
n其它...";}
}
:row{fixed_width=true;
:toggle{key="FJ2";label="显示线型";width=14;}
:popup_list{edit_width=6;key="popFJ2";list= "=\n/=\nwcmatch\nnot match";}
:edit_box{value="CONTINUOUS";key="txtFJ2";edit_width=16;allow_accept=true;}
:popup_list{key="infFJ2";edit_width=12;list="CONTINUOUS\n实体线型\n所有线型\n当前线型\n线型多选.
..";}
}
}
}
}
:image {color = dialog_background ;height = 0.01 ;}
:row
{alignment=centered;fixed_width=true;:button{key="hand";label="手选&S";width=12;}
:button{key="all";label="全选&A";width=12;}:button{key="per";label="预选&D";width=12
;}
:button{is_cancel=true;fixed_width=true;width=12;
key="cancel";label="取消&C";}:button{fixed_width=true;width=12;
key="add";label="附加&V>>";}
}}
; 错误: 参数类型错误: streamp nil

小菜123 发表于 2014-3-3 07:54:06

把图传上来看看,出错的实体标出来。这个对话框文件会在屏幕上显示?

doubolin1 发表于 2014-3-3 16:51:50

小菜123 发表于 2014-3-3 07:54 static/image/common/back.gif
把图传上来看看,出错的实体标出来。这个对话框文件会在屏幕上显示?

上面这段话只是出现在命令栏里,任何实体都不能选择。能否加您的Q,具体说明一下情况。

小菜123 发表于 2014-3-3 19:09:55

似乎是选择“TCH_DIMENSION2”样本实体后出错了,其它样本实体都不能选择么?

smartstar 发表于 2014-3-7 14:37:07

增加对wipeout的过滤选择("WIPEOUT" ((-4 "区域覆盖")
       (71 "剪裁边界" ((1 "矩形") (2 "多边形")))
       ;;(91 "顶点数值")    ;后面的裁剪边界顶点数(不明白什么意思,总是比“附加过滤”中的“顶点数值”的值大1)
       (280 "剪裁状态"( (0 "关闭")   (1 "打开")));总是不出现下拉框,不知道为什么
       (281 "图形亮度")
       (282 "对比度值")
       (283 "淡入度值")
       (70 "显示特性";调试中组码70的值总是7,cad说明中无此项
   ((1 "显示图像")
       (2 "当与屏幕不对齐时显示图像")
       (4 "使用剪裁边界")
       (7 "★未知情况")
       (8 "透明度打开")
   )
       )
      
   )

   ("FJ"
       ("FJ5" "顶点数值" (length (wipeout2plst slent)))
       ("FJ6" "覆盖面积"   (abs (XD::PNTS:Area (wipeout2plst slent))) )
   )

)



;|
函数名称:XD::PNTS:Area
调用格式:(XD::PNTS:Area pts)
参数说明:pts ---- 点表
返回值:    实数
函数简介:点围成的多边形面积
函数来源:原创
函数作者:Lispboy
适用版本:不限
最后更新时间:2013-06-07

备注:
函数本身并不是重要的,重要的是利用它判断点表的顺、逆时针。
采用的是数学的行列式的方法算得面积,面积有正负,逆时针正,顺时针负。
点表构成的多边形要保证不自交,自交可能结果不对。

点围成的多边形面积

参数: pts ----点表

返回值: 实数
副作用: 如果点表是逆时针,面积正, 顺时针 面积负

|;

(defun XD::PNTS:Area (pts / pts1 iSum p0 p1 p2 x0 x1 x2 y0 y1 y2)
(setq pts1 pts)
(setq iSum 0)
(setqp0 (car pts)
x0 (car p0)
y0 (cadr p0)
)
(while (cdr pts1)
    (setq p1   (car pts1)
    x1   (car p1)
    y1   (cadr p1)
    p2   (cadr pts1)
    y2   (cadr p2)
    x2   (car p2)
    iSum (+ iSum (- (* x1 y2) (* x2 y1)))
    pts1 (cdr pts1)
    )
)
(/ (+ iSum (- (* (caar pts1) y0) (* x0 (cadar pts1)))) 2.0)
)

;; WO2PL (gile)
;; Re-creates a wipeout boundary (lwpolyline)
;; http://www.theswamp.org/index.php?topic=28059.msg336431#msg336431
;; returns the wipeout point list (WCS)
(defun wipeout2plst (wo / elst u v mat)
(setqelst (entget wo)
u    (cdr (assoc 11 elst))
v    (cdr (assoc 12 elst))
mat(list u (mapcar '- v) '(0. 0. 1.))
)
(mapcar
    '(lambda (p)
       (mapcar '+
         (mxv (trp mat) p)
         (mapcar '(lambda (x y) (/ (+ x y) 2.)) u v)
         (cdr (assoc 10 elst))
       )
   )
    (cdr
      (mapcar 'cdr
      (vl-remove-if-not '(lambda (x) (= (car x) 14)) elst)
      )
    )
)
)

小菜123 发表于 2014-3-7 16:01:30

谢谢提供

smartstar 发表于 2014-3-7 17:09:48

添加对WIPEOUT过滤时,发现个问题,能力有限,望老大解决。详见图片:




测试文件

小菜123 发表于 2014-3-7 21:47:29

曲线面积是CAD曲线自带的属性,不是选择易的问题。只画一条直线,也是有面积的,但在几何上却不应该有。把Wipeout的顶点连成直线后计算面积,好像意义不大,没有考虑顶点之间是曲线的问题

小菜123 发表于 2014-3-9 10:43:18

关于面积计算,XD::PNTS:Area函数说明中已经说了不支持自相交,事实上自相交曲线很多时候都会不方便计算。曲线面积是自动桌子自己算的,低版本的CAD中是0,2014中不是0,不必深究。
另外这个测试图为什么存个低版本就是65M之大?
一楼程序已更新。

小菜123 发表于 2014-3-9 19:03:27

本帖最后由 小菜123 于 2014-3-9 19:05 编辑

左下角那个多段线,没有采用C进行闭合,显示顶点个数是5,这时候面积就是0,如果pt4后用C闭合,则面积显示正确。
用area命令,按图输入五个点,面积也是0
页: 61 62 63 64 65 66 67 68 69 70 [71] 72 73 74 75 76 77 78 79 80
查看完整版本: 小菜版选择易,欢迎使用并提出完善建议