enthralled Posted January 5, 2019 Posted January 5, 2019 (edited) I'm working on a very large set of lots , which are closed polylines (+100,000). In order to work on each polyline individually, is there a way to select any (single, random, closed, and visible) polyline, and zoom into that polyline, while still being selected after the command is done? Edited January 5, 2019 by enthralled Quote
dlanorh Posted January 5, 2019 Posted January 5, 2019 5 hours ago, enthralled said: I'm working on a very large set of lots , which are closed polylines (+100,000). In order to work on each polyline individually, is there a way to select any (single, random, closed, and visible) polyline, and zoom into that polyline, while still being selected after the command is done? There is no way of specifying a random selection, since items are stored sequentially in the drawing database. You either need to selected multiple entities, generate a random integer and then access that item in the selection set or you become the random select mode using "ssget" in single select mode. If the latter and assuming you are talking about LWPolylines, try the following lisp (defun c:testzw ( / ss ll ur) ;define local variables (setq ss (ssget "_+.:E:S:L" '((0 . "LWPOLYLINE") (70 . 1) (60 . 0)))) (vla-getboundingbox (vlax-ename->vla-object (ssname ss 0)) 'll 'ur) (vla-zoomwindow (vlax-get-acad-object) ll ur) );end_defun Explanation of above code. If using the above the (60 . 0) isn't really useful as you can't select an invisible object, but it is useful when using ssget with "_X" since this gets all objects in the database ; This selects all closed (70 . 1) visible (60 . 0) LWPolylines in the drawing. The filter is a quoted list of dxf dotted pairs (setq ss (ssget "_X" '((0 . "LWPOLYLINE") (70 . 1) (60 . 0)))) ; This is single entity selection mode (simulates entsel) excluding objects on locked layers (:L) Filter as above (setq ss (ssget "_+.:E:S:L" '((0 . "LWPOLYLINE") (70 . 1) (60 . 0)))) ; Should you want to include a layer to further filter the list (setq ss (ssget "_+.:E:S:L" '((0 . "LWPOLYLINE") (8 . "LAYERNAME") (70 . 1) (60 . 0)))) ; In single selection mode this will get the single entity in the selection set (ssname ss 0) and converts it to a vla-object ; and then get the extents (boundingbox) of the object, returning the two points as variants into the specified ; variables (ll and ur). Note that the variable names are quoted, and should be defined in any lisp as unquoted ; local variable so they can be converted or used later (vla-getboundingbox (vlax-ename->vla-object (ssname ss 0)) 'll 'ur) ; This uses the variables from above (without extracting the values) and plugs them straight into the visual lisp ; zoomwindow method, since this requires two points as variants. It is therefore uneconomical to convert them to coord list and back again (vla-ZoomWindow (vlax-get-acad-object) ll ur) 1 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.