明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 685|回复: 3

选出相交的三维实体

[复制链接]
发表于 2022-12-14 21:19 | 显示全部楼层 |阅读模式
  1. (defun c:TT ( / *error* sol_ el sol n newrel sol1 interf sol_interf ss )
  2.     (vl-load-com)
  3.     (defun *error* ( msg )
  4.         (vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
  5.         (if msg (prompt msg))
  6.         (princ)
  7.     )

  8.     (vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))
  9.     (if (and
  10.             (princ "\nSelect 3D SOLIDS")
  11.             (progn
  12.                 (while (or (null sol_) (< (sslength sol_) 2))
  13.                     (setq sol_ (ssget "_:L" '((0 . "3DSOLID"))))
  14.                     (cond
  15.                         ( (null sol_) (prompt "\nEmpty sel. set... Try selecting again...") )
  16.                         ( (< (sslength sol_) 2) (prompt "\nSelected one 3D SOLID, please select more... Try selecting again...") )
  17.                     )
  18.                 )
  19.                 t
  20.             )
  21.         )
  22.         (progn
  23.             (setq el (entlast))
  24.             (repeat (setq n (sslength sol_))
  25.                 (setq sol (cons (ssname sol_ (setq n (1- n))) sol))
  26.             )
  27.             (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-checkinterference (list (vlax-ename->vla-object (car sol)) (vlax-ename->vla-object (cadr sol)) :vlax-true)))
  28.               (setq newrel t)
  29.               (if (not (eq el (entlast)))
  30.                   (entdel (entlast))
  31.               )
  32.             )
  33.             (setq sol1 sol)
  34.             (setq interf 0)
  35.             (if newrel
  36.                 (progn
  37.                     (mapcar
  38.                         '(lambda (a)
  39.                              (mapcar
  40.                                  '(lambda (b)
  41.                                       (if (vla-CheckInterference (vlax-ename->vla-object a) (vlax-ename->vla-object b) :vlax-true 'test)
  42.                                           (progn
  43.                                               (setq sol_interf (cons a sol_interf))
  44.                                               (setq sol_interf (cons b sol_interf))
  45.                                               (entdel (entlast))
  46.                                               (setq interf (1+ interf))
  47.                                           )
  48.                                       )
  49.                                  )
  50.                                  (setq sol1 (cdr sol1))
  51.                              )
  52.                         )
  53.                         (reverse (cdr (reverse sol)))
  54.                     )
  55.                 )
  56.                 (progn
  57.                     (mapcar
  58.                         '(lambda (a)
  59.                              (mapcar
  60.                                  '(lambda (b)
  61.                                       (if (vla-CheckInterference (vlax-ename->vla-object a) (vlax-ename->vla-object b) :vlax-true)
  62.                                           (progn
  63.                                               (setq sol_interf (cons a sol_interf))
  64.                                               (setq sol_interf (cons b sol_interf))
  65.                                               (entdel (entlast))
  66.                                               (setq interf (1+ interf))
  67.                                           )
  68.                                       )
  69.                                  )
  70.                                  (setq sol1 (cdr sol1))
  71.                              )
  72.                         )
  73.                         (reverse (cdr (reverse sol)))
  74.                     )
  75.                 )
  76.             )
  77.             (setq ss (ssadd))
  78.             (foreach ent sol_interf (ssadd ent ss))
  79.             (sssetfirst nil ss)
  80.             (princ
  81.                 (strcat
  82.                     "\nNumber of 3D SOLIDS : " (itoa (sslength ss))
  83.                     " - Number of interferences : "(itoa interf)
  84.                 )
  85.             )
  86.         )
  87.     )
  88.     (vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
  89.     (princ)
  90. )



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

评分

参与人数 1明经币 +1 收起 理由
USER2128 + 1 赞一个!

查看全部评分

 楼主| 发表于 2022-12-14 21:47 | 显示全部楼层
请问朋友们 怎样编辑修改三维实体的尺寸。
发表于 2022-12-15 10:30 | 显示全部楼层
你这具体是要实现啥效果呢   动图没看明白

点评

选择相交的三维实体  发表于 2022-12-15 11:06
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-3 12:21 , Processed in 4.669260 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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