AutoCAD Land Desktop

AutoCAD Land Desktop

Reply
*Boba
Message 1 of 10 (129 Views)

To get station offset and FGProfile elevation by VLISP

129 Views, 9 Replies
03-03-2006 12:07 PM
Hi,

I am trying to write a lisp routine that will allow a user to click a
point and to get station offset and elevation from FGProfile.
I remember that station and offset was discussed once but not the
FGProfile elevation from the correspondent station.
If some one give a right direction, Thanks in advance.

Vlad
*Jeff Mishler
Message 2 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-03-2006 12:34 PM in reply to: *Boba
If you don't mind a VBA solution, I have posted one that does exactly
this....it even allows you to enter the street cross slope to calculate the
elevation at the point selected.

If you insist on lisp and writing your own, take the example I posted in the
thread back in January with the subject "Using Lisp to get strings of
station and/or Offset" and add to it. Here are some of the things you will
need to do so.....aw, heck, it's just easier to show you the basics......

[code]
(defun c:staoff (/ ACADOBJ AECCALIGN AECCALIGNS AECCAPP AECCDOC AECCPROJ
AECCUTIL CURALIGNNAME
ERR OFF PT1 PTLIST QLIST STA STASTR XY2EN)
(CD_MNL);initialize Civil Design
(and (setq pt1 (getpoint "\nSelect point for station/offset inquiry: "))
(setq acadObj (vlax-get-acad-object))
(setq aeccApp (vla-getInterfaceObject acadObj "Aecc.Application"))
;;;use "Aecc.Application.4" for versions 2004-2006
(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 aeccFGProfiles (vlax-get aeccAlign 'FGProfiles))
(setq FGCenter (vlax-invoke aeccFGProfiles 'profilebytype 1));1 is
FGCenter
(setq xy2en (vlax-invoke aeccUtil 'xytoeastnorth pt1))
(vlax-invoke-method aeccAlign 'stationoffset (car xy2en) (cadr xy2en)
'sta 'off 'dir)
)
(if sta
(progn
(setq staStr (vlax-invoke-method aeccAligns 'doubletostaformat sta))
;;note that the following line will raise an error if the vertical
doesn't exist at this point
(setq FGCtr (vlax-invoke-method FgCenter 'elevationat sta))
(alert (strcat "\nThe selected point is at Station: " staStr " with an
offset of: " (rtos off) " and CL elevation of: " (rtos FGCtr)))
)
)
(setq qList '(ACADOBJ AECCALIGN AECCALIGNS AECCAPP AECCDOC AECCPROJ
AECCUTIL))
(foreach x qlist
(setq err (vl-catch-all-apply 'vlax-release-object (list (eval x))))
(set x nil)
)
(princ)
)
[/code]

Good Luck,
Jeff

"Boba" wrote in message
news:5101583@discussion.autodesk.com...
Hi,

I am trying to write a lisp routine that will allow a user to click a
point and to get station offset and elevation from FGProfile.
I remember that station and offset was discussed once but not the
FGProfile elevation from the correspondent station.
If some one give a right direction, Thanks in advance.

Vlad
*Boba
Message 3 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-03-2006 12:55 PM in reply to: *Boba
On Fri, 3 Mar 2006 20:34:55 +0000, Jeff Mishler
wrote:

>If you don't mind a VBA solution, I have posted one that does exactly
>this....it even allows you to enter the street cross slope to calculate the
>elevation at the point selected.
>

Jeff,

Thank you very much.
It looks like exactly what I was looking for.

Regards.

Vlad
Distinguished Contributor
Rad_Cadder
Posts: 136
Registered: ‎08-19-2004
Message 4 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-06-2006 10:48 AM in reply to: *Boba
Jeff,
I get the following error when loading your staoff.lsp

Command: (vla-getInterfaceObject acadObj "Aecc.Application.4")
; error: Automation Error. Problem in loading application

Command: (vla-getInterfaceObject acadObj "Aecc.Application")
; error: Automation Error. Problem in loading application

I changed application and still get same error, any ideas?
Rob
*Jeff Mishler
Message 5 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-07-2006 09:38 AM in reply to: *Boba
What version of LDD are you using?

wrote in message news:5102839@discussion.autodesk.com...
Jeff,
I get the following error when loading your staoff.lsp

Command: (vla-getInterfaceObject acadObj "Aecc.Application.4")
; error: Automation Error. Problem in loading application

Command: (vla-getInterfaceObject acadObj "Aecc.Application")
; error: Automation Error. Problem in loading application

I changed application and still get same error, any ideas?
Rob
Distinguished Contributor
Rad_Cadder
Posts: 136
Registered: ‎08-19-2004
Message 6 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-07-2006 10:32 AM in reply to: *Boba
Civil3d 06
*Jeff Mishler
Message 7 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-07-2006 10:57 AM in reply to: *Boba
This only works with LDD, not C3D. The C3D API is completely different and I
have not explored what it would take to do the same thing in it.


wrote in message news:5103979@discussion.autodesk.com...
Civil3d 06
Distinguished Contributor
Rad_Cadder
Posts: 136
Registered: ‎08-19-2004
Message 8 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-07-2006 11:00 AM in reply to: *Boba
Thanks!
*James Wedding
Message 9 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-07-2006 01:55 PM in reply to: *Boba
Not to beat a dead horse, but if you're going to program in C3D, I highly
recommend looking at VBA.

--
James Wedding, P.E.
Engineered Efficiency, Inc.
Civil 3D 2006 SP2
XP Tablet, SP2, 2GHz, 1.5G
www.eng-eff.com
www.civil3d.com
Distinguished Contributor
Rad_Cadder
Posts: 136
Registered: ‎08-19-2004
Message 10 of 10 (129 Views)

Re: To get station offset and FGProfile elevation by VLISP

03-07-2006 02:00 PM in reply to: *Boba
Thanks James,
I was just in a hurry when I grabbed Jeff's routine and didn't bother to look at it when I posted.
I have a station/offset routine in vba for Civil, I just liked that idea of being able to specify cross slope like Jeff's post suggested, so I grabbed his routine.
My VBA capabilities are limited, just trying to get by until 2007
By the way, any new updates for 07 other than what's on your blog ?
Rob
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!