Yep, I have a working solution. But I seem to have run into a small problem
that hopefully is just something I am overlooking.
The ProfileView object Properties ElevationMin & StationStart cannot be set
via code. I have tried with both of the lock settings either true or false
(I would think False would allow this to work). I have come up with a work
around, but it's not ideal.
It needs work to address other scenarios, but this should be a decent start
for you. This initial version works with a main alignment profileview drawn
left to right and a curb return whose stationing is going in the same
direction as the main align, and that return is on the upstation end of the
alignment. There will likely be quite a bit involved here, including using
different PVSTyles for left & right direction returns, swapping start/end
calcs depending which connects to the main alignment's curb, etc. But since
I will probably never use this for my own purposes, I leave that up to you.
This is more of a "yes, it can be done, here's an example" sort of help. And
yes, I have tried it on a number of returns. 🙂
The prerequisites are:
You MUST use a profile view that is based on the style that the main
alignment's PV uses(For the Vert.scale). Turn off the visibilty of all items
in the CR's PV Style.
Create an alignment for your curb return, add a PV for it and create the
Curb profile. This can be done with code, but I'm just using existing for my
testing.
Here's the code, David, including my Test sub so you can see how I call the
function. It's a bit messy, and there is NO error checking. It's up to you
to pass valid Style names and new profile name. Good luck and have fun!
[code]
''Sample code to add a Curb Return profile to the Main Alignment's
ProfileView.
''By Jeff Mishler
Sub test()
Dim oApp As AeccApplication
Dim odoc As AeccDocument
Dim oAlign As AeccAlignment
Dim oAlignPView As AeccProfileView
Dim oCRAlign As AeccAlignment
Dim sTCProf As String, sPVName As String
Dim sPVStyle As String, sBandStyl As String
Dim dCRStation As Double
sTCProf = "TopCurbCR1"
sPVName = "HiddenCR"
sPVStyle = "HiddenCR - 40 & 5"
sBandStyl = "_No Bands"
dCRStation = 509#
Set oApp = Application.GetInterfaceObject("AeccXUiLand.AeccApplication.5.0")
Set odoc = oApp.ActiveDocument
''Get the main alignment to add the CR to
Set oAlign = odoc.Sites("Roads & Lots").Alignments("B")
''Get the Profile to draw it in
Set oAlignPView = oAlign.ProfileViews(0)
''Get the CR Align
Set oCRAlign = odoc.Sites("Transition Alignments").Alignments("cr-ns2-ne")
''Add it to the profile
AppendCRProfiletoAlignProfile oAlignPView, oCRAlign, sPVStyle, sBandStyl,
dCRStation, sTCProf, sPVName, odoc
Set oApp = Nothing
End Sub
Function AppendCRProfiletoAlignProfile(oAlignPView As AeccProfileView,
oCRAlign As AeccAlignment, _
strPVStyleName As String, strBandStyl
As String, _
dCRSta As Double, strProfName As
String, _
strPVName As String, odoc As
AeccDocument)
Dim oCRPView As AeccProfileView
Dim dOrigin(2) As Double
Dim dX As Double, dY As Double
Dim dSta2 As Double
Dim dElev As Double
dSta2 = oCRAlign.StartingStation
dElev = oCRAlign.Profiles(strProfName).ElevationAt(dSta2)
oAlignPView.FindXYAtStationAndElevation dCRSta, dElev, dX, dY
dOrigin(0) = dX: dOrigin(1) = dY
Dim oPVStyle As AeccProfileViewStyle
Set oPVStyle = odoc.ProfileViewStyles(strPVStyleName)
Dim oBandStyl As AeccProfileViewBandStyleSet
Set oBandStyl = odoc.ProfileViewBandStyleSets(strBandStyl)
Set oCRPView = oCRAlign.ProfileViews.Add(strPVName, oAlignPView.Layer,
dOrigin, oPVStyle, oBandStyl)
''The following settings do not work in 2008....
''if they ever are usable, the origin will need to be changed when creating
the PV, _
I had tried the ElevationMin of the main PV and the CRstation.
'oCRPView.ElevationLocked = False
'oCRPView.StationLocked = False
'oCRPView.ElevationMin = dElev
'oCRPView.StationStart = oCRAlign.StartingStation
''So here is a workaround, by moving the pview
Dim dX2 As Double, dY2 As Double
Dim dBase(2) As Double
oCRPView.FindXYAtStationAndElevation dSta2, dElev, dX2, dY2
dBase(0) = dX2: dBase(1) = dY2
oCRPView.Move dBase, dOrigin
oCRPView.Update
Dim oOverride As AeccProfileOverride
Dim oProf As AeccProfile
For Each oOverride In oCRPView.Overrides
Set oProf = oOverride.profile
If Not oProf.Name = strProfName Then
oOverride.Draw = False
Else
oOverride.Draw = True
End If
Next
End Function
[/code]
"Jeff Mishler" wrote in message
news:5870297@discussion.autodesk.com...
Actually, I have a good idea on how to do this. I think I just came up with
my weekend project 🙂
I just wish my new laptop was here.....coding on my old Toshiba is
slow....well, the coding isn't, it's the testing things out by opening C3D
that's excruciatingly slow. Takes about 5 minutes to get to an editable
drawing.....but I'll give a try.