Author Topic: Check if clip is present in the drawing  (Read 1842 times)

0 Members and 1 Guest are viewing this topic.

w64bit

  • Newt
  • Posts: 84
Check if clip is present in the drawing
« on: April 27, 2024, 08:37:38 AM »
How I can check if a drawing contains clip?
ssget can help? If yes, someone knows if there is a group code for clip?
« Last Edit: April 27, 2024, 11:53:41 AM by w64bit »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8908
  • AKA Daniel
Re: Check if clip is present in the drawing
« Reply #1 on: April 29, 2024, 03:33:22 AM »
in the whole drawing? it's a Spatial Filter right?

this is python, maybe it can give a hint

Code - Python: [Select]
  1. import traceback
  2. from pyrx_imp import Rx, Ge, Db, Ap, Ed
  3.  
  4. def PyRxCmd_doit() -> None:
  5.     try:
  6.         db = Db.curDb()
  7.         print(len(db.objectIds(Db.SpatialFilter.desc())))
  8.     except Exception as err:
  9.         traceback.print_exception(err)
  10.  


xdcad

  • Swamp Rat
  • Posts: 527
Re: Check if clip is present in the drawing
« Reply #3 on: May 02, 2024, 05:21:12 AM »
CLIP information is stored in the extended dictionary of the AcDbBlockReference (INSERT) object,

The Inspector tool can view



You can traverse all INSERTs to determine whether there is ACAD_FILTER


Code - Auto/Visual Lisp: [Select]
  1. (defun XD::Doc:HasFILTER (/ SS i bFound dict)
  2.   (if (setq ss (ssget "x" '((0 . "Insert"))))
  3.     (progn
  4.       (setq i -1
  5.             bFound t
  6.       )
  7.       (while (and bFound (setq e (ssname ss (setq i (1+ i)))))
  8.         (setq ed (entget e))
  9.         (if (and (setq dict (cdr (assoc 360 ed)))
  10.                  (= (cdr (assoc 3 (entget dict))) "ACAD_FILTER")
  11.             )
  12.           (setq bFound nil)
  13.         )
  14.       )
  15.       (not bFound)
  16.     )
  17.   )
  18. )
« Last Edit: May 02, 2024, 05:26:54 AM by xdcad »
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net

w64bit

  • Newt
  • Posts: 84
Re: Check if clip is present in the drawing
« Reply #4 on: May 08, 2024, 11:43:07 AM »
Thank you.
Is it possible, please, to add an alert when xclips are found?