Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/15/2022 in all areas

  1. Thought it was 'last', though '(last (last' I think goes a bit deeper into a nested block - I did read something and I think it was Lee Mac on a forum somewhere about it (How I hate quoting him all the time... so annoying to have a resource who is so genuinely helpful and generous with what he offers....) Not seen a way to highlight a nested block on selecting one of its objects
    2 points
  2. looking over this post. (setq blk (last (last (nentselp "\nSelect Block: "))) ;this will get the nested block entity name
    2 points
  3. something like (last (last (nentsel))) rings a bell but, well long weekend here and CAD is off for now, but that might have been for something different, think I used that to grab text from a nested block. Try Lee Mac, http://www.lee-mac.com/extractnestedblock.html for ideas, this might have something in it... however long weekend here and CAD is off till next week so can't check anything today
    2 points
  4. Do a presort like so to speed this up. This took ~5s to process 130,000 lines. (defun c:foo (/ a b c e f n r s) ;; RJP » 2022-04-14 ;; Groups a list of lists of lines that have similar angles and lengths (setq f 1e-1) (cond ((setq s (ssget '((0 . "LINE")))) (setq s (mapcar '(lambda (e) (setq a (vlax-curve-getstartpoint e)) (setq b (vlax-curve-getendpoint e)) (list (rem (angle a b) pi) (distance a b) e) ) (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) ) ) ;; Presort by sum of angle and length (setq s (vl-sort s (function (lambda (r j) (< (+ (cadr r) (car r)) (+ (cadr j) (car j))))))) ;; While we have a list (while (setq a (car s)) ;; Remove first item (setq s (cdr s)) ;; Reset temp list (setq c nil) ;; Add first item to temp list 'c' (setq c (cons a c)) ;; While we have a list 's' and the angle and length is 'equal', compile temp list 'c' (while (and s (equal (car a) (caar s) f) (equal (cadr a) (cadar s) f) (setq c (cons (car s) c)) (setq s (cdr s)) ) ) ;; Result (setq r (cons c r)) ) ;;; (setq n 0) ;;; ;; Quick check ;;; (foreach l r ;;; (setq n (1+ n)) ;;; (foreach e l (entmod (append (entget (last e)) (list (cons 62 n))))) ;;; ) ) ) (princ) )
    1 point
  5. Try this way too (defun c:testthis ( / ) (setq NewText (vla-get-effectivename (vlax-ename->vla-object (car (entsel "\nSelect block: ")))) ) (vlax-invoke (vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData) 'setData "TEXT" NewText ) )
    1 point
  6. Come on mark... I'm sure you don't need to do all that ... (length (layoutlist))
    1 point
×
×
  • Create New...