See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Change Linetype Scale LISP

  1. #1
    Member
    Join Date
    2016-10
    Posts
    6
    Login to Give a bone
    0

    Default Change Linetype Scale LISP

    Hi,

    I am looking for a LISP routine to look for all Polylines on a layer and change the Linetype Scale from 0.0003 to 0.0006. I know that this is easy enough to do using QSELECT but I have to do this regularly so if it could be done in a LISP it would save me a lot of time.
    I have tried putting together my own code below which deletes the 0.0003 linetype scales but instead of deleting the lines I would like it to change them to 0.0006. My code might be going down the completely wrong route but I thought I would give it a go before asking!

    Code:
    (defun c:test (/ ss i sn l) (vl-load-com)
     (if (setq ss (ssget "X" '((410 . "Model")(48 . 0.0003)(0 . "LWPOLYLINE")(8 . "0"))))
     (repeat (setq i (sslength ss))
     (setq sn (ssname ss (setq i (1- i))))
     (entdel sn)
     )
     )
          (vl-load-com)
          (setq doc (vla-get-ActiveDocument
          (vlax-get-acad-object)))
          (princ)
          )

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Change Linetype Scale LISP

    Something like this should do it. No error checking of course.

    Code:
    (defun c:foo (/ ss i sn obj)
      (vl-load-com)
      (if (setq ss (ssget "X" '((410 . "Model")(48 . 0.0003)(0 . "LWPOLYLINE")(8 . "0"))))
        (repeat (setq i (sslength ss))
          (setq sn (ssname ss (setq i (1- i))))
          (setq obj (vlax-ename->vla-object sn))
          (vla-put-LinetypeScale obj 0.0006)
        )
      )
     (princ)
    )
    R.K. McSwain | CAD Panacea |

  3. #3
    Member
    Join Date
    2016-10
    Posts
    6
    Login to Give a bone
    0

    Default Re: Change Linetype Scale LISP

    Quote Originally Posted by rkmcswain View Post
    Something like this should do it. No error checking of course.

    Code:
    (defun c:foo (/ ss i sn obj)
      (vl-load-com)
      (if (setq ss (ssget "X" '((410 . "Model")(48 . 0.0003)(0 . "LWPOLYLINE")(8 . "0"))))
        (repeat (setq i (sslength ss))
          (setq sn (ssname ss (setq i (1- i))))
          (setq obj (vlax-ename->vla-object sn))
          (vla-put-LinetypeScale obj 0.0006)
        )
      )
     (princ)
    )
    Thats perfect, thank you!

  4. #4
    Member
    Join Date
    2018-07
    Posts
    2
    Login to Give a bone
    0

    Default Re: Change Linetype Scale LISP

    Hi,
    how the code will looks like, if i want to change linetype scale just for selected objects?

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    1

    Default Re: Change Linetype Scale LISP

    Quote Originally Posted by perbot770083 View Post
    Hi,
    how the code will looks like, if i want to change linetype scale just for selected objects?
    Replacing
    Code:
    (ssget "X" '((410 . "Model")(48 . 0.0003)(0 . "LWPOLYLINE")(8 . "0")))
    with
    Code:
    (ssget)
    should work.

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Change Linetype Scale LISP

    Remove the "X" option from the (ssget) function.

    The "X" tells the function to not allow the user to choose, and simply select all objects (subject to any filtering).

    There is a full list of options here.
    R.K. McSwain | CAD Panacea |

  7. #7
    Member
    Join Date
    2018-07
    Posts
    2
    Login to Give a bone
    0

    Default Re: Change Linetype Scale LISP

    Works great, thank you guys!

Similar Threads

  1. Replies: 9
    Last Post: 2015-08-21, 06:33 PM
  2. Replies: 2
    Last Post: 2012-05-10, 03:17 PM
  3. How to Change Linetype Scale to 1
    By BeKirra in forum AutoLISP
    Replies: 4
    Last Post: 2008-10-20, 02:51 AM
  4. Replies: 3
    Last Post: 2007-03-07, 11:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •