Author Topic: Quick, easy LISP request  (Read 1585 times)

0 Members and 1 Guest are viewing this topic.

econnerly

  • Newt
  • Posts: 42
Quick, easy LISP request
« on: December 14, 2012, 12:41:49 PM »
I have to scale a whole bunch of lines and text from with a reference of 2 to 1.8.
Can someone write something to run the scale command and then turn what I just scaled to a different color?
I have been running the scale command followed by "chprop" "P" "C" 58

Much thanks in advanced.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Quick, easy LISP request
« Reply #1 on: December 14, 2012, 12:47:56 PM »
You have to run this right after the scale function or you will get unexpected results
Code: [Select]
(defun c:ccp ()
  (vl-cmdf "_chprop" "P" "" "C" "58" "")
)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

econnerly

  • Newt
  • Posts: 42
Re: Quick, easy LISP request
« Reply #2 on: December 14, 2012, 12:57:25 PM »
Thanks. I was hoping there was a way get get it to work in one command though. I have thousands to scale and I catch myself scaling the same one again since its difficult to see the size difference.

econnerly

  • Newt
  • Posts: 42
Re: Quick, easy LISP request
« Reply #3 on: December 14, 2012, 01:09:50 PM »
nm....
Wrote this deal and it seems to be doing the trick for now.
(defun c:vv ()
(command "chprop" "p" "" "c" "48" "" "")
(command "scale")
)

I start with the scale command once to start and it keeps it looping.

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Quick, easy LISP request
« Reply #4 on: December 14, 2012, 01:16:10 PM »
Quickly written:

Code: [Select]
(defun c:vv ( / s )
    (while (setq s (ssget "_:L" '((0 . "*LINE,*TEXT"))))
        (command
            "_.scale"  s "" "\\" "_R" 2.0 1.8
            "_.chprop" s "" "_C" 58 ""
        )
    )
    (princ)
)

econnerly

  • Newt
  • Posts: 42
Re: Quick, easy LISP request
« Reply #5 on: December 14, 2012, 01:22:53 PM »
Even better. Thanks Lee. Just had to add leader and circle to the routine and it works perfect.

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Quick, easy LISP request
« Reply #6 on: December 14, 2012, 01:38:49 PM »
welcome  :-)

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Quick, easy LISP request
« Reply #7 on: December 18, 2012, 07:02:54 AM »
Lee, I'd add a gc call into that loop just to be on the safe side with the selection set restrictions.

@econnerly: BTW, not too sure about the "basepoint" around which to scale. Do you mean as per Lee's code (select a group, pick a base point, lisp does it's job, then repeat for next group)? Or should all text be scaled around their insertion points & all lines around their midpoints (or some other)?

Sorry, probably stupid question - but I'm not enlightened from your posts.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.