AutoCAD Land Desktop

AutoCAD Land Desktop

Reply
Member
Tallboy44
Posts: 4
Registered: ‎08-10-2012
Message 1 of 2 (1,110 Views)

Get Current Surface from Surface Object

1110 Views, 1 Replies
08-10-2012 10:57 AM

I am writing a LISP routine (I know I need to switch to VBA but I am in a hurry on this one) to obtain the surface elevation for each AEC Point of a set of points. My project has several surfaces that have created over the span of a couple of months and I want the routine to use the current surface selected in Terrain Model Explorer (TME) to pass the current surface object information to the following code excerpt:

 

(vlax-invoke-method cur_surf "getelevation" e n)

 

Examples of code I've seen elsewhere in the discussion group provide specific counters in the surface object as listed below, but this specific example does not "grab" the current surface (It appears the counter "0" below grabs the first surface created chronologically, a counter of "1" grabs the second surface created chronologically, and so on):

 

(setq cur_surf (vla-item surfs 0))

 

Thanks in advance for help on this.

*Expert Elite*
Jeff_M
Posts: 4,483
Registered: ‎07-22-2003
Message 2 of 2 (1,103 Views)

Re: Get Current Surface from Surface Object

08-11-2012 09:12 AM in reply to: Tallboy44

This should help:

(vl-load-com)  
(setq vrsn (vlax-product-key))
  (cond	((vl-string-search "R16.2" vrsn) (setq appstr "4"))
	;;2006
	((vl-string-search "R17.0" vrsn) (setq appstr "6"))
	;;2007
	((vl-string-search "R17.1" vrsn) (setq appstr "7"))
	;;2008
	((vl-string-search "R17.2" vrsn) (setq appstr "8"))
	;;2009
	(t (alert "This version of LDT not supported!"))
  )

  (and (setq acadObj (vlax-get-acad-object))
       (setq aeccApp (vla-getInterfaceObject
		       acadObj
		       (strcat "Aecc.Application." appstr)
		     )
       )
       (setq aeccDoc (vla-get-activedocument aeccApp))
       (setq aeccUtil (vlax-get aeccDoc "utility"))
       (setq aeccProj (vlax-get aeccApp 'activeProject))
       (setq aeccAligns (vlax-get aeccProj 'alignments))
       (setq CurAlignName (vlax-get aeccAligns 'currentalignment))
       (setq aeccAlign (vlax-invoke aeccAligns 'item curalignname))

       (setq aecSurfs (vlax-get aeccProj "Surfaces"))
       (setq aecSurf (vlax-get aecSurfs "Currentsurface"))
       (setq aecSurf (vla-item aecSurfs aecSurf))
  )

 

Jeff_M, also a frequent Swamper
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!