明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: matichen

请问 LOGAND 的详细用法 (陈老师你那本书也说得太不详细了,就HELP里那两个例子,

  [复制链接]
发表于 2002-10-12 23:20:00 | 显示全部楼层

还有dim的类型。。。平常可能用得很少,用上了就知道好。

发表于 2002-10-13 08:47:00 | 显示全部楼层

因为不光是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等等。判断就不准确。
发表于 2011-6-16 15:47:21 | 显示全部楼层
学习了,但还不是很明白
(loagand 7 15 3)            返回              3
怎么理解?
发表于 2011-6-16 16:36:40 | 显示全部楼层
我收藏有这么一个例子
(if (= (logand (cdr (assoc 70 (tblsearch "LAYER" "dim"))) 1) 1)
        (command "_.layer" "thaw" "dim" "")
        (command "_.layer" "freeze" "dim" "")
  )
只要冻结状态才解冻,其它状态都将冻结;
发表于 2011-6-16 16:50:02 | 显示全部楼层
发表于 2013-5-9 17:32:31 | 显示全部楼层
这两个函数平时不怎用到,也弄不太明白,今天终于了解了一些,不错.
发表于 2019-10-31 09:19:05 | 显示全部楼层
谢谢各位大神分享
发表于 2020-1-16 00:13:15 | 显示全部楼层
一言惊醒梦中人!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-18 09:11 , Processed in 0.155110 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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