马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 newer 于 2019-1-8 21:24 编辑
普通的查找实现,算法上是n*n的时间复杂度
利用MPOLYGON,可以将复杂度降低到n
1、查找重叠的标注
 - (defun c:tt () (xdrx_begin)
- (if (and (xdrx_initssget "\n选择查重叠的标注<退出>:")
- (setq ss (xdrx_ssget '((0 . "dim*"))))
- (setq mt (xdrx_entity_getproperty ss "textbox")
- mt (apply 'append mt)
- )
- (setq mp (xdrx_curve->mpolygon mt))
- (setq cp (xdrx_getpropertyvalue mp "haschildloop" t))
- )
- (progn (xdrx_curve->mpolygon (xdge::entity:make cp))
- (xdrx_mpolygon->hatch (entlast))
- (xdrx_entity_setcolor (entlast) 1)
- )
- )
- (xdrx_object_release cp)
- (xdrx_entity_delete mp)
- (xdrx_end)
- (princ)
- )
2、查找重叠的实体
 - (defun c:tt () (xdrx_begin)
- (if (and (xdrx_initssget "\n选择查重叠的实体<退出>:")
- (setq ss (xdrx_ssget))
- (setq mt (xdrx_entity_getproperty ss "boundingbox")
- mt (apply 'append mt)
- )
- (setq mp (xdrx_curve->mpolygon mt))
- (setq cp (xdrx_getpropertyvalue mp "haschildloop" t))
- )
- (progn
- (xdrx_curve->mpolygon (xdge::entity:make cp))
- (xdrx_mpolygon->hatch (entlast))
- (xdrx_entity_setcolor (entlast) 1))
- )
- (xdrx_object_release cp)
- (xdrx_entity_delete mp)
- (xdrx_end)
- (princ)
- )
|