irahalulus Posted May 7, 2020 Share Posted May 7, 2020 Sorry, I'm newbie. I just want to erase some object (viewport) in Specific Area at Several Layout. Every layout actually have the same position of object. When this script work, I will make the (repeat n) version.... (defun c:xxxx () (setq p1 (getpoint "\np1: ")) (setq p2 (getpoint "\np2: ")) (setq seleksi (ssget "C" p1 p2)) (setvar 'ctab (car (layoutlist))) ; move to first layout (command "erase" seleksi "") (command "rectangle" p1 p2 "") (setvar 'ctab (cadr (member (getvar 'ctab)(layoutlist)))) ; next layout (command "erase" seleksi "") (command "rectangle" p1 p2 "") (setvar 'ctab (cadr (member (getvar 'ctab)(layoutlist)))) (command "erase" seleksi "") (command "rectangle" p1 p2 "") (setvar 'ctab (cadr (member (getvar 'ctab)(layoutlist)))) (command "erase" seleksi "") (command "rectangle" p1 p2 "") (setvar 'ctab (cadr (member (getvar 'ctab)(layoutlist)))) ) The problem is: for example, the active layout is the 3rd layout, and then I run this script. It will only erase the object in the 3rd layout. But, it success to make rectangle in every layout... I have no idea why this can happen. Thx in advance. Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 7, 2020 Share Posted May 7, 2020 If you are in the third layout then the selection set contains entities only in that layout. Similar entities in the same location in other layouts will not be selected. You must make a selection set in each layout. (setq p1 (getpoint "\np1: ")) (setq p2 (getpoint "\np2: ")) (foreach lout (layoutlist) (setq seleksi nil) (setq seleksi (ssget "C" p1 p2)) (command "erase" seleksi "") (command "rectangle" p1 p2 "") ) 1 Quote Link to comment Share on other sites More sharing options...
irahalulus Posted May 8, 2020 Author Share Posted May 8, 2020 14 hours ago, dlanorh said: If you are in the third layout then the selection set contains entities only in that layout. Similar entities in the same location in other layouts will not be selected. You must make a selection set in each layout. Thx in advance. I have gotten the idea. 1 Quote Link to comment Share on other sites More sharing options...
ronjonp Posted May 8, 2020 Share Posted May 8, 2020 Here's another way without iterating the tabs .. assumes that the viewport is in the EXACT same spot. (defun c:foo (/ e p s) ;; RJP » 2020-05-08 (if (and (setq e (car (entsel "\nPick viewport to delete: "))) (setq p (vl-remove-if-not '(lambda (x) (member (car x) '(0 10 40 41))) (entget e))) (setq s (ssget "_X" p)) ) (foreach vp (mapcar 'cadr (ssnamex s)) (vl-catch-all-apply 'vla-delete (list (vlax-ename->vla-object vp))) ) ) (princ) ) 1 Quote Link to comment Share on other sites More sharing options...
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.