- UID
- 773205
- 积分
- 1260
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2017-12-26
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2020-8-18 10:18:09
|
显示全部楼层
xdrx-pickset-getsub这个函数比我之前用的方法的效率稍慢点,但是编程却方便多了。
测试如下:
;;;之前自己的方法
(defun get::lst(ss / lst-kz lst-bh lst-jm lst-yw-zj lst-yx)
(mapcar
'(lambda(x / str)
(cond
;;;框架柱边框
((xdrx-object-isa x "AcDbPolyline")
(setq lst-kz (cons x lst-kz))
);;;cond1
((xdrx-object-isa x "AcDbText")
(setq str (xdrx-text-string x))
(cond
((xdrx-string-find1 str "Z")
(setq lst-bh (cons x lst-bh));;;;柱编号
);;;
((xdrx-string-find1 str "x")
(setq lst-jm (cons x lst-jm));;;截面尺寸
);;;
(t
(setq lst-yw-zj (cons x lst-yw-zj));;;原位纵筋
);;;t
);;;cond2
);;;cond2
;;;引线
(t
(setq lst-yx (cons x lst-yx))
);;;cond3
);;;cond
);;;lambda
(xdrx-pickset->ents ss)
);;;mapcar
);;;defun
;;;现在的方法:
(defun get::lst1(ss / lst-kz lst-bh lst-jm lst-yw lst-yx xd::pickset:getsub)
(defun xd::pickset:getsub (ss fillter / ss1)
(setq ss1 ss)
(xdrx-pickset-getsub ss1 fillter)
);;;defun
(setq lst-kz (xdrx-pickset->ents (xd::pickset:getsub ss '((0 . "LWPOLYLINE")(8 . "砼柱,柱,SPRE_SPECCL_JIAO")(-4 . "&=")(70 . 1))))
lst-bh (xdrx-pickset->ents (xd::pickset:getsub ss '((0 . "text")(1 . "*KZ*,*LZ*,*QZ*")(8 . "柱集中标注"))))
lst-jm (xdrx-pickset->ents (xd::pickset:getsub ss '((0 . "text")(1 . "*###x###*")(8 . "柱集中标注"))))
lst-yw (xdrx-pickset->ents (xd::pickset:getsub ss '((0 . "text")(1 . "*%%*")(1 . "~*[@GN-]*")(8 . "柱原位标注"))))
lst-yx (xdrx-pickset->ents (xd::pickset:getsub ss '((0 . "LINE")(8 . "柱标注引线,柱集中标注"))))
);;;setq
);;;defun
结果均为表的情况下
测试程序
(defun c:tt(/ ss)
(setq ss (xdrx-ssget "\n框选“YJK、satwe框架柱施工平面图(原位详图型)”<退出>:" ":L"
'(
(-4 . "<or")
(-4 . "<and")(0 . "LWPOLYLINE")(8 . "砼柱,柱,SPRE_SPECCL_JIAO")(-4 . "&=")(70 . 1)(-4 . "and>")
(-4 . "<and")(0 . "text")(1 . "*%%*")(1 . "~*[@GN-]*")(8 . "柱原位标注")(-4 . "and>")
(-4 . "<and")(0 . "text")(1 . "*KZ*,*LZ*,*QZ*,*###x###*")(8 . "柱集中标注")(-4 . "and>")
(-4 . "<and")(0 . "LINE")(8 . "柱标注引线,柱集中标注")(-4 . "and>")
(-4 . "or>")
);;;
);;;xdrx
);;;setq
(repeat 5
(xd::quickbench
'(
(get::lst ss)
(get::lst1 ss)
)
)
);;;repeat
(princ)
)
命令: TT
框选“YJK、satwe框架柱施工平面图(原位详图型)”<退出>:指定对角点: 找到 284 个
框选“YJK、satwe框架柱施工平面图(原位详图型)”<退出>:
CPU:(1x)Intel(R) Core(TM) i7-7700 @ 3.60GHz 4Cores / Memory:24G / OS:WIN10企业版
Benchmarking ....... done for 64 iterations. Sorted from fastest.
Statement Increment Time(ms) Normalize Relative
-------------------------------------------------------------------------------
(GET::LST SS) 64 2016 2016 2.51 <fastest>
(GET::LST1 SS) 16 1266 5064 1.00 <slowest>
-------------------------------------------------------------------------------
CPU:(1x)Intel(R) Core(TM) i7-7700 @ 3.60GHz 4Cores / Memory:24G / OS:WIN10企业版
Benchmarking ....... done for 32 iterations. Sorted from fastest.
Statement Increment Time(ms) Normalize Relative
-------------------------------------------------------------------------------
(GET::LST SS) 32 1281 1281 1.98 <fastest>
(GET::LST1 SS) 16 1266 2532 1.00 <slowest>
-------------------------------------------------------------------------------
CPU:(1x)Intel(R) Core(TM) i7-7700 @ 3.60GHz 4Cores / Memory:24G / OS:WIN10企业版
Benchmarking ....... done for 32 iterations. Sorted from fastest.
Statement Increment Time(ms) Normalize Relative
-------------------------------------------------------------------------------
(GET::LST SS) 32 1515 1515 1.67 <fastest>
(GET::LST1 SS) 16 1266 2532 1.00 <slowest>
-------------------------------------------------------------------------------
CPU:(1x)Intel(R) Core(TM) i7-7700 @ 3.60GHz 4Cores / Memory:24G / OS:WIN10企业版
Benchmarking ....... done for 32 iterations. Sorted from fastest.
Statement Increment Time(ms) Normalize Relative
-------------------------------------------------------------------------------
(GET::LST SS) 32 1750 1750 1.46 <fastest>
(GET::LST1 SS) 16 1281 2562 1.00 <slowest>
-------------------------------------------------------------------------------
CPU:(1x)Intel(R) Core(TM) i7-7700 @ 3.60GHz 4Cores / Memory:24G / OS:WIN10企业版
Benchmarking ....... done for 32 iterations. Sorted from fastest.
Statement Increment Time(ms) Normalize Relative
-------------------------------------------------------------------------------
(GET::LST SS) 32 2000 2000 1.27 <fastest>
(GET::LST1 SS) 16 1265 2530 1.00 <slowest>
-------------------------------------------------------------------------------
命令:
结论:GET::LST效率稍高。
|
|