Questions similar to these appear in the Be Communities MicroStation Forum.
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 …
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, ""
place arc command belongs to the
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,
Degree of Curve ZIP archive, and unpack it to a suitable location such as
Start the macro using the key-in …
vba run [DegreeOfCurve]modMain.Main
Post questions about MicroStation programming to the MicroStation Programming Forum.