AutoCAD Land Desktop (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

To get station offset and FGProfile elevation by VLISP

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
343 Views, 9 Replies

To get station offset and FGProfile elevation by VLISP

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
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: Anonymous

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
Message 3 of 10
Anonymous
in reply to: Anonymous

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
Message 4 of 10
Rad_Cadder
in reply to: Anonymous

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
Message 5 of 10
Anonymous
in reply to: Anonymous

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
Message 6 of 10
Rad_Cadder
in reply to: Anonymous

Civil3d 06
Message 7 of 10
Anonymous
in reply to: Anonymous

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
Message 8 of 10
Rad_Cadder
in reply to: Anonymous

Thanks!
Message 9 of 10
Anonymous
in reply to: Anonymous

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
Message 10 of 10
Rad_Cadder
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report