TheSwamp

CAD Forums => Vertically Challenged => Land Lubber / Geographically Positioned => Topic started by: bman on December 02, 2004, 11:34:42 AM

Title: Setting Points question
Post by: bman on December 02, 2004, 11:34:42 AM
Is there a way to manually set points on a 3dpoly at random places & have the point recognize the elevation of the 3dpoly?
Title: Setting Points question
Post by: Mark on December 02, 2004, 11:48:11 AM
How soon do you need this?
Title: Setting Points question
Post by: Mark on December 02, 2004, 12:10:34 PM
Enjoy. :D

Code: [Select]

(defun c:random_pt_on_3dpoly (/ MST-CreateCogoPoint pt)

  ;;; FUNCTION
  ;;; creates a AECC point at the user defined location.
  ;;; and adopts the elevation of that selected point.
  ;;; use at your own risk.
  ;;;
  ;;; ARGUMENTS
  ;;; none
  ;;;
  ;;; PLATFORMS
  ;;; LDT 2, 2i, 3, 4 & 5
  ;;;
  ;;; AUTHOR
  ;;; Copyright© 2004 Mark S. Thomas
  ;;;
  ;;; mark@theswamp.org
  ;;;
  ;;; VERSION
  ;;; Thu Dec 02, 2004

  (defun MST-CreateCogoPoint (PointCoords / AeccProject Pnts NewPoint)

    (vl-load-com)

    (if
      (listp PointCoords)
      (progn
        (vl-catch-all-apply
          (function
            (lambda ()
              (setq AeccProject
                    (vlax-get-property
                      (vla-getinterfaceobject
                        (vlax-get-acad-object) "Aecc.Application")
                      'ActiveProject)
                    ); setq

              (setq Pnts
                    (vlax-get-property
                      AeccProject 'CogoPoints)
                    ); setq

              (setq
                Count (vlax-get-property Pnts 'Count)
                )

              (setq
                NewPoint
                (vlax-invoke-method Pnts 'Add
                                    (vlax-3D-point PointCoords) 1)
                ); setq

              (setq
                NewPointNum (vlax-get-property NewPoint 'Number)
                )
              ); lambda
            ); function
          ); vl-catch-all-apply
        ); progn
      ); if

    ); defun

  ;; ============= body of main starts here =====================

  (if (setq pt (getpoint "\nSelect point on pline: "))
    (MST-CreateCogoPoint pt)
    )

  )

  ;;; Timestamp: <randon_pt_on_3dpoly.lsp Thu 2004/12/02 12:06:07  PC18548>
  ;;; vim:tw=78:ts=4:
Title: Setting Points question
Post by: bman on December 02, 2004, 01:27:36 PM
That' just made my life a whole lot easier....
thanks alot! I wonder why didn't autodesk include that in LDD...
Title: Setting Points question
Post by: elsos on December 02, 2004, 01:59:36 PM
Mark,
This is great! What a time saver. And why didn't LDD have this  :?
-Eric
Title: Setting Points question
Post by: Mark on December 02, 2004, 02:47:38 PM
I think you can do it if you have a surface created.