aridzv Posted June 25, 2023 Posted June 25, 2023 (edited) Hi. I received a contour lines file and the Z-Values are in millimeters instead of meters - See attached file. I need to divide all the Vertices Z-Value by 1,000 to get it in meters. Is it possible to do such a thing? Thanks, Aridzv. conours.dwg Edited June 25, 2023 by aridzv Quote
mhupp Posted June 25, 2023 Posted June 25, 2023 These are 3d polylines so I converted them to 2d polylines to get he elevation property. and ran this macro that divides the elevation by 1000. ;;----------------------------------------------------------------------;; ;; Change point data for polylines (defun C:Change-Elevation (/ SS elv) (vl-load-com) (if (setq SS (ssget '((0 . "*POLYLINE")))) (foreach obj (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))) (setq elv (vla-get-elevation obj)) (vla-put-elevation obj (/ elv 1000)) ) ) (prompt "\n"(itoa (sslength ss))" polylines Change") (princ) ) 1 Quote
Tsuky Posted June 25, 2023 Posted June 25, 2023 My version ((lambda ( / ss n ent l_dxf s_dxf pt) (setq ss (ssget '((0 . "POLYLINE") (-4 . "&=") (70 . 8) (67 . 0)))) (cond (ss (repeat (setq n (sslength ss)) (setq ent (ssname ss (setq n (1- n))) l_dxf (entget ent) s_dxf (entget (entnext (cdar l_dxf))) ) (while (/= (cdr (assoc 0 s_dxf)) "SEQEND") (cond ((zerop (boole 1 207 (cdr (assoc 70 s_dxf)))) (setq pt (cdr (assoc 10 s_dxf)) pt (list (car pt) (cadr pt) (* 0.001 (caddr pt))) ) (entmod (subst (cons 10 pt) (assoc 10 s_dxf) s_dxf)) (setq s_dxf (entget (entnext (cdar s_dxf)))) ) ) ) (entupd ent) ) ) ) (prin1) )) Quote
aridzv Posted June 25, 2023 Author Posted June 25, 2023 @mhupp Thanks, works (as always...) like a charm!! I added the option to let the user choose the division factor - the code is attached. THANKS!!! ;;----------------------------------------------------------------------;; ;; Change point data for polylines (defun C:Change-Elevation (/ SS elv ht) (vl-load-com) (setq ht (getreal "\nEnter the division factor<1000>: ")) (if (= ht nil) (setq ht 1000) ) (if (setq SS (ssget '((0 . "*POLYLINE")))) (foreach obj (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))) (setq elv (vla-get-elevation obj)) (vla-put-elevation obj (/ elv ht)) ) ) (prompt "\n"(itoa (sslength ss))" polylines Change") (princ) ) Quote
aridzv Posted June 25, 2023 Author Posted June 25, 2023 @Tsuky thanks. I could not run your code. I think there is a problem with the function declaration in the first line: ((lambda ( / ss n ent l_dxf s_dxf pt) Quote
mhupp Posted June 25, 2023 Posted June 25, 2023 7 minutes ago, aridzv said: @mhupp Thanks, works (as always...) like a charm!! Quote
Tsuky Posted June 25, 2023 Posted June 25, 2023 Quote @Tsuky thanks. I could not run your code. I think there is a problem with the function declaration in the first line: @aridzv Simply copy and paste the code directly on the command line (possibly validate behind the last parenthesis if it is displayed) and the code will be executed. 1 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.