Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/27/2021 in all areas

  1. Excellent! Thank you very much @pkenewell. That was just what I needed
    1 point
  2. Try this: (defun C:LJ2 (/ pick ename c0 c1 c2 c3 jump ;| local variables |;) (setvar "cmdecho" 0) ; disable command echo (command "._undo" "_begin") ; start undo group (if (and (setq pick (entsel "\nSelect line to break: ")) ; select entity (setq ename (car pick)) ; get ename (eq (cdr (assoc '0 (entget ename))) "LINE") ; make sure it's a line? (not (redraw ename 3)) ; highlight entity (setq c0 (getpoint "\nSpecify intersection: ")) ; get intersection (setq jump (getreal "\nSpecify Jump distance: ")) ) (progn (setq p0 (osnap (cadr pick) "_nearest")) ; make sure the pick is on object (setq c1 (polar c0 (angle p0 c0) jump)) (setq c2 (polar c0 (angle c0 p0) jump)) (command "._break" pick "_f" "_none" c1 "_none" c2) ; break (command "._arc" "_none" c1 "_C" "_none" c0 "_none" c2) ; draw arc (jump) ); progn ); if (command "._undo" "_end") ; clsoe undo group (setvar "cmdecho" 1) ; enable command echo (princ) ; quiet exit ); C:LJ2
    1 point
  3. @JovanG Look at using (assoc), it returns nil if the DXF code is not present. Example: (assoc 3 (entget (car (entsel)))) Paste this at the command line and select a longer mtext and a short mtext If you are iterating through the selection set it would be something like this snippet of code: (defun massoc (key alist / x nlist) (foreach x alist (if (eq key (car x)) (setq nlist (cons x nlist)) ) ) (reverse nlist) ) ;defun (setq cnt -1) (repeat (sslength ss) (setq en (entget (ssname ss (1+ cnt)))) (if (assoc 3 en) (progn (setq str (apply 'strcat (cons (mapcar 'cdr (massoc 3 en)) (cdr (assoc 1 en)) ) ) ) ; .. do something .. ) (progn (setq str (cdr (assoc 1 en))) ; .. do something .. ) ) ) EDIT - corrected! The (apply) statement should've has 'strcat, not 'append
    1 point
  4. @JovanG In long MTEXT strings like this, you also have to filter for the DXF code 3, not just DXF code 1. Note - This is what your entity codes look like for the MTEXT: ((-1 . <Entity name: 1cf6aa46180>) (0 . "MTEXT") (330 . <Entity name: 1cf57559700>) (5 . "3610") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Textos") (62 . 7) (6 . "Continuous") (370 . 13) (100 . "AcDbMText") (10 835795.0 1.19418e+06 0.0) (40 . 1.0) (41 . 114.291) (46 . 8.27327) (71 . 1) (72 . 5) (3 . "{\\Fdgn000|c0;NOTAS PARTICULARES.\\P\\P1.\tSe ha considerado una sobreexcavación de 15 mc bajo la cama en el tramo C921-C922. \\P2.\tLa cámara en diseño N2001 se construirá sobre la red existente convirtiendo ese tramo en arranque. La ubicación en planta se") (1 . "rá la indicada en el cuadro de localización de cámaras y la profundidad, la indicada en el cuadro 1.}") (7 . "Style-Arial") (210 0.0 0.0 1.0) (11 1.0 2.88641e-12 0.0) (42 . 109.571) (43 . 7.35743) (50 . 2.88641e-12) (73 . 2) (44 . 0.903614)) Notice the test string has a 3 in the dotted pair instead of a 1. Try this now: (sssetfirst nil (ssget "_X" (list '(0 . "TEXT,MTEXT") '(1 . "~*NOTAS PARTICULARES*") '(3 . "~*NOTAS PARTICULARES*") (cons 410 (getvar 'ctab)))))
    1 point
  5. This seemed like a fun challenge, so I thought I might participate... Here is my version: The attached program will prompt for a rectangular closed LWPolyline and a 'wire spacing' (the distance between the coils), and will generate a maximal filleted spiral centered within the selected LWPolyline. The program should perform successfully with all rectangular closed LWPolylines, at any rotation or orientation, and in all UCS & Views. For an arbitrary rectangle of any dimension, one cannot specify both the spacing between the coils and the offset from the rectangle boundary, since multiples of these values will not necessary equate to the rectangular dimensions. Hence, my program will prompt for the spacing between the coils and will center the spiral within the selected rectangular LWPolyline, maximising the number of spiral coils for the given spacing, with the division remainder equal to the offset from the boundary. If the spacing is a multiple of the dimensions of the boundary, the program will offset the spiral from the boundary by the given spacing to ensure that the coils do not touch the boundary edge. The code isn't pretty, but should hopefully perform correctly. Interesting challenge! HeatGridV1-0.lsp
    1 point
×
×
  • Create New...