AutoCAD Civil 3D Customization

Reply
Valued Mentor
dcouch
Posts: 370
Registered: ‎10-22-2003
Message 1 of 5 (222 Views)
Accepted Solution

Getting the station and elevation from a profile view

222 Views, 4 Replies
10-31-2012 08:06 AM

I am using LISP in C3D 2012.  I am trying to get the station and elevation of a point I pick in a profile view.  I found the Method that will get that info, but I can';t seem to get the syntax right.

 This is the Method;

HRESULT FindStationAndElevationAtXY(
    [in] double X,
    [in] double Y,
    [out] double * pStation,
    [out] double * pElevation,
    [out, optional] VARIANT * pInBounds
);

 

This is the routine I am trying but not having any luck working.

(defun C:getsta ()
  (setq ProfView (vlax-ename->vla-object (car (nentsel "\nSelect Profile View "))))
  (setq pt1 (getpoint "\nSelect Point "))
  (setq pt1X (car pt1))
  (setq Pt1Y (cadr pt1))
  (setq pstation 1.0)
  (setq pelevation 1.0)
  (vlax-invoke profview 'FindStationandElevationatXY (pt1x, pt1y, pstation, pelevation))
)

 

 Can someone help me get the syntax right??  Thank you,

 

Dave

 

*Expert Elite*
Jeff_M
Posts: 4,196
Registered: ‎07-22-2003
Message 2 of 5 (216 Views)

Re: Getting the station and elevation from a profile view

10-31-2012 08:46 PM in reply to: dcouch
(vlax-invoke profview 'FindStationandElevationatXY pt1x pt1y 'pstation 'pelevation)

On vacation and can't verify, but may need to add the optional out param as well:
(vlax-invoke profview 'FindStationandElevationatXY pt1x pt1y 'pstation 'pelevation 'inbounds)

 

 

Jeff_M, also a frequent Swamper
Valued Mentor
dcouch
Posts: 370
Registered: ‎10-22-2003
Message 3 of 5 (207 Views)

Re: Getting the station and elevation from a profile view

11-01-2012 08:03 AM in reply to: dcouch

Jeff, first of all, what are you doing checking the discussion groups when you are on vacation???

 

Next, thanks for the response.  I tried both variations, and other variable names.  The line seems to run with no errors, (I just get a nil as a response).  But pstation and pelevation are nil also.  Any other ideas?  Anyone else??

 

Dave

*Expert Elite*
Jeff_M
Posts: 4,196
Registered: ‎07-22-2003
Message 4 of 5 (204 Views)

Re: Getting the station and elevation from a profile view

11-01-2012 08:07 AM in reply to: dcouch

Just killing time before heading off to the next segment of this trip. :-) 

 

You might try (vlax-invoke-method ....) instead of the shorter version.

Jeff_M, also a frequent Swamper
Valued Mentor
dcouch
Posts: 370
Registered: ‎10-22-2003
Message 5 of 5 (201 Views)

Re: Getting the station and elevation from a profile view

11-01-2012 08:37 AM in reply to: dcouch

Jeff, obviously, the vacation isn't dulling your brain.  Adding the -method did the trick.  Thank you, now get back ot the vacation.

 

Dave

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Civil 3D Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for AutoCAD Civil 3D helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Civil 3D

Twitter

Facebook

Blogs