Changing a LISP

Changing a LISP

jeroendewind
Enthusiast Enthusiast
1,026 Views
3 Replies
Message 1 of 4

Changing a LISP

jeroendewind
Enthusiast
Enthusiast

Hi all,

 

Someone here gave me this awesome LISP that I used a lot, but with my latest projects it's becoming kinda useless.

The LISP makes it possible to split a dimension at a given point, but only when the coordination system is set to World.

 

Is it possible for someone to change it to the same LISP, usable for every UCS?

 

Thanks

 

(defun c:LegLengthMod ( / ss dimobjs)
  
  ;; codehimbelonga KerryBrown@theSwamp 2010.05.28
  ;; http://www.theswamp.org/index.php?topic=33493.msg389031#msg389031

  (vl-load-com)
  (if (and (setq ss (ssget '((0 . "DIMENSION"))))
           (setq dimobjs (mapcar 'vlax-ename->vla-object
                                 (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
                         )
           )
      )
    (foreach dim dimobjs
      (vla-put-extlinefixedlensuppress dim :vlax-true)
      (vla-put-extlinefixedlen dim (* 2 (vla-get-textheight dim)))
    )
  )
  (princ)
)


(defun c:SD (/ sel newpt ent edata elist)
    
  ;; codehimbelonga KerryBrown@theSwamp 2010.05.28
  

  (if (and (setq sel (entsel "\nSelect Dimension to Split."))
           (setq newpt (getpoint "\Select new Dim Point"))
      )
    (progn (setq ent   (car sel)
                 edata (entget ent)
                 elist (vl-remove-if
                         '(lambda (pair)
                            (member (car pair)
                                    (list -1 2 5 102 310 300 330 331 340 350 360 410)
                            )
                          )
                         edata
                       )
           )
           (entmod (subst (cons 14 newpt) (assoc 14 elist) edata))
           (entmakex (subst (cons 13 newpt) (assoc 13 elist) elist))
    )
  )
  (princ)
)
0 Likes
Accepted solutions (1)
1,027 Views
3 Replies
Replies (3)
Message 2 of 4

_gile
Consultant
Consultant
Accepted solution

Hi,

 

"Someone" is @kerry_w_brown as you can see in the comments.

 

Replace the c:SD defun with:

 

(defun c:SD (/ sel newpt ent edata elist)
    
  ;; codehimbelonga KerryBrown@theSwamp 2010.05.28
  

  (if (and (setq sel (entsel "\nSelect Dimension to Split."))
           (setq newpt (getpoint "\Select new Dim Point"))
      )
    (progn (setq newpt (trans newpt 1 0)
                 ent   (car sel)
                 edata (entget ent)
                 elist (vl-remove-if
                         '(lambda (pair)
                            (member (car pair)
                                    (list -1 2 5 102 310 300 330 331 340 350 360 410)
                            )
                          )
                         edata
                       )
           )
           (entmod (subst (cons 14 newpt) (assoc 14 elist) edata))
           (entmakex (subst (cons 13 newpt) (assoc 13 elist) elist))
    )
  )
  (princ)
)


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 4

jeroendewind
Enthusiast
Enthusiast

Thanks a lot!

0 Likes
Message 4 of 4

kerry_w_brown
Advisor
Advisor

 

Thanks @_gile

 

Funny how code written as 'proof of concept code' survives.

 

Regards,


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes