Author Topic: list of elevations or Z values  (Read 4092 times)

0 Members and 1 Guest are viewing this topic.

drumbald

  • Guest
list of elevations or Z values
« on: December 20, 2005, 10:52:13 AM »
:-)I want to draw a line across contours and have it give a list of elevations or Z values of each contour line it comes in contact with

If anyone has any suggestions please let me know

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: list of elevations or Z values
« Reply #1 on: December 20, 2005, 12:19:05 PM »
Are these contours shown by polylines or Aec_contour objects from LDD or Civil3d?

drumbald

  • Guest
Re: list of elevations or Z values
« Reply #2 on: December 20, 2005, 12:36:41 PM »
I want it to read both

We get drawings from a lot of different sources

T.Willey

  • Needs a day job
  • Posts: 5251
Re: list of elevations or Z values
« Reply #3 on: December 20, 2005, 01:00:29 PM »
Just thinking out loud, but could you use ssget with the fence feature?  Then cycle through the objects in the select set, and get the values for the items you want, and discard the others?

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: list of elevations or Z values
« Reply #4 on: December 20, 2005, 01:05:31 PM »
That's what I used, Tim......:-)
Code: [Select]
(defun c:listZs (/ elevs ent fnc idx lin linobj lin_lst obj ss)
  (if (and (setq lin (ssget ":S" '((0 . "LINE"))))
   (setq lin (ssname lin 0))
   (setq lin_lst (entget lin))
   (setq fnc (list (cdr (assoc 10 lin_lst))(cdr (assoc 11 lin_lst))))
   (setq ss (ssget "F"
   fnc    
   '((0 . "*POLYLINE,*CONTOUR"))
   ))
   )
    (progn
      (setq idx -1
    linobj (vlax-ename->vla-object lin)
    )
      (while (setq ent (ssname ss (setq idx (1+ idx))))
(setq obj (vlax-ename->vla-object ent))
(if (or (vl-string-search "LW" (cdr (assoc 0 (entget ent))))
(vl-string-search "CONTOUR" (cdr (assoc 0 (entget ent))))
)
  (setq elevs (cons (vla-get-elevation obj) elevs))
  (progn
    ;;since this is for contours, an equal Z is assumed for the plines....
    ;;we'll check the first & last Z to verify
    (setq coords (vlax-get obj 'coordinates))
    (if (= (caddr coords) (last coords))
      (setq elevs (cons (caddr coords) elevs))
      )
    )
  )
)
      )
    )
  (princ "\nLine crosses these contours: ")
  (foreach x elevs
    (princ (strcat "\n" (rtos x 2 1)))
    )
  (princ)
  )

T.Willey

  • Needs a day job
  • Posts: 5251
Re: list of elevations or Z values
« Reply #5 on: December 20, 2005, 01:40:33 PM »
That's what I used, Tim......:-)

 :lmao: I must be getting better at this code thing now!
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Joe Burke

  • Guest
Re: list of elevations or Z values
« Reply #6 on: December 21, 2005, 08:39:26 AM »
Hi Tim and Jeff,

Just a reminder. The fence method will miss dashed objects when the fence passes over a dash gap. Something to consider in any case, but especially here since contours are often dashed.

Either temporarily change dashed layers to continuous, or change ltscale to a small number, before ssget "F".

drumbald

  • Guest
Re: list of elevations or Z values
« Reply #7 on: December 21, 2005, 10:38:34 AM »
This is doing what I wanted

Thank you

My next step is to have it draw lines at the intersection of the contour line and the line the distance of the elevation and rotate them perpendicular to the original line.

When its done it will give me a simple ground section