Author Topic: Setting Points question  (Read 4479 times)

0 Members and 1 Guest are viewing this topic.

bman

  • Guest
Setting Points question
« 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?

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Setting Points question
« Reply #1 on: December 02, 2004, 11:48:11 AM »
How soon do you need this?
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Setting Points question
« Reply #2 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:
TheSwamp.org  (serving the CAD community since 2003)

bman

  • Guest
Setting Points question
« Reply #3 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...

elsos

  • Guest
Setting Points question
« Reply #4 on: December 02, 2004, 01:59:36 PM »
Mark,
This is great! What a time saver. And why didn't LDD have this  :?
-Eric

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Setting Points question
« Reply #5 on: December 02, 2004, 02:47:38 PM »
I think you can do it if you have a surface created.
TheSwamp.org  (serving the CAD community since 2003)