Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/23/2023 in all areas

  1. (defun c:pp() (setq ssp (ssget '((0 . "LWPOLYLINE")))) (repeat (setq i (sslength ssp)) (setq p1 (ssname ssp (setq i (1- i))) a (assoc 10 (entget p1))) (entmake (list (cons 0 "INSERT") a (cons 2 "sample_block"))) ) ) Define a block named "sample_block", launch this lisp and select the polylines (all at once)
    2 points
  2. Hard to tell without the code. Most likely, it starts by turning off OSNAP and doesn't save the original settings and resets it after the code runs.
    1 point
  3. (defun C:hbml (/ pnt qty obj lst) (setq sset (car (entsel))) (setq obj (vlax-ename->vla-object sset)) (setq 1st (vla-get-area obj)) (setq qty (strcat "Area = " (rtos 1st 2 3))) (if (and (setq pnt (getpoint "\nPick Leader Base point: ")) (setq pnt (trans pnt 1 0)) ) (command "_.mleader" "_none" pnt PAUSE qty) ) (princ) ) try this.
    1 point
  4. Tested the code by @Emmanuel Delay and it's working perfectly fine on my side
    1 point
  5. If you want only closed polylines modify @fuccaro lisp. (setq ssp (ssget '((0 . "LWPOLYLINE")(70 . 1))))
    1 point
  6. The radius is not 15, but close. All of the information is there. There is a small section of straight where the 20 dimension is. Just draw the arcs as tangents.
    1 point
  7. 1 point
  8. This should work ;; mttb for Move Text To Block (defun c:mttb ( / i j ss texts blocks ent ip1 ip2 dst ind) (setq ss (ssget (list (cons 0 "TEXT,INSERT")))) ;; lets make 2 selections. Texts and blocks (setq texts (ssadd)) (setq blocks (ssadd)) (setq i 0) (repeat (sslength ss) (setq ent (entget (ssname ss i))) (if (= "INSERT" (cdr (assoc 0 ent))) (ssadd (ssname ss i) blocks) (ssadd (ssname ss i) texts) ) (setq i (+ i 1)) ) ;; now we loop over the blocks, for each block we fine a text that's closest to that block. ;; (we could have chosen the the other way around) (setq i 0) (repeat (sslength blocks) (setq ip1 (cdr (assoc 10 (entget (ssname blocks i))))) (setq dst nil) ;; this holds the closest distance block-text (setq ind nil) ;; this holds the index j for the closest distance (setq j 0) (repeat (sslength texts) (setq ip2 (cdr (assoc 10 (entget (ssname texts j))))) (if (= nil dst) (progn ;; first try (setq dst (distance ip1 ip2)) (setq ind j) ) (progn ;; next we see if we find anything better (if (< (distance ip1 ip2) dst) (progn (setq dst (distance ip1 ip2)) (setq ind j) ) ) ) ) (setq j (+ j 1)) ) ;; change insert point of TEXT (setq ent (ssname texts ind)) (entmod (subst (cons 10 ip1) ;; insert point of the block (assoc 10 (entget ent)) (entget ent) )) (setq i (+ i 1)) ) ;; this grips the text objects. Notr really needed, but why not (sssetfirst nil texts) (princ) ) EDIT Oh yes, you can add this line of code. (ssdel ...) will remove the text from the list. In that case the variable texts should be empty at the end, then nothing gets gripped at the end ;; change insert point of TEXT (setq ent (ssname texts ind)) (entmod (subst (cons 10 ip1) ;; insert point of the block (assoc 10 (entget ent)) (entget ent) )) ;; we can remove the TEXT from the selection. No need to keep using it after we found a match (ssdel (ssname texts ind) texts)
    1 point
×
×
  • Create New...