Jump to content

Calculating max z value


broncos15

Recommended Posts

I had a question on an analysis tool I am trying to make. When grading a site with walls, it is very useful to find the maximum height of the wall. Currently this is very difficult and involves making profiles and a lot of other things. The walls are made by having two feature lines (or 3D polylines) offset 0.1' from each other, so they are always perpendicular. I know how to calculate the perpendicular distance through a code like this:

(setq P1 (getpoint "\nDistance From "))
   (setvar "OSMODE" 128)
   (setq DR (getdist P1 "\nPer to "))
   (setq DS (rtos DR 2 6))

. My question, is how to expand this code so that instead of just doing one point, it calculates all the way along the feature line or 3D polyline so that it calculates the maximum elevation of the wall? I am kind of thinking that I could write it so that it steps along at small increments calculating the perpendicular z distance and then it will print the maximum one, but how can I do this without having the user select the points?

Link to comment
Share on other sites

I should also mention that I have looked into the vlax-curve-getclosestpointto function, but that doesn't seem like it would work because it doesn't actually find the perpendicular point, but merely the closest point.

Link to comment
Share on other sites

Can you post a sample. 3DPOLYs are simple to work with, BUT they really can't be perpendicular. It would like trying offset a 3DPOLY. -David

Link to comment
Share on other sites

Attached is a super simplified example with 2 feature lines. One is the bottom of the wall and one is the top of the wall. The bottom of the wall is typically just offset 0.1' from the top of wall to emulate a vertical wall. I want to calculate the max height of it by subtracting the top of wall height from the bottom of wall height. This is a super simplified example, but I in actual design I have walls that are over 100 feet long with a lot of grade breaks, so simplifying the process would make my life a lot easier. The attached has feature lines in it, I can upload a file with 3D polylines if that would be easier.

Sample.dwg

Link to comment
Share on other sites

The objects in your drawing appear as ACAD_PROXY_ENTITY types in Vanilla AutoCAD, and so I'm unfortunately unable to help unless these can be converted to a Vanilla object type in some way. I couldn't advise in this respect, as I have no experience or knowledge of objects native to the Vertical applications.

Link to comment
Share on other sites

Lee and David, thank you so much for looking at this. I uploaded the same drawing with 3D polylines, which I think work in vanilla AutoCAD. If you aren't able to look at them, no worries.

Sample.dwg

Link to comment
Share on other sites

We have the advantage of a 3rd party add on and the obvious option for us is to plot 2 longs sections with the height difference as a result in the long section plot. You may be able to do this also within CIV3D

Link to comment
Share on other sites

Lee and David, thank you so much for looking at this. I uploaded the same drawing with 3D polylines, which I think work in vanilla AutoCAD. If you aren't able to look at them, no worries.

 

Related topic?

 

top view perpendicular but not the nearest



;point to line 
(defun hp:ptol (p 2p 3d / ad d pp) ; hanhphuc - 29.10.2015
   (setq ad (mapcar '(lambda (f) (apply f (mapcar ''((x) (list (car x) (cadr x))) 2p)))
	     '(angle distance)
	     ) ;_ end of mapcar
  d  (vxv (mapcar '- p (car 2p)) (mapcar ''((f) (f (car ad))) (list cos sin)))
  pp (polar (car 2p) (car ad) d)
  ) ;_ end of setq
   (if	(<= 0. d (cadr ad))
     (list (distance p pp)
    (list (car pp)
	  (cadr pp)
	  (if 3d
	    (+ (* (/ (apply '- (mapcar 'last (reverse 2p))) (cadr ad)) d) (caddr (car 2p)))
	    (caddr p)
	    ) ;_ end of if
	  ) ;_ end of list
    ) ;_ end of list
     ) ;_ end of if
   ) ;_ end of defun

;function call
;(hp:ptol pt lst 3d) 
;pt= point
;lst= list of 2 end points
;example: (list p1 p2 )
;3d= t / nil

;Returns list 
;( d ( x y z )) 
;Where d=2d distance p to line from p1->p2
;(x y z) is coordinates apparently "perpendicular" from pt on line


;;;;example:
;;;(setq p1 (-131.868 17.4786 8.12106)
;;;      p2 (-142.847 5.87031 -2.51656)
;;;      p3 (-128.05 26.4743 2.99644)
;;;      ) ;_ end of setq

;(hp:ptol p1 (list p2 p3) t)
;return (2.14588 (-133.611 18.7304 0.9244))

;(hp:ptol p1 (list p2 p3) nil)
;returns (2.14588 (-133.611 18.7304 8.12106))


;; Vector Dot Product  -  Lee Mac
;; Args: u,v - vectors in R^n
(defun vxv ( u v )
   (apply '+ (mapcar '* u v))
)


Use the function iterate thru a 3dpolyline point set then assoc min distance-coordinate, done

Edited by hanhphuc
mode 3d
Link to comment
Share on other sites

Related topic?

 

top view perpendicular but not the nearest



;point to line 
(defun hp:ptol (p 2p 3d / ad d pp) ; hanhphuc - 29.10.2015
   (setq ad (mapcar '(lambda (f) (apply f (mapcar ''((x) (list (car x) (cadr x))) 2p)))
	     '(angle distance)
	     ) ;_ end of mapcar
  d  (vxv (mapcar '- p (car 2p)) (mapcar ''((f) (f (car ad))) (list cos sin)))
  pp (polar (car 2p) (car ad) d)
  ) ;_ end of setq
   (if	(<= 0. d (cadr ad))
     (list (distance p pp)
    (list (car pp)
	  (cadr pp)
	  (if 3d
	    (+ (* (/ (apply '- (mapcar 'last (reverse 2p))) (cadr ad)) d) (caddr (car 2p)))
	    (caddr p)
	    ) ;_ end of if
	  ) ;_ end of list
    ) ;_ end of list
     ) ;_ end of if
   ) ;_ end of defun

;function call
;(hp:ptol pt lst 3d) 
;pt= point
;lst= list of 2 end points
;3d= 3d mode t/nil
;example: (list p1 p2 t)

;Returns list 
;( d ( x y z )) 
;Where d=2d distance p to line from p1->p2
;(x y z) is coordinates apparently "perpendicular" from pt on line

;; Vector Dot Product  -  Lee Mac
;; Args: u,v - vectors in R^n
(defun vxv ( u v )
   (apply '+ (mapcar '* u v))
)


Use the function iterate thru a 3dpolyline point set then assoc min distance-coordinate, done

Hanhphuc thank you, that is what I was looking for! I will try and write the function in the next few days.
Link to comment
Share on other sites

Hanhphuc thank you, that is what I was looking for! I will try and write the function in the next few days.

 

you are welcome. however it was an idea not the solution, due to proxy-entity,

and also problem - empty area at vertex larger angle (secant)

 

This demo just using command:divide 's points set

ptol2.gif

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