Author Topic: stakeout points to a surface  (Read 3697 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
stakeout points to a surface
« on: August 09, 2004, 02:38:42 PM »
is there a way to take stakeout points to a surface. so you can see where your water is going? I hope that makes sense.

thank you
Civil3D 2020

sinc

  • Guest
stakeout points to a surface
« Reply #1 on: August 10, 2004, 03:32:24 PM »
Are you looking for something like this?

Code: [Select]
; pt2surf.lsp v1.00
; datum-adjust selected cogo points to the current surface
; Richard Sincovec  AUG-04-2004

(vl-load-com)
(if (= nil vll-kCurve)
  (vlax-import-type-library
    :tlb-filename "landauto.tlb"
    :methods-prefix "vll-"
    :properties-prefix "vll-"
    :constants-prefix "vll-"
   ) ;_ vlax-import-type-library
) ;_ if

(defun c:pt2surf (/     acadObj aeccApp   aeccProj
 cogoPoints surfaces curSurf   ss
 pt     pt_num curSurfName
 err
)
 ; should probably add more elaborate error detection...
  (setq err (vl-catch-all-apply
     (function
(lambda ()
 (setq acadObj    (vlax-get-acad-object)
aeccApp    (vla-getInterfaceObject
     acadObj
     "Aecc.Application"
   ) ;_ vla-getInterfaceObject
aeccProj    (vll-get-activeProject aeccApp)
cogoPoints  (vll-get-cogoPoints aeccProj)
surfaces    (vll-get-surfaces aeccProj)
curSurfName (vll-get-currentSurface surfaces)
curSurf    (vll-item surfaces curSurfName)
ss    (ssget '((0 . "AECC_POINT")))
 ) ;_ setq
 (if ss
   (progn
     (setq count (sslength ss)
   index -1
     ) ;_ setq
     (vll-put-autoSave cogoPoints T)
     ;; make sure autoSave is on
     (while (< (setq index (1+ index)) count)
(setq pt_num (cdr (assoc 90 (entget (ssname ss index))))
     pt     (vll-pointByNumber cogoPoints pt_num)
) ;_ setq
(vll-put-elevation
 pt
 (vll-getElevation
   curSurf
   (vll-get-easting pt)
   (vll-get-northing pt)
 ) ;_ vll-getElevation
) ;_ vll-put-elevation
(vlax-release-object pt)
     ) ;_ while
   ) ;_ progn
 ) ;_ if
) ;_ lambda
     ) ;_ function
   ) ;_ vl-catch-all-apply
  ) ;_ setq
  (if (vl-catch-all-error-p err)
 ; error is probably failure of the (vll-item surfaces curSurfName)
 ; caused by not setting the current surface; could add more elaborate
 ; error checking if desired...
    (princ (strcat "\nError: "
  (vl-catch-all-error-message err)
  "\nMake sure current surface is selected."
  ) ;_ strcat
    ) ;_ princ
  ) ;_ if
  (if curSurf (vlax-release-object curSurf))
  (if surfaces (vlax-release-object surfaces))
  (if cogoPoints (vlax-release-object cogoPoints))
  (if aeccProj (vlax-release-object aeccProj))
  (if aeccApp (vlax-release-object aeccApp))
  (princ)
) ;_ defun

I'm planning on adding more complete point selection (the All/Selection/Number/Group/Dialog sort of thing most LDD point commands use), but haven't had a chance yet.  I haven't yet figured out how to call Autocad's version of that routine (it doesn't seem to be documented), so I might have to code it manually...

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
stakeout points to a surface
« Reply #2 on: August 11, 2004, 02:20:50 PM »
HEY... thats works pretty good! nice job
Civil3D 2020