SET POLYLINE TO ELEVATION OF ZERO

SET POLYLINE TO ELEVATION OF ZERO

Anonymous
Not applicable
1,821 Views
7 Replies
Message 1 of 8

SET POLYLINE TO ELEVATION OF ZERO

Anonymous
Not applicable

Hi I was trying to make a lisp that lets you select or window polylines and set them all to a elevation of zero 

can someone help me out. thanks 

0 Likes
Accepted solutions (4)
1,822 Views
7 Replies
Replies (7)
Message 2 of 8

pbejse
Mentor
Mentor
Accepted solution

@Anonymous wrote:

Hi I was trying to make a lisp that lets you select or window polylines and set them all to a elevation of zero 

can someone help me out. thanks 


(defun c:PZero ( / 3p plines i ev coord)
(defun _3p (l)
  (if l
    (cons (list (Car l) (cadr l) 0.0) (_3p (cdddr l)))
  )
)	
  (if (setq plines (ssget '((0 . "*Polyline"))))
    (repeat (setq i (sslength plines))
      (setq ev (vlax-ename->vla-object (ssname plines  (setq i (1- i)))))
  	(if (eq "AcDb3dPolyline" (vla-get-ObjectName ev))
	  (vlax-put ev 'Coordinates (apply 'append (_3p (vlax-get ev 'Coordinates))))
		(vlax-put ev 'Elevation 0.0)
	   	)
      )
    )
  (princ)
  )

HTH

 

0 Likes
Message 3 of 8

Kent1Cooper
Consultant
Consultant
Accepted solution

You can do this with no command or routine, almost as easily as with one.  Just grab everything in the area that includes the desired Polylines, and in Properties, pull down the slot that says "All" [= all objects in the selection, by type] and pick Polyline to limit the selection to just those:

Kent1Cooper_0-1634844839998.png

then pick in the Elevation slot under Geometry, and give it 0:

Kent1Cooper_1-1634845207880.png

and they'll all change together.

 

Kent Cooper, AIA
0 Likes
Message 4 of 8

calderg1000
Mentor
Mentor
Accepted solution

Saludos  @Anonymous 

De otra forma, mover los objetos a un lugar muy lejano y luego devolverlos

 

 

(defun c: ch0 (/ s p1 p2 p2 i)
  (setq s (ssget))
  (setq p1 '(0 0 0)
        p2 '(0 0 10e50)
        p3 '(0 0 -10e50)
  )
  (repetir (setq i (sslength s))
    (vla-move (vlax-ename-> vla-object (ssname s (setq i (1- i))))
              (vlax-3d-point p1)
              (vlax-3d-point p2)
    )
  )
  (repetir (setq i (sslength s))
    (vla-move (vlax-ename-> vla-object (ssname s (setq i (1- i))))
              (vlax-3d-point p1)
              (vlax-3d-point p3)
    )
  )
(princ)
)

 

 

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 5 of 8

ВeekeeCZ
Consultant
Consultant
Accepted solution

@calderg1000 wrote:

Saludos  @Anonymous 

De otra forma, mover los objetos a un lugar muy lejano y luego devolverlos

 

 

(defun c: ch0 (/ s p1 p2 p2 i)
  (setq s (ssget))
  (setq p1 '(0 0 0)
        p2 '(0 0 10e50)
        p3 '(0 0 -10e50)
  )
  (repeat (setq i (sslength s))
    (vla-move (vlax-ename-> vla-object (ssname s (setq i (1- i))))
              (vlax-3d-point p1)
              (vlax-3d-point p2)
    )
  )
  (repeat (setq i (sslength s))
    (vla-move (vlax-ename-> vla-object (ssname s (setq i (1- i))))
              (vlax-3d-point p1)
              (vlax-3d-point p3)
    )
  )
(princ)
)

 


 

Spanish autocorrection?

Message 6 of 8

Anonymous
Not applicable

@pbejse thank you for you help this is perfect

0 Likes
Message 7 of 8

Anonymous
Not applicable

@Kent1Cooper 

thanks you. this is how I moved everything previously to elevation 0 as well, but was curious on how to do so in a lisp. I am in the process of learning how to write them myself. thanks  

0 Likes
Message 8 of 8

Anonymous
Not applicable

@calderg1000 

gracias por tu ayuda. estoy muy agradecido.

0 Likes