Originally Posted by
RPMiller
According to my architecture book from college standard stairs have a rise of 7" and a run of 11". So each step is 11" deep.
That is a 32.5� slope. The minimum depth I suggested was a safety thing, based on the 6" a ladder is supposed to be away from a wall. Also, these are most likely modern standards, not medieval ones (unless your textbook is really old :wink: ), so I think some latitude is allowed. According to my measurements (which I made a few minutes ago), the concrete steps in my apartment building are 4' wide, 7" tall and 10" deep. I imagine that medieval structures would vary from the average even more than that.
Anyway, I made some more mods to the macro and got it to work. EDIT: Added option to control the direction of the staircase.
Code:
MACRO MS_InVars
gn nErrNum -1
gv vStepWidth 5
gv vMinValue 2.5
gv vStepWidth ^DEnter stairway width [5]:
ifn vStepWidth-vMinValue MSC_Error0
gv vStepDepth 1.0
gv vMinValue 0.5
gv vStepDepth ^DEnter step spacing [1]:
ifn vStepDepth-vMinValue MSC_Error0
gv vRailWidth 0.2
gv vRailWidth ^DEnter railing width [0.2]
ifn vRailWidth MSC_Error1
gv vTreadWidth vStepWidth-2*vRailWidth
gv vMinValue 2.0
ifn vTreadWidth-vMinValue MSC_Error2
exitm
:MSC_Error0
gn nErrNum 0
gl sLastLine minimum value of
apnd sLastLine vMinValue
apnd sLastLine _feet.
msgbox ERROR! Invalid data entered.
The previously entered data must
be greater than or equal to the
sLastLine
exitm
:MSC_Error1
gn nErrNum 1
msgbox ERROR! Invalid data entered.
The previously entered
data must be greater than
or equal to zero.
exitm
:MSC_Error2
gn nErrNum 2
msgbox ERROR! Hand rails too close together
The distance between the hand rails
is less than the minimum value of
vMinValue
ENDM
I separated out most of the user input section into a different macro because I plan on writing more stair building macros and these variables will be common to all of them. I also incorporated the minimum value checking I talked about.
Code:
MACRO MyStairC
savesettings
selsave
sgetname sOldSheet
MS_InVars
ifp nErrNum+1 MSC_Done
lwidth vStepWidth
iferr MSC_Done
gp pCenter ^DCenter:
iferr MSC_Done
gp pStart ^DStarting point:
iferr MSC_Done
gdist vRadius pCenter pStart
ifn vRadius-vStepWidth/2 MSC_Error3
The initial setup and variable initialization section specific to circular staircases.
Code:
gn nStartAtTop 0
askbox Direction of Staircase.
Does the staircase ascend in a
clockwise direction (ie. the
starting point was at the top
of the stairs)?
iferr MSC_EndAtTop
gn nStartAtTop 1
:MSC_EndAtTop
EDIT: Added the above section to control the direction of the shading. Other changes are below.
Code:
sheet SYMBOLS FLAT
color 16
lstyle Solid
fstyle Basic Stone 2 Bitmap
setlayer UP AND DOWN
arcs pCenter pStart ^D
gp pEndPt @0,0
selbyp
outlineb
Draw staircase background.
Code:
gbrng vStartAngle pCenter pStart
gbrng vEndAngle pCenter pEndPt
ifz vRailWidth MSC_NoRail
color 14
fstyle Solid
lwidth vRailWidth
gv vOffset (vStepWidth-vRailWidth)/2
arcr pCenter vRadius-vOffset vStartAngle vEndAngle
outlineb
arcr pCenter vRadius+vOffset vStartAngle vEndAngle
outlineb
:MSC_NoRail
Draw the railings if necessary.
Code:
gv vStepAngle vStepDepth*180/(3.141592654*vRadius)
ifn vStartAngle-vEndAngle MSC_SkipAdjust
gv vEndAngle vEndAngle+360
:MSC_SkipAdjust
gn nNumSteps (vEndAngle-vStartAngle)/vStepAngle
gv vStepAngle (vEndAngle-vStartAngle)/nNumSteps
gv vEdgeAngle vStartAngle
color 0
Calculate initial and constant angles required. Note how the step angle is recalculated to evenly divide into the angular width of the staircase.
Code:
:MSC_Step
gv vRiserAngle vEdgeAngle+vStepAngle
ifp vRiserAngle-vEndAngle MSC_Done
lwidth 0
setlayer UP AND DOWN
line ref pCenter <vRiserAngle,vRadius-vTreadWidth/2 <vRiserAngle,vTreadWidth;
golayer UP AND DOWN SHADING
gv vShadowAngle vRiserAngle-vStepAngle*(1+nStartAtTop)/3
lwidth vTreadWidth
fstyle solid 20 Bitmap
ifp nStartAtTop MSC_UpCW1
arcr pCenter vRadius vShadowAngle vRiserAngle ESC
goto MSC_UpCCW1
:MSC_UpCW1
arcr pCenter vRadius vEdgeAngle vShadowAngle ESC
:MSC_UpCCW1
lwidth vStepWidth
fstyle solid 10 Bitmap
ifp nStartAtTop MSC_UpCW2
arcr pCenter vRadius vStartAngle vRiserAngle ESC
goto MSC_UpCCW2
:MSC_UpCW2
arcr pCenter vRadius vRiserAngle vEndAngle ESC
:MSC_UpCCW2
gv vEdgeAngle vRiserAngle
goto MSC_Step
Draw the step edges, shadows and shading. EDIT: Changed the above section to control the direction of the shading.
Code:
:MSC_Error3
msgbox ERROR! Radius of staircase too small.
The distance from the center of the
staircase to the center of the first
step is less than half of the width
of the step.
Display whatever error message is required specific to circular staircases. The other error tests are done in the general input macro.
Code:
:MSC_Done
sheet sOldSheet
selrest
getsettings
ENDM
Restore map settings and old sheet name. Note that I've switched to using sheet instead of sset because the latter considers the blanks in a sheet name to be delimiters.
Below is a sample staircase I created with the macro. Tell me what you think.
--
Dalton "who's actually getting his macros to work today!" Spence