还有dim的类型。。。平常可能用得很少,用上了就知道好。
因为不光是1满足:
70 Polyline flag (bit-coded); default is 0:1 = This is a closed polyline (or a polygon mesh closed in the M direction)
2 = Curve-fit vertices have been added
4 = Spline-fit vertices have been added
8 = This is a 3D polyline
16 = This is a 3D polygon mesh
32 = The polygon mesh is closed in the N direction
64 = The polyline is a polyface mesh
128 = The linetype pattern is generated continuously around the vertices of this polyline
比如,1+8=9
即二进制0001 + 1000 = 1001
如果碰到一条polyline, 它是(70 . 9)的,
那么,根据9的二进制为1001, 它的右边第一位是1,说明它是闭合的。
又根据从右边数第4位也是1,说明这同时还是一条3dpoly
如何判断右边第一位是1呢,用 0001与它做逻辑与运算,
即 0001 and 1001 = 0001
所以,(logand 1 (cdr (assoc 70 ent)))即可判断右边第一位是不是1
同理,用 1000 (十进制即为8)与它做与运算,可以判断它是不是3dpoly
即 (logand 8 (cdr (assoc 70 ent)))
如果直接判断是不是为1,当然会漏掉好过种可能,你将不能正确判断闭合的3dpoly, 闭合的但fit过的polyline, 闭合的3dmesh等等。判断就不准确。 学习了,但还不是很明白
(loagand 7 15 3) 返回 3
怎么理解? 我收藏有这么一个例子
(if (= (logand (cdr (assoc 70 (tblsearch "LAYER" "dim"))) 1) 1)
(command "_.layer" "thaw" "dim" "")
(command "_.layer" "freeze" "dim" "")
)
只要冻结状态才解冻,其它状态都将冻结; http://bbs.mjtd.com/forum.php?mod=viewthread&tid=56976&page=1#pid467805 这两个函数平时不怎用到,也弄不太明白,今天终于了解了一些,不错. 谢谢各位大神分享 一言惊醒梦中人!!!
页:
1
[2]