Leaderboard
Popular Content
Showing content with the highest reputation on 08/20/2024 in all areas
-
I worked for a conveyor company back then, used this a lot. Alan JT's are nice, hoping mine will work in the latest AutoCAD LT. I was hoping some of the old timers that moved from LDD or Softdesk AutoCAD would pop in. Not many of us left! Losing Softdesk probably instigated a lot of LISP back then, AutoCAD 2000i actually has some of the functionality, though not all. It was almost like we forgot how to use AutoCAD for a while when we switched, I am surprised this particular was never added to AutoCAD. I wonder what happened to all of the ZZ functions? Cadalyst was the game for CAD and LISP back then, I should search there. Most probably created Array and/or Copy macros on a toolbar as well.2 points
-
This is just basic using the Y coordinates... Those other methods are too advanced for me. Works correct for mouse clicks on the object (tested lines and plines), reports opposite for window selection, It's over my head to make both work... ;;; Gives the vertical selection order of mouse clicks on objects. (bottom to top or top to bottom) (defun c:ChckSelOrder (/ ss i ent pt y-list y-ordered order) (setq ss (ssget)) (if (not ss) (princ "\nNo objects selected.") (progn (setq y-list '()) ;; Extract Y-coordinates of the selected objects (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) ;; Check if the entity has a valid insertion point (setq pt (cdr (assoc 10 (entget ent)))) (if pt ;; Extract Y-coordinate (setq y-list (cons (cadr pt) y-list)) ;; If insertion point is not available (princ (strcat "\nEntity " (itoa i) " does not have a valid insertion point." ) ) ) (setq i (1+ i)) ) ;; Check if y-list has more than one coordinate to compare (if (> (length y-list) 1) (progn ;; Output the raw Y-coordinates (princ "\nRaw Y-coordinates: ") (princ y-list) ;; Sort Y-coordinates in descending order for comparison (setq y-ordered (vl-sort y-list '>)) ;; Output the sorted Y-coordinates (princ "\nSorted Y-coordinates: ") (princ y-ordered) ;; Compare the original and sorted lists to determine order (if (equal y-list y-ordered) (setq order "Objects were selected from bottom to top.") (setq order "Objects were selected from top to bottom.") ) ;; Output result (princ (strcat "\n" order)) ) (princ "\nNot enough objects to determine order.") ) ) ) (princ) )1 point
-
A bit similar to @pkenewell ((lambda ( / flag tbl) (setq flag T) (while (setq tbl (tblnext "BLOCK" flag)) (cond ((wcmatch (cdr (assoc 2 tbl)) "ANCHOR,RNOTES,DTBLK*") (princ (strcat "\n\"" (cdr (assoc 2 tbl)) "\" found")) ) ) (setq flag nil) ) (prin1) ))1 point
-
The output is not the easiest to work with, but this is where selection info can be found. Below is an example of (ssnamex (ssget) nil) output: ( (3 <Entity name: 7ff4e09ab590> 6 -1) ; Selection Method was CPolygon (crossing box), coordinates of that box can be found in register -1 (below) (1 <Entity name: 7ff4e0914110> 1 (0 (-6175.99 -15087.3 318.468))) ; Second item's selection method was pick (just single click), point is found as last item (-1 ; This register is referenced above and is a lost of the points selected. (0 (-5587.01 -14847.0 318.468)) (0 (-5283.91 -14847.0 318.468)) ; A point... not that if it was selected from another ucs, the ucs will be added after every point (0 (-5283.91 -15046.5 318.468)) (0 (-5587.01 -15046.5 318.468))) )1 point
-
I tried something similar once, using ssnamex, you can get 4 points of selection rectangle by which you created selection set. Points are not in clicking order, they go from top left to bottom right I think, but then using (getvar 'lastpoint) you can determine which point was first by choosing diagonal value from the last one. Here is the code to get 4 selection rectangle points: (setq p1 (car (cdr (nth 1 (car (cdr (ssnamex ss 0))))))) (setq p2 (car (cdr (nth 2 (car (cdr (ssnamex ss 0))))))) (setq p3 (car (cdr (nth 3 (car (cdr (ssnamex ss 0))))))) (setq p4 (car (cdr (nth 4 (car (cdr (ssnamex ss 0))))))) EDIT: just tested and (getvar 'lastpoint) doesn't save last clicked point when selecting ss. I needed selection from left to right on the x axis. So not sure how to determine selection clicking order.1 point
-
The ssnamex function has information about how the objects are selected. Is that what you need?1 point
-
Get and compare the Y coordinates of the selected objects, then determine if they increase or decrease?1 point
-
1 point
-
Here is a little hint, you'll just need to create the text string from that (defun c:changeTags (/ BLK DOC I TAGLST SS) (vl-load-com) ;;-------------------------------------------------------------------------------;; (setq blk "BLOCK X" tagLst '(;"Old Tag" "New Tag" ("DESCRIPTION1" "DESCRIPTION") ("DESCRIPTION2" "DESCRIPTION") ("DESCRIPTION3" "DESCRIPTION") ("DESCRIPTION4" "DESCRIPTION") ("DESCRIPTION5" "DESCRIPTION") ("DESCRIPTION6" "DESCRIPTION") ) i -1 doc (vla-get-activedocument (vlax-get-acad-object)) ) ; end setq (if (ssget "_X" (list (cons 0 "INSERT")(cons 2 blk))) (progn (vlax-for bl (setq ss (vla-get-activeselectionset doc)) (foreach att (vlax-invoke bl 'getAttributes) (If (assoc (vla-get-tagstring att) tagLst) (princ (vla-get-textstring att)) (vla-put-tagstring att (cadr (assoc (vla-get-tagstring att) tagLst))) ) ; end if ) ; end foreach ) ; end vlax-for ) ; end progn (princ "\nNo Selection Set Found.") ) ; end if )1 point
-
I had this, I have cleaned up, IIRC it works pretty similar if not exactly like the old Softdesk Continuous Copy. ;;; Allows you to copy objects multiple times at a typed in distance and angle. | ;;; | ;;; |ContCop.lsp| similar to SoftEngine command Continuous Copy | ;;; | ;;; https://www.cadtutor.net/forum/topic/89869-continuous-copylsp/#comment-648783 | ;;; | ;;; By SLW210 (Steve Wilson) | ;;; | ;;;_________________________________________________________________________________________| ;;; | ;;; August 18th, 2024 | ;;; | ;;; | ;;; | ;;; | ;;;_________________________________________________________________________________________| ;;; | ;;; | (defun C:ContCop (/ ss ang dist dists temp pt1 pt2 oldOsnap) ;; Error handler for internal errors (defun ccerr (st) (if (or (/= st "Function cancelled") (= st "quit / exit abort")) (princ (strcat "\nError: " st)) ) (princ) ) ;; Set the error handler (setq *error* 'ccerr) ;; Store current Osnap setting (setq oldOsnap (getvar "OSMODE")) ;; Prompt user to select objects (prompt "\nSelect objects to copy: ") (command "select" "auto" pause) (setq ss (ssget "p")) ;; Prompt user to select the start and end points (initget 1) (setq pt1 (getpoint "\nSelect Start Point: ")) (initget 1) (setq pt2 (getpoint pt1 "\nSelect End Point: ")) ;; Calculate distance and angle (setq dist (distance pt1 pt2) ang (angtos (angle pt1 pt2) 0 6) dists 0.0 ) ;; Main loop for continuous copying (while (/= (setq temp (getdist (strcat "\nNext distance/Exit < " (rtos dist) " >: ") ) ) "Exit" ) (setq dists (+ dists (if (not temp) dist temp ) ) ) (setq temp (strcat "@" (rtos dists 2 6) "<" ang)) (command "COPY" ss "" "0,0" temp) ) ;; Restore original Osnap setting (setvar "OSMODE" oldOsnap) (princ) ) I am positive the others are better, but I need the practice, hopefully commented correctly for you and me both.1 point