Results 1 to 7 of 7

Thread: NEED HELP WITH LISP ROUTINE - PURGE linetype lisp

  1. #1
    Member
    Join Date
    2013-01
    Posts
    11
    Login to Give a bone
    0

    Default NEED HELP WITH LISP ROUTINE - PURGE linetype lisp

    Hi guys,

    I have this lisp routine that somehow used to work though it deletes all my layouts now.

    Code:
    (defun c:removeline ()
      (vlax-for n (vla-get-blocks
                    (vla-get-activedocument
                      (vlax-get-acad-object)
                    )
                  )
        (vl-catch-all-apply 'vla-delete (list n))
      )
      (princ)
    )
    This routine used to remove all nested linetypes that were not used. It worked a couple of time though for some reason it deletes all the layout tabs. I think that either a variable has been changed or something else. It has the same effect on all the other pc's in the office (deletes layout tabs)

    Thanks heaps.

    Rico
    Last edited by BlackBox; 2013-06-20 at 02:26 PM. Reason: Please use [CODE] Tags

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: NEED HELP WITH LISP ROUTINE - PURGE linetype lisp

    Rico,

    I've moved your thread to the AutoLISP forum, since that's what you're asking about here, and have also removed the additional paren (to mitigate the unbalanced bracket message), and added [CODE ] Tags for you.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,083
    Login to Give a bone
    0

    Default Re: NEED HELP WITH LISP ROUTINE - PURGE linetype lisp

    The code you posted deletes blocks not linetypes. Being that layouts are also blocks, they may be removed as well.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: NEED HELP WITH LISP ROUTINE - PURGE linetype lisp

    Quote Originally Posted by ECASAOL350033 View Post
    I have this lisp routine that somehow used to work though it deletes all my layouts now.

    Code:
    (defun c:removeline ()
      (vlax-for n (vla-get-blocks
                    (vla-get-activedocument
                      (vlax-get-acad-object)
                    )
                  )
        (vl-catch-all-apply 'vla-delete (list n))
      )
      (princ)
    )
    This routine used to remove all nested linetypes that were not used. It worked a couple of time though for some reason it deletes all the layout tabs. I think that either a variable has been changed or something else. It has the same effect on all the other pc's in the office (deletes layout tabs)
    No... This code must have been changed, as it will never remove Linetypes, nor Layouts by deleting Block Definitions (it will delete the geometry from a given Layout's Block though).

    To delete unused Linetypes, instead consider:
    Code:
    (vl-load-com)
    
    (defun c:PurgeLin ()
      (princ "\nProcessing, please wait... ")
      (princ)
      (vlax-for lin (vla-get-linetypes
                      (vla-get-activedocument
                        (vlax-get-acad-object)
                      )
                    )
        (vl-catch-all-apply 'vla-delete (list lin))
      )
      (princ)
    )
    Last edited by BlackBox; 2013-06-20 at 02:41 PM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: NEED HELP WITH LISP ROUTINE - PURGE linetype lisp

    Quote Originally Posted by Opie View Post
    ... layouts are also blocks...
    More specifically:

    Quote Originally Posted by ActiveX Online Documentation, Layout Object

    The representation of a layout is slightly different in ActiveX from that of the AutoCAD user interface. In ActiveX, the content of a standard AutoCAD layout is broken out into two separate objects: Layout object and Block object. The Layout object contains the plot settings and the visual properties of the layout as it appears in the AutoCAD user interface. The Block object contains the geometry for the layout.

    Each Layout object is associated with one Block object. To access the Block object associated with a given layout, use the Block property. Conversely, each Block object is associated with one Layout object. To access the Layout object associated with a given Block, use the Layout property for that block.

    In ActiveX, in addition to the paper space layouts, model space is considered a layout.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  6. #6
    Member
    Join Date
    2013-01
    Posts
    11
    Login to Give a bone
    0

    Default Re: NEED HELP WITH LISP ROUTINE - PURGE linetype lisp

    MR BLACKBOX,

    YOU ARE THE BEST!!!

  7. #7
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: NEED HELP WITH LISP ROUTINE - PURGE linetype lisp

    Quote Originally Posted by ECASAOL350033 View Post
    MR BLACKBOX,

    YOU ARE THE BEST!!!
    That is kind of you to say; I'm happy to help.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. Calling up LISP routine from within another LISP
    By jimmy_goodall in forum AutoLISP
    Replies: 4
    Last Post: 2013-08-21, 05:56 AM
  2. Replies: 9
    Last Post: 2012-01-21, 07:58 AM
  3. LISP code for Purge, Audit and Save... help
    By recjld in forum AutoLISP
    Replies: 5
    Last Post: 2009-08-18, 09:28 PM
  4. LISP to purge AEC Styles
    By burchd in forum AutoLISP
    Replies: 0
    Last Post: 2008-04-23, 04:17 PM

Tags for this Thread

Posting Permissions

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