See the top rated post in this thread. Click here

Results 1 to 4 of 4

Thread: Delete all elevation points on all/multiple selected featurlines

  1. #1
    Member
    Join Date
    2013-07
    Posts
    10
    Login to Give a bone
    0

    Default Delete all elevation points on all/multiple selected featurlines

    1. What I would like to do is be able to select a bunch of featurelines that all have a lot of elevation points and then delete all elev points at once instead of going thru each line individually. Does anyone know of a lisp out there that will delete all elevation points (not PI points) of multiple/all featurelines or 3D polyines? Or a better workflow?

    2. And on the flip side...does anyone know of a lisp that would add elevation points to a bunch of featurelines at a given interval all at once (instead of one individual line at a time)?

    Any input is welcome.

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

    Default Re: Delete all elevation points on all/multiple selected featurlines

    Quote Originally Posted by kylehalchin View Post
    1. What I would like to do is be able to select a bunch of featurelines that all have a lot of elevation points and then delete all elev points at once instead of going thru each line individually. Does anyone know of a lisp out there that will delete all elevation points (not PI points) of multiple/all featurelines or 3D polyines? Or a better workflow?
    Code:
    (vl-load-com)
    
    (defun c:RemoveElevPoints (/ *error* _MakePoints acDoc ss elevPoints)
    
      (defun *error* (msg)
        (if ss (vla-delete ss))
        (if acDoc (vla-endundomark acDoc))
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
        )
        (princ)
      )
    
      (defun _MakePoints (data / pt i pts)
        (while data
          (setq i 3)
          (while (and data (< 0 i))
            (setq pt (cons (car data) pt))
            (setq data (cdr data))
            (setq i (1- i))
          )
          (setq pts (cons (reverse pt) pts))
          (setq pt  nil)
        )
        (reverse pts)
      )
      
      (if (ssget "_:L" '((0 . "AECC_FEATURE_LINE")))
        (progn
          (vla-startundomark
            (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
          )
          (vlax-for x (setq ss (vla-get-activeselectionset acDoc))
            (while
              (and
                (setq elevPoints (vlax-invoke x 'getpoints 2))
                (setq elevPoints (_MakePoints elevPoints))
              )
               (foreach ep elevPoints
                 (vlax-invoke x 'deletefeaturepoint ep)
               )
            )
          )
        )
      )
    
      (*error* nil)
    )
    Quote Originally Posted by kylehalchin View Post
    2. And on the flip side...does anyone know of a lisp that would add elevation points to a bunch of featurelines at a given interval all at once (instead of one individual line at a time)?
    Code:
    (vl-load-com)
    
    (defun c:InsertElevPointsAt (/ *error* _MakePoints i acDoc ss e d pts n ep name)
    
      (defun *error* (msg)
        (if ss (vla-delete ss))
        (if acDoc (vla-endundomark acDoc))
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
        )
        (princ)
      )
    
      (defun _MakePoints (data / pt i pts)
        (while data
          (setq i 3)
          (while (and data (< 0 i))
            (setq pt (cons (car data) pt))
            (setq data (cdr data))
            (setq i (1- i))
          )
          (setq pts (cons (reverse pt) pts))
          (setq pt  nil)
        )
        (reverse pts)
      )
      
      (if
        (and
          (ssget "_:L" '((0 . "AECC_FEATURE_LINE")))
          (not (initget 6))
          (setq i (getreal "\nEnter the increment to add EPs: "))
        )
         (progn
           (vla-startundomark
             (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
           )
           (vlax-for x (setq ss (vla-get-activeselectionset acDoc))
             (setq e (vlax-vla-object->ename x))
             (setq d 0)
             (setq pts (vlax-invoke x 'getpoints 3))
             (setq pts (_MakePoints pts))
             (setq n 0)
             (while
               (and
                 (setq ep (vlax-curve-getpointatdist e (setq d (+ d i))))
                 (not (vl-position ep pts))
               )
                (progn
                  (vlax-invoke x 'insertfeaturepoint ep 2)
                  (setq n (1+ n))
                )
             )
             (prompt
               (strcat
                 "\nFeature Line \""
                 (if (= "" (setq name (vla-get-name x)))
                   (vla-get-handle x)
                   name
                 )
                 "\" : Inserted "
                 (itoa n)
                 " elevation points. "
                 )
               )
           )
         )
      )
    
      (*error* nil)
    )
    Last edited by BlackBox; 2019-06-06 at 10:32 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

  3. #3
    Member
    Join Date
    2013-07
    Posts
    10
    Login to Give a bone
    0

    Default Re: Delete all elevation points on all/multiple selected featurlines

    Thanks! I'll give them a try!

  4. #4
    Member
    Join Date
    2013-07
    Posts
    10
    Login to Give a bone
    0

    Default Re: Delete all elevation points on all/multiple selected featurlines

    Works like a charm! Thank-you very much!

Similar Threads

  1. Delete and Delete All Page Setups
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2015-12-17, 06:38 AM
  2. Lisp file to delete All Xdata from selected entities regardless app name
    By diaa.caliph423218 in forum Bridging the Gap: LISP -> .NET -> LISP
    Replies: 1
    Last Post: 2015-09-29, 08:33 PM
  3. Replies: 3
    Last Post: 2014-08-05, 08:51 PM
  4. Replies: 3
    Last Post: 2013-06-08, 02:03 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
  •