Questions similar to these appear in the Be Communities MicroStation Forum.
This question is about converting a degree-of-curve value to a radius. Degree-of-curve is used in rail design in the US. It's similar to a Versine used in the UK and elsewhere.
Q How do I calculate an arc radius from a degree-of-curve value and apply it to a MicroStation tool?
A This article describes a MicroStation VBA project that shows how to perform the calculation and apply it to MicroStation's Fillet or Create Arc tool. The macro …
Here's the Fillet tool updated by this macro …
Here's the Place Arc tool updated by this macro …
If you want to get started with using this macro, go to Download.
The macro shows how to calculate radius from degree of curve …
Public Function CalculateRadius(ByVal degreeOfCurve As Double) As Double CalculateRadius = 50 / (Sin(Radians(degreeOfCurve / 2))) End Function
The TCB variables we modify for a fillet are …
tcb->msToolSettings.fillet.truncation
tcb->fillet_radius
The macro doesn't provide a tool to construct a fillet. That task is delegated to MicroStation's built-in fillet tool. However, the macro prepares MicroStation internal data. Those data are stored in the terminal control block (TCB), which is a chunk of public memory.
Those TCB variables are changed using VBA's SetCExpressionValue
method …
SetCExpressionValue "tcb->fillet_radius", vtRadius, ""
SetCExpressionValue "tcb->msToolSettings.fillet.truncation", Me.cboTruncate.ListIndex, ""
The place arc
command belongs to the CONSGEOM
application.
We pass the radius to that app like this …
SetCExpressionValue "RadiusValue", CStr(m_dblRadius), "CONSGEOM"
It's best to lock the arc radius setting, which is otherwise cleared by a user mouse motion. We lock that setting using this rather obscure bit-twiddling …
Dim mask As Long mask = Not 8 mask = GetCExpressionValue("lockMask", "CONSGEOM") And mask SetCExpressionValue "lockMask", mask Or 8, "CONSGEOM" CadInputQueue.SendCommand "CONSGEOM CONSTRAIN RADIUS UPDATELOCK"
If you want to understand the above, read the note in the macro source code or post a question to the MicroStation Programming Forum.
If you want to use VBA's IPrimitiveCommandEvents
to draw a fillet interactively,
then read
this article.
Download the
Degree of Curve ZIP archive, and unpack it to a suitable location such as
..\Workspace\Standards\macros
.
Start the macro using the key-in …
vba run [DegreeOfCurve]modMain.Main
Post questions about MicroStation programming to the MicroStation Programming Forum.