Jump to content

Recommended Posts

Posted

Hello, I have a city map with lots of building plans, most of them are 3D polylines and all of them has different Z values, according to their heights. I want to make a 3D model out of it by simply extruding them. But those 3D polylines have vertexes on different elevations. Is there a way to find a geometric center for each of those 3D polylines and flatten them into 2D polylines that has the Z value of that geometric center. So that I would have 2D polylines with different Z values. (I don't want to flatten everything to Z=0) Thanks in advance!

Posted

Hi  tolgydd . For better understanding, and  maybe get further help, please upload such sample.dwg

 

Posted (edited)

Perhaps simplest is get co-ords of 3dpoly, take average of z, then make a new normal pline but with ELEV set at the Z value THICKNESS can be height of building. 

 

If you want a top look into "pface"

; this works for 3dpoly and bricscad
; co-ords by by lee-mac
; 3dpoly to 2dpoly with thickness
; by Alanh Sep 2020


(defun c:test ( / e lst v x tot x z)
(while (setq e (car (entsel "\nSelect polyline: ")))
	(if  (= "POLYLINE" (cdr (assoc 0 (setq x (entget e)))))
    (progn
	(setq lst '())
            (setq v (entnext e)
                      x (entget  v)
            )
            (while (= "VERTEX" (cdr (assoc 0 x)))
                    (setq lst (cons (cdr (assoc 10 x)) lst)
                          v (entnext v)
                          x (entget  v)
                    )
            )
                            
	(setq tot 0.0 x (length lst))

	(repeat (length lst)
		(setq tot (+ (nth 2 (nth (setq x (- x 1)) lst)) tot))
	)

	(setvar 'thickness (getreal "\nEnter building height "))
	(entmakex (append (list (cons 0 "LWPOLYLINE")
                         (cons 100 "AcDbEntity")
                         (cons 100 "AcDbPolyline")
                         (cons 90 (length lst))
                         (cons 70 1))
              (mapcar (function (lambda (p) (cons 10 p))) lst)))

	(setq z (atof (rtos (length lst) 2 3)))
	(command "move" "last" "" "0,0,0" (list 0 0 (/ tot z)))

	(setvar 'thickness 0.0)
	)
	(princ "\nThe selected object is not a 2d or 3D polyline.")
    )

)
(princ)
)
(c:test)

 

Edited by BIGAL

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...