(while (not (= 3 (car (setq gr (grread t 13 0))))) (defun _getwindowselection ( msg p1 filter flag / gr p2 p3 p4 lst ) (vl-catch-all-apply 'vla-item (list collection item)) (redraw (ssname ss (setq i (1- i))) mode) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) *error* _redrawss _getitem _getwindowselectionĪcgrp e express g1 g2 gr grp i mss multiplemode pick pt removemode singlemode ss str those options provided by ssget, but aligned to the Provides the user with a selection interface akin to
#AUTOCAD LISP ENTSEL NIL FULL#
such that the selection window is aligned with the active UCS) - with full control over how user input is handled, you can then define your own keywords and react accordingly when the input matches such keywords: -=. I attempted the latter back in 2010, when I developed a 'UCS-aligned ssget function' (i.e. selection using the pickbox aperture, with no window selection).ĭevelop your own ssget function through the use of the grread function within a loop to continuously capture user input. 0)) Hey, wait a minute AutoLisp has returned the entity list, and I can see that its a Polyline, but there are no co-ordinates, and where does AutoLisp get the co-ordinates for all the vertices As I said earlier, we need to dig a little bit deeper to get the information we require. Use an entsel or nentsel selection within a while loop, permitting multiple single-pick selections (i.e. There are two alternative techniques that come to mind which could potentially allow the user to supply arbitrary predefined keywords whilst also permitting multiple selection: (angle '(0.0 0.0 0.Since the AutoLISP ssget function offers its own keywords to allow the user to initiate any of the standard selection methods (Window, Crossing, Fence, etc.), it is not one of the functions supported by the initget (keyword initialising) function: Expects a point or Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Group/Add/Remove/Multiple/Previous/Undo/AUto/SIngle
(vla-insertblock msp (vlax-3d-point ep) nm scl scl scl (if (not (vl-some '(lambda (a) (equal ep (vlax-curve-getclosestpointto a ep) fz)) sx)) (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv x (vlax-curve-getstartparam x))) (vla-insertblock msp (vlax-3d-point sp) nm scl scl scl (if (not (vl-some '(lambda (a) (equal sp (vlax-curve-getclosestpointto a sp) fz)) sx)) (setq sp (vlax-curve-getstartpoint x) ep (vlax-curve-getendpoint x) sx (vl-remove x ss)) "LINE,LWPOLYLINE,ARC,ELLIPSE,SPLINE"))))) (mapcar 'set '(nm rot scl fz) (foo:settings)) (if (= 0 (logand 8 (getvar "UNDOCTL"))) (vla-StartUndoMark adoc) (setq activeundo T)) (setq rtn (cons (ssname ss (setq i (1- i))) rtn)) (if (not (wcmatch (strcase msg T) "*break*,*cancel*,*exit*")) (defun c:foo ( / *error* activeundo acadobj adoc ep msp nm rot scl sp ss ss_lst sx) Pretty ugly, but I guess better than nothing:Ġ Additional rotation of block in radiansġe-6 Tolerance to consider an end point touching a curve Sample_to_automate.dwg Edited October 22 by lucky9 Some bends blocks are also attached please have a look.
#AUTOCAD LISP ENTSEL NIL CODE#
I have tried your code but I am getting a error message "Select Block error: bad argument type: 2D/3D point: nil" I need to work with the block I have in the sample drawing attached herewith. (vl-cmdf "-Insert" blkname pt1 "" "" ang) (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq blkname (cdr (assoc 2 (entget blk)))) (setq blk (car (entsel "\nSelect Block"))) (defun C:BLKPlace (/ ss blk blkname pt1 pt2 ang) The block 0 degree needs to be like the one in the rectangle. This is just a basic lisp to get you what you need. The rest of the lines were draw by picking the point not touching the white line first. The first point picked when drawing a line is always 10 the other endpoint will be 11.Īttached the red line is drawn from the center point of the white to the end of the blue line. If they are lines they would have to be drawn the same way.