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

Creating a profile via VBA.

14 REPLIES 14
Reply
Message 1 of 15
MikeEvansUK
827 Views, 14 Replies

Creating a profile via VBA.

I'm trying to create a profile using vba that has multiple tangents whose start and ends do not match it also has multiple pvi's at some stations but i'm having trouble.

Tried using PVIs route which doesn't work.
Is this possible and if so which method should I be using? Aecclinefixed?

See image attached for the resultant profile. (Note not multiple profiles).
Mike Evans

Civil3D 2022 English
Windows 7 Professional 64-bit
Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (8 CPUs), ~4.0GHz With 32768MB RAM, AMD FirePro V4900, Dedicated Memory: 984 MB, Shared Memory: 814 MB

14 REPLIES 14
Message 2 of 15
Sinc
in reply to: MikeEvansUK

> {quote:title=MIKEEVANS wrote:}{quote}
> I'm trying to create a profile using vba that has multiple tangents whose start and ends do not match it also has multiple pvi's at some stations but i'm having trouble.


Can't really follow what you're trying to do - I don't understand what you mean by "start and ends do not match". Also, it is not possible to have multiple PVIs at the same station - each station can have at most one PVI.

-- Sinc
http://www.ejsurveying.com
http://www.quuxsoft.com
Sinc
Message 3 of 15
MikeEvansUK
in reply to: MikeEvansUK

Ok I have added another image that should show you (roughly) what I'm talking about.

In the image the Magenta profile consists of a series of fixed straights whose start and end points do not match one another. I'm trying to get an envelope for vertical visibility.

I have an array of start and end points Stn & Elevations, I feed these to two new arrays(0-1) (0) being the stn and (1) being the level. Two start points never co-exist at the same station (same for end points) however there may be cases where a start and an end coexist at the same stn but have differing levels and these two entities wouldn't be consecutive.

I should then be able to create the profile using the aeccfixedstraight(start, End) but I seem to be having difficulty here, the profile object does not get created so I was checking up to see if it's possible first in case that was why.

As I can manually draft these as I want I expected to be able to project them via VBA.

Hope it's a bit clearer.
Mike Evans

Civil3D 2022 English
Windows 7 Professional 64-bit
Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (8 CPUs), ~4.0GHz With 32768MB RAM, AMD FirePro V4900, Dedicated Memory: 984 MB, Shared Memory: 814 MB

Message 4 of 15
Anonymous
in reply to: MikeEvansUK

Hi Mike,

I've read your first post and this a couple of times and can't make any
sense of what you are trying to do.

I can see a continuous red profile and a series of magenta lines, one of
which is touched by white chainage lines.

Amongst other questions:
How are these magenta lines created?
What is their intended relation ship with some form of physical reality?
What is an "Envelope of vertical visibility"?

I think it would help if you could describe what you are trying to
achieve and what data you are imputing to achieve it.

Ultimately, the programming can only follow a logical description of
process.


Regards


Laurie Comerford


MIKEEVANS wrote:
> Ok I have added another image that should show you (roughly) what I'm
> talking about. In the image the Magenta profile consists of a series of
> fixed straights whose start and end points do not match one another. I'm
> trying to get an envelope for vertical visibility. I have an array of
> start and end points Stn & Elevations, I feed these to two new
> arrays(0-1) (0) being the stn and (1) being the level. Two start points
> never co-exist at the same station (same for end points) however there
> may be cases where a start and an end coexist at the same stn but have
> differing levels and these two entities wouldn't be consecutive. I
> should then be able to create the profile using the
> aeccfixedstraight(start, End) but I seem to be having difficulty here,
> the profile object does not get created so I was checking up to see if
> it's possible first in case that was why. As I can manually draft these
> as I want I expected to be able to project them via VBA. Hope it's a bit
> clearer.
> ------------------------------------------------------------------------
>
Message 5 of 15
MikeEvansUK
in reply to: MikeEvansUK

You may know it as SSD or Stopping Sight Distance in the US but it is different (I think) to the UK.

Basically forward visibility in the UK refers to a line drawn following a Road lane centre or the drivers eye of sight. These form two conditions a horizontal measured from a start point to an end point a specified distance(relative to speed) from the start point in the direction of travel repeated at an increment along the road.

It forms a "spyrograph" style envelope which graphically illustrates the drivers vision as they travel along a road, we use them to aid in the creation of widenings or omitting objects such as trees or embankments where they lie in the envelope.

The second condition is the vertical aspec which uses the same points as the horizontal but for the start point has a eye height and at the end point has an object height.

Again provides us with a drivers eye line as they drive along the road and ensures that the driver can see a body laying in the road a set distance away.

I have the horizontal portion set up and the vertical now gets all the data but I can't seem to add the profile.

Say a line starting at 0 with a starting height of (profile level + 1.02m) and ending at (startStn + 33m) with a level of (profile level + 0.260m) then another line starting 5m further along the alignment at station 5 which ends at station 38(startStn + 33m) and so on until the end of the profile.

You end up with a series of lines which if one intersects a vertical curve means a driver is unable to see an object in the road at that location.

It's a bit hard to describe it without images, I have had trouble finding any as they are a bit scarce on the net.
I'll try to get a drawing with the two created and add it here for you.
Mike Evans

Civil3D 2022 English
Windows 7 Professional 64-bit
Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (8 CPUs), ~4.0GHz With 32768MB RAM, AMD FirePro V4900, Dedicated Memory: 984 MB, Shared Memory: 814 MB

Message 6 of 15
ralstogj
in reply to: MikeEvansUK

Heres a picture and a link to design design data

http://www.transit.govt.nz/technical/view_manual.jsp?content_type=manual&=edit&primary_key=19&action=edit

Regards

Justin
Regards

Justin Ralston
http://c3dxtreme.blogspot.com/
Message 7 of 15
Anonymous
in reply to: MikeEvansUK

Hi Mike,

Got it. Sight Distance (SD) is what you're after. There are options of
stopping sight distance
passing sight distance - single carriageway, and dual carriageways
headlight sight distance
each of which results from a combination of the sight distance and the
design speed.

And you want to plot Sight Distance on a profile.

How do you handle the plot?

As an example, let's say at Chainage 0 the SD is 200 and at Chainage 100
it is 300, then there is a a long vertical tangent so the SD extends to
10000. How can you sensibly plot this (log scale?) on a profile? What
if there is a horizontal curve half way along the vertical tangent
wherein the SD is reduced to 200 by the horizontal curve? Which sight
distance do you plot?

For real life work, I'd look closely at RDV. It elegantly combines
vertical curvature, horizontal curvature and cross section detail to
show where you actually have sight distances deficiencies.

It is quite instructive to see models in RDV wherein the vertical
profile and horizontal alignment both meet specification, but sight
distance fails due to roadside furniture such as guard rail.

For a computed solution, you probably should look at a theoretical model
of the sight distance and calculate that in areas where sight distance
might be significant.

A quick look at the AASHTO Policy for Geometric Design of Highways and
Streets, would enable you to identify locations where no computations
were relevant. Fig III-3 in my 1990 edition shows a manual method which
could be interpreted into a theoretical model.


Regards


Laurie Comerford


mikeevans wrote:
> You may know it as SSD or Stopping Sight Distance in the US but it is
> different (I think) to the UK. Basically forward visibility in the UK
> refers to a line drawn following a Road lane centre or the drivers eye
> of sight. These form two conditions a horizontal measured from a start
> point to an end point a specified distance(relative to speed) from the
> start point in the direction of travel repeated at an increment along
> the road. It forms a "spyrograph" style envelope which graphically
> illustrates the drivers vision as they travel along a road, we use them
> to aid in the creation of widenings or omitting objects such as trees or
> embankments where they lie in the envelope. The second condition is the
> vertical aspec which uses the same points as the horizontal but for the
> start point has a eye height and at the end point has an object height.
> Again provides us with a drivers eye line as they drive along the road
> and ensures that the driver can see a body laying in the road a set
> distance away. I have the horizontal portion set up and the vertical now
> gets all the data but I can't seem to add the profile. Say a line
> starting at 0 with a starting height of (profile level + 1.02m) and
> ending at (startStn + 33m) with a level of (profile level + 0.260m) then
> another line starting 5m further along the alignment at station 5 which
> ends at station 38(startStn + 33m) and so on until the end of the
> profile. You end up with a series of lines which if one intersects a
> vertical curve means a driver is unable to see an object in the road at
> that location. It's a bit hard to describe it without images, I have had
> trouble finding any as they are a bit scarce on the net. I'll try to get
> a drawing with the two created and add it here for you.
Message 8 of 15
MikeEvansUK
in reply to: MikeEvansUK

Thanks for the response Laurie.

I have looked at RDV before and as CGSA, the way RDV handles visibility is not quite what we want - too much on the 3D aspect.

CGSA does handle horizontal visibility as we need but there is no vertical aspect, both are not free and I want to learn VBA here as well as getting necessary tools which I have been missing for quite a few releases. I use the method as I described not as described in the Ashho manual. I use DMRB British "design manual for roads and bridges". The objective is the same but from reading your post worked out in very different methods.

I can manually create a profile as I want it to be so I don't see why I can't produce the same in VBA?

Can I draw a profile tangent line from 0 to 100 then the next entity being from 5 to 105 etc for the length of the profile. I have looked at using PVIs and that doesn't seem to be the answer, I think that a fixedtangent is but following the profile example code and changing the values so that dloc1(0)(1) contain the correct values for chainage and elevation but they don't get created.

Where the code creates a fixedtangent it requires two parameters (Start Stn & Level, End Stn & level) in the example these have been combined into two arrays(0 to 1) is this correct?

now specifying these as entity.addfixedtangent(dloc1,dloc2) does the application read both values in dloc1 <>

I now have the profile being created but no entities being added within it: I'll keep plodding along, I got this far blind as such and figuring it out by trial and error (more error but hey). I'm sure the solution is not far from me now. : )

Mike
Mike Evans

Civil3D 2022 English
Windows 7 Professional 64-bit
Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (8 CPUs), ~4.0GHz With 32768MB RAM, AMD FirePro V4900, Dedicated Memory: 984 MB, Shared Memory: 814 MB

Message 9 of 15
Anonymous
in reply to: MikeEvansUK


Mike,

 

Instead of trying to make profile elements (I think
the API is blocking you from making these non-standard elements), try using just
AutoCAD lines for your sight distance check tool.

 

Regards,

 

Peter Funk

Autodesk, Inc.
Message 10 of 15
MikeEvansUK
in reply to: MikeEvansUK

Hi Peter, I was starting to think the same thing but after playing around I have managed to get it to do what I want (unfortunately working off the example as the code is at home) but it does create elements as I need them.

''first line
Dim oProfileTangent1 As aeccProfileTangent
dLoc1(0) = oAlignment.StartingStation: dLoc1(1) = -40#
dLoc2(0) = 50: dLoc2(1) = -70#
Set oProfileTangent1 = oProfile.Entities.AddFixedTangent(dLoc1, dLoc2)
''second line
Dim oProfileTangent2 As aeccProfileTangent
dLoc1(0) = 25: dLoc1(1) = -60#
dLoc2(0) = 75: dLoc2(1) = -4#
Set oProfileTangent2 = oProfile.Entities.AddFixedTangent(dLoc1, dLoc2)

I must have something else incorrectly set elsewhere in my code: The plot thickens...

I don't really want to use lines as they will not be dynamic with the section views datum and scales, a profile would be but i'll bear it in mind in case.
Mike Evans

Civil3D 2022 English
Windows 7 Professional 64-bit
Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (8 CPUs), ~4.0GHz With 32768MB RAM, AMD FirePro V4900, Dedicated Memory: 984 MB, Shared Memory: 814 MB

Message 11 of 15
Anonymous
in reply to: MikeEvansUK


Mike,

 

While the profile elements would be dynamic, what
would they be dynamic to? Don't you have to recalculate the PVI points when the
profile changes? I'm just wondering what you're going to gain by using profile
elements in this manner. Also, what is the final product that you are looking
for here? Is it visual, labels, a band or a report?

 

Peter Funk

Autodesk, Inc.
Message 12 of 15
Anonymous
in reply to: MikeEvansUK

Hi Mike/Peter,

Further to these questions.

As I alluded to earlier, due to the range of possible sight distances
based on centreline profiles, a graphical plot is not feasible unless
you make a convention along the lines of values above a certain level
being plotted as horizontal bounding line - or not plotted at all.

A report or labels seem feasible, but what worries me is that the
computed values are being dome in isolation from the cross-section shape
and the horizontal alignment.

If a separate evaluation of horizontal sight distance is made it is not
legitimate to then adopt the lower of the two values as the three
dimensional interaction could well create a sight distance lower than
predicted for the two values in isolation.

Thus the computed values are not conservative and could lead to
potentially dangerous situations being accepted based on the output of
separate models.

i.e. It's a 3 dimensional problem and has to be resolved as such.

Obviously the programming effort is not trivial and this is why I
suggested using RDV where the work has already been done and presented
is a clearly understandable fashion.



Regards


Laurie Comerford

Peter Funk - Autodesk wrote:
> Mike,
>
> While the profile elements would be dynamic, what would they be dynamic
> to? Don't you have to recalculate the PVI points when the profile
> changes? I'm just wondering what you're going to gain by using profile
> elements in this manner. Also, what is the final product that you are
> looking for here? Is it visual, labels, a band or a report?
>
> Peter Funk
> Autodesk, Inc.
Message 13 of 15
Anonymous
in reply to: MikeEvansUK

Laurie,

I agree that the proper solution for sight line is a 3D solution that looks
at the full design of alignment, profile, cross section and surface. That
said, existing standards seem to indicated that 2D methods are still
employed in some cases.

Peter Funk
Autodesk, Inc.
Message 14 of 15
Anonymous
in reply to: MikeEvansUK

Hi Peter,

You're right about existing standards often being outdated.

There are a whole range of Civil Engineering checks which are done by
methods appropriate to the hand computation days when it was not
feasible to do more detailed analysis.

Checking Authority staff (who often seem to be employed by
"Accountant/Lawyer/Other ignorant of Civil Engineering" type people on
the basis on their low cost of employment) often have no idea of what is
being checked or why.

As an example drainage computations in the format of the rational method
hand spreadsheet are still the required information for many Authorities
here and I guess in the USA, yet they have no discernible relationship
with the performance of the drainage network at time of high flows, or
of the potential from blocked pipes.

However, we are now in the computer world and we have the means of doing
these computations economically (usually at least an order of magnitude
cheaper) than the simpler computations could be done by hand and in my
view there is no excuse for not doing so.

Regards


Laurie Comerford

Peter Funk - Autodesk wrote:
> Laurie,
>
> I agree that the proper solution for sight line is a 3D solution that looks
> at the full design of alignment, profile, cross section and surface. That
> said, existing standards seem to indicated that 2D methods are still
> employed in some cases.
>
> Peter Funk
> Autodesk, Inc.
Message 15 of 15
MikeEvansUK
in reply to: MikeEvansUK

Peter, Laurie.

I managed to get it working last night bar a few array counting issues (not sure what was wrong in the end) .

As far as dynamic properties (you give me too much credit, I'm not that clever) yes the profile would have to be re run whenever a design is changed but that's not a major issue it would be nice to be fully dynamic.

As far as looking at the model (surface) yes: "is the entity intersecting the surface" is an ideal solution but quite how I do that is a different matter.

The image attached shows (incorrectly) the horizontal envelope on the centreline (should be the lane centreline) and the profile shown in grey is relative to the design profile. In reality the design profile here would be a surface profile from the model. As the horizontal shows where the potential for issues may arise (in this case nowhere) and the vertical (in this case failing for the example) it is normally enough.

There may be times where a more detailed check may be in order and perhaps featurelines are the answer here? Or any other idfeas welcome so long as they are fairly basic to do 🙂

Cheers.

Mike
Mike Evans

Civil3D 2022 English
Windows 7 Professional 64-bit
Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (8 CPUs), ~4.0GHz With 32768MB RAM, AMD FirePro V4900, Dedicated Memory: 984 MB, Shared Memory: 814 MB

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report