Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

List Profile Elevation

3 REPLIES 3
Reply
Message 1 of 4
Rad_Cadder
179 Views, 3 Replies

List Profile Elevation

This routine is to print station & offset of selected alignment and print profile elevation of selected profile view.
I am new to vba and am not sure why the alignment portion works, but the profile portion does not.
Any help much appreciated!
Rob

Sub Sto()

Dim oSelected As AcadObject
Dim ptBase As Variant

'get the alignment
ThisDrawing.Utility.GetEntity oSelected, ptBase, vbNewLine & "Select an alignment or Profile View: "

If TypeOf oSelected Is AeccAlignment Then

Dim stn As Double
Dim offset As Double

' get the point of interest
ptBase = ThisDrawing.Utility.GetPoint(, "Specify Point: ")

oSelected.StationOffset ptBase(0), ptBase(1), stn, offset

' print out the values
'
ThisDrawing.Utility.Prompt ("Station: " & CStr(stn))
ThisDrawing.Utility.Prompt (", Offset: " & CStr(offset))

'End If
ElseIf TypeOf oEnt Is AeccProfileView Then
Dim oProf As AeccProfileView
Set oProf = oEnt
Dim sta As Double
Dim elev As Double
Dim pntBase As Variant

' get the point of interest
ptBase = ThisDrawing.Utility.GetPoint(, "Specify Point: ")

oProf.FindStationAndElevationAtXY pntBase(0), pntBase(1), sta, elev
Debug.Print "Station: " & sta & " ..... Elevation: " & elev

End If

End Sub
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Rad_Cadder

Rad_Cadder wrote:
> This routine is to print station & offset of selected alignment and print profile elevation of selected profile view.
> I am new to vba and am not sure why the alignment portion works, but the profile portion does not.
> Any help much appreciated!

Rob

Looks like you've got some cut-n-paste code in there...replace oEnt with
oSelected, and check the usage of ptBase versus pntBase in the following
lines:

> If TypeOf oSelected Is AeccAlignment Then
> ElseIf TypeOf oEnt Is AeccProfileView Then
> Dim pntBase As Variant
> ' get the point of interest
> ptBase = ThisDrawing.Utility.GetPoint(, "Specify Point: ")
> End If

--
Himanshu Gohel. Civil 3D Team, Autodesk, Inc.
Autodesk Civil 3D Product Information: http://www.autodesk.com/civil3d
Message 3 of 4
Rad_Cadder
in reply to: Rad_Cadder

I was able to make this work by separating code to its own sub.
I was under the impression that it would be necessary to dim ptBase and pntBase separate since they were referring to two different entities?
Is this not the case?
Message 4 of 4
Anonymous
in reply to: Rad_Cadder

Rad_Cadder wrote:
> I was able to make this work by separating code to its own sub.
> I was under the impression that it would be necessary to dim ptBase and pntBase separate since they were referring to two different entities?
> Is this not the case?

If you look at your code, you will see that there was some confusion -
user was picking ptBase, but you were asking for the profile view to
convert from an undefined coordinate in pntBase. Anyway, it's a moot
point as long as you got it to work. And I'm not a VBA expert by any
means...

--
Himanshu Gohel. Civil 3D Team, Autodesk, Inc.
Autodesk Civil 3D Product Information: http://www.autodesk.com/civil3d

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report