明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2465|回复: 7

如何建立圆形选择集

[复制链接]
发表于 2006-12-20 09:27:00 | 显示全部楼层 |阅读模式
已知图上有一个圆,如何求得与该圆相交的所有实体?
发表于 2006-12-20 19:05:00 | 显示全部楼层
用折线模拟圆,然后ssget "wp" "cp" "f"
发表于 2006-12-21 17:22:00 | 显示全部楼层
本帖最后由 作者 于 2006-12-21 17:25:27 编辑

楼上办法不好。打折的。

可以这样,先得到CIRCEL的boundingbox,ssget by cross(设置过滤条件,点表用刚才得到的BOX顶点坐标),,再遍历得到的选择集和圆求交,有交点的添加到新的选择集。

图形文件不大的话直接全部与其求交得了。

发表于 2006-12-26 09:17:00 | 显示全部楼层

看了几天了,还是手写一个实用的园形选择集吧

(defun circle_select (/ loop pt_tmp pt_list pt pt1 source pt2 ss)
  (initget 1)
  (setq pt1 (getpoint "\n first point:"))
  (setq loop t)
  (setq pt_tmp '(0 0 0))
  (while loop
    (setq pt (grread t 4 0))
    (setq source (car pt)
   pt2  (cadr pt)
    )
    (cond
      ((and (= source 5)
     (or (/= (car pt1) (car pt2))
  (/= (cadr pt1) (cadr pt2))
     )
       )    ;end and
       (if (/= pt_tmp pt2)
  (progn
    (drawcicle pt1 pt_tmp 0)
    (drawcicle pt1 pt2 256)
  )
       )
      )     ;end first
      ((or (= source 3)
    (and (= source 2)
  (or (= pt 13) (= pt 32))
    )    ;end and
       )    ; end or
       (setq loop nil)
       (drawcicle pt1 pt2 0)
      )     ; edn second
      ((and (= source 2) (or (= pt 89) (= pt 121)))
       (setq loop nil)
      )     ;end third
    )
    ;;end cond
    (setq pt_tmp pt2)
  )
  ;; edn while
  (setq pt_list (list (polar pt1 (* (/ pi 4) 0) (distance pt1 pt2))
        (polar pt1 (* (/ pi 4) 1) (distance pt1 pt2))
        (polar pt1 (* (/ pi 4) 2) (distance pt1 pt2))
        (polar pt1 (* (/ pi 4) 3) (distance pt1 pt2))
        (polar pt1 (* (/ pi 4) 4) (distance pt1 pt2))
        (polar pt1 (* (/ pi 4) 5) (distance pt1 pt2))
        (polar pt1 (* (/ pi 4) 6) (distance pt1 pt2))
        (polar pt1 (* (/ pi 4) 7) (distance pt1 pt2))
  )
  )
  (setq ss (ssget "_wp" pt_list))
  (sssetfirst nil ss )
  (princ)
)

(defun drawcicle (pt1 pt2 k / m)
  (grdraw pt1 pt2 k)
  (setq m 30)
  (while (> m 0)
    (progn (grdraw (polar pt1 (* (/ pi 15) (- m 1)) (distance pt1 pt2))
     (polar pt1 (* (/ pi 15) m) (distance pt1 pt2))
     k
    )
    (setq m (- m 1))
    )
  )
)

发表于 2006-12-26 11:16:00 | 显示全部楼层

說過很多次了,express tools中有 'FS & 'FSMODE 指令

Creates a selection set of objects that touch the selected object.

The behavior of FASTSELECT can be controlled with the command FSMODE. If FSMODE is set to ON (the default), FASTSELECT selects only those objects that are touching the selected object. When FSMODE is OFF, FASTSELECT selects all the objects that are touching the selected object as well as any objects that are touching those objects. The command continues down the chain of unselected objects that are touching the selected object until no more unselected objects are visible on screen.

Note:
FASTSELECT selects only lines, polylines, lightweight polylines, circles, arcs, attribute definitions, text, mtext, ellipses, and images.

Tip:
You can use FASTSELECT at the command line and (transparently) in many commands.

Command: 'FS
Select touching object: Select an object

Command: 'FSMODE
FASTSEL chain selection <OFF>: Enter ON or OFF

发表于 2006-12-27 11:47:00 | 显示全部楼层
请问楼上,如何把FS用到程序中?
发表于 2006-12-27 20:17:00 | 显示全部楼层

在安装cad的时候添加,cad安装程序有这个选项的

发表于 2006-12-28 13:17:00 | 显示全部楼层
(defun C:TT (/ SS)
  (C:FS)
  (command "_.ERASE" "P" "")
  (princ)
)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-11-23 11:34 , Processed in 0.182204 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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