samifox Posted April 5, 2024 Posted April 5, 2024 hi selecting all objects in the selected object layer, would be : (defun c:SALL () (setq TargEnt (car (entsel "\nSelect object on layer to select: "))) (setq TargLayer (assoc 8 (entget TargEnt))) (sssetfirst nil (ssget "_X" (list TargLayer))) (princ) ) but is it possible to do the same with an xref own objects? Meaning , ill select a line , and than all objects in the selected object layer would come to the current drawing kind of ncopy thanks shay Quote
XDSoft Posted April 12, 2024 Posted April 12, 2024 (edited) Here is a post that supports XREF, block, WP CP, and SS Filter functions. [XDrX-Function(32)] Supports WP,CP,filter...XREF, and BLOCK selection Function (theswamp.org) https://www.theswamp.org/index.php?topic=58937.0 I'll repost it ================== (xdrx-block-getentities <blkref> [sel-method] [pt list] [filter]) Function: Support WP, CP... window selection, support XREF, BLOCK, support filtering and filtering to build selection set entity list parameter: <>Required parameters, [..] Optional parameters 1.blkref: BlockReference entity name 2.sel-method: string, "WP", "CP", "W", "C" 3.pt-list: point list, given 2 points, the program will generate a rectangular window and fill it to 4 points 4.filter: Filter the filter table, the same as ssget of lisp Note: If sel-method is given, it must be followed by the pt-list parameter, otherwise the selection method will not work. ============================= example: 1. (xdrx-block-getentities blk) Return block,xref all entity tables 2. (xdrx-block-getentities blk "wp" pts) Returns the entity table of xref and block within the window (excluding intersection) 3. (xdrx-block-getentities blk "cp" pts '((0 . "text")(1 . "abc*"))) Returns all text entity tables starting with abc in the text content of the window (including intersection) 4. (xdrx-block-getentities blk '((0 . "arc"))) Return all ARC entity tables in XREF and BLOCK ============================= The animation above demonstrates selecting only the yellow text within the window. The following is the implementation code: (defun c:tt () (if (and (setq blk (car (xdrx-entsel "\nSelect Block<Exit>:" '((0 . "insert"))) ) ) (setq mat (xdrx-matrix-wcs2block blk)) (setq p1 (getpoint "\nWindow First Point<Exit>:")) (setq p2 (xd::doc:getcorner p1 "\nSecond point of window <Exit>:" 1 '(1 0 0))) (setq box (cadr p2) box (xdrx-points-ucs2wcs box)) (setq ents (xdrx-block-getentities blk "wp" box '((0 . "text") (62 . 2)) ) ) (setq ms (xdrx-get-currentspace)) (setq ents (xdrx-object-deepclone ms ents mat)) ) (progn (xd::drag:simplemove ents "\nInsert Point:" 5 t) ) ) (princ) ) ================== The animation above demonstrates how to select only cross windows. The entity type is text or line. The text must be red. The content is 05:40, The following is the implementation code: (defun c:tt () (if (and (setq blk (car (xdrx-entsel "\nSelect Block<Exit>:" '((0 . "insert"))) ) ) (setq mat (xdrx-matrix-wcs2block blk)) (setq p1 (getpoint "\nWindow First Point<Exit>:")) (setq p2 (xd::doc:getcorner p1 "\nSecond point of window <Exit>:" 1 '(1 0 0))) (setq box (cadr p2) box (xdrx-points-ucs2wcs box)) (setq ents (xdrx-block-getentities blk "cp" box '((-4 . "<or") (-4 . "<and") (0 . "text") (62 . 1) (1 . "05:40") (-4 . "and>") (0 . "line") (-4 . "or>") ) ) ) (setq ms (xdrx-get-currentspace)) (setq ents (xdrx-object-deepclone ms ents mat)) ) (progn (xd::drag:simplemove ents "\nInsert Point:" 5 t) ) ) (princ) ) Edited April 12, 2024 by XDSoft Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.