ScoRm Posted July 22, 2021 Posted July 22, 2021 well, we have this massive 3d polylines (some are just plain polyline) and for some reason when i 3d view it, some are 0 elevation! i mean position Z is Zero! is there an easier way, or autolisp to help me make all those 0 position z ends into what ever the other end is? i cant show some example because im typing on my phone. and thats bugging me. there must be an easier way to fix it. its 3Dpolylines so there are 2 points there. i just need those Zero position Z to copy the other end positionZ Quote
ScoRm Posted July 22, 2021 Author Posted July 22, 2021 11 minutes ago, confutatis said: Do all polylines have only two vertices? no, some have more than other. youre right! so we cant use the last vertex Z? or the other end of the 3d poly? Quote
confutatis Posted July 22, 2021 Posted July 22, 2021 (defun C:CHZ (/ ss lista3d ent listacoo) (if (not (setq ss (ssget '((0 . "POLYLINE"))))) (vl-exit-with-error "") ) (defun lista3d (lst) (if lst (cons (list (car lst) (cadr lst) (caddr lst)) (lista3d (cdddr lst)) ) ) ) (repeat (setq index (sslength ss)) (setq ent (vlax-ename->vla-object (ssname ss (setq index (1- index)))) listacoo (lista3d (safearray-value (variant-value (vla-get-Coordinates ent))) ) listacoo (mapcar '(lambda (elem1) (if (= (caddr elem1) 0.0) (list (car elem1) (cadr elem1) (car (vl-sort (mapcar '(lambda (elem) (caddr elem)) listacoo) '>))) (list (car elem1) (cadr elem1) (caddr elem1)) ) ) listacoo ) listacoo (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbDouble (cons 0 (- (length (apply 'append listacoo)) 1)) ) (apply 'append listacoo) ) ) ) (vla-put-Coordinates ent listacoo) ) (princ) ) Not knowing the z value of the dimension to be inserted when I have z=0, I inserted the highest z value between the vertices of the polyline. Quote
Recommended Posts
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.