Jump to content

the closed polylines get new Z values from own center points.


macros55

Recommended Posts

Hi Everybody, I need a lisp,  the closed polylines get new Z values from own center points. Thanks.

Link to comment
Share on other sites

(defun c:changeZ (/ c_lwp c_pt lista_coord ename n Z_pt obj_n)
  (prompt "\nSelect the polylines")
  (setvar 'nomutt 1)
  (setq c_lwp (ssget '((0 . "LWPOLYLINE"))))
  (setvar 'nomutt 0)
  (setq n 0)
  (repeat (sslength c_lwp)
    (setq lista_coord nil c_pt nil)
    (setq ename (ssname c_lwp n))
    (setq obj_n (vlax-ename->vla-object ename))
    (foreach el1 (entget ename)
      (if (= (car el1) 10) (setq lista_coord (cons (cdr el1) lista_coord)))
    )
    (setq c_pt (ssget "_CP" lista_coord '((0 . "POINT"))));selecciona el punto
    (if c_pt
      (progn
    (setq Z_pt (caddr (cdr (assoc 10 (entget (ssname c_pt 0))))));obtiene la Z
        (vla-put-Elevation obj_n Z_pt);cambia la elevación
      )
    )
    (setq n (1+ n))
  )
)

Try this code

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...