Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Spiral Staircase Shading Macro Idea [CC2/CC3]

  1. #1
      Robbie is offline
    Administrator Facebook Connected Robbie's Avatar
    Join Date
    Mar 2006
    Location
    Fairborn, OH
    Posts
    2,784
    Blog Entries
    5

    Post Spiral Staircase Shading Macro Idea [CC2/CC3]

    I'm SOOOO not a CC2/3 scripter...I REALLY need to put forth a bit of effort to learn it...but in the meantime, I was wondering if anyone would like to help me figure out some of the logistics of this particular script idea I have.

    Its regarding the CStair macro by Ralf...its an awesome macro, and I'm using it extensively to make staircases in towers, just like it was designed...but the staircases are missing depth.

    I put up a post on CC2-L but without the ability to include images its kinda hard to describe, so this post will include an image so you can see what I'm doing.

    I'm using the transparency fills of CC3 (10% version) and overlapping them with the ARCS command to create a progressively darker shading overlay.

    I made this particular staircase pictured (before and after shading) with the CStair macro and manually overlapped the transparency arcs. But the effect with wallshadow and all is just awesome if you ask me.

    I need to take Ralfs macro and remove the fact that it creates both light and dark stair segments and make it so it just creates single shorter and shorter arcs along the ARCS stored points path.

    Then I need to figure out if its even possible to create a fillstyle that is not in the current template and use it for the arcs it creates.

    So the process should be:
    -Stair (shading?) width
    -Stair (shading?) depth
    -Center Point
    -Starting Point
    -Ending Angle

    It should use the '\Bitmaps\Tiles\Transparencies\solid 10.png' bitmap fill with alpha transparency turned on (even if its not in the current template)

    Anyone got any ideas? Here's Ralfs script for reference (I'll remove if there's copyright problems):

    Code:
    //the next macro draws a staircase along an arc
    //by Ralf Schemmann (improved by Morgan Olden)
    MACRO CSTAIR
    RDOFF
    SELBYP
    COLOR 16
    FSTYLE Solid
    LSTYLE Solid
    GV sw1 ^DStair width:
    GV stw1 ^DStep depth:
    LWIDTH sw1
    IFERR edg
    GP p1 ^DCenter:
    IFERR edg
    GP p2 ^DStarting point:
    IFERR edg
    ARCS p1 p2 ^D
    UNDO
    GP p3 @0,0
    ARCS p1 p2 p3
    ARCS p1 p2 p3
    OUTLINEB
    GDIST r1 p1 p2
    GBRNG a1 p1 p2
    GBRNG a2 p1 p3
    ifn a1-a2 SkipAngleAdjust
    gv a2 a2+360
    :SkipAngleAdjust
    gv stw1 360/(3.1416*(r1*2))*stw1
    GV b1 a1+0
    GV b2 a2+0
    GV b3 b2-1
    GV stepi 1.0
    IFP stw1-b3 edg
    :step
    COLOR 14
    FSTYLE Solid
    GV a3 b2-(stw1*stepi)+(stw1*1/3)
    ARCR p1 r1 a1 a3
    ESC COLOR 16
    GV a4 b2-(stw1*stepi)
    ARCR p1 r1 a1 a4
    ESC ARCR p1 r1 a1 a4
    ESC
    OUTLINEB
    GV stepi stepi+1.0
    IFP (b2-(stw1*stepi))-b1 step
    :edg
    REDRAW SELBYD
    RDON
    ENDM
    Attached Thumbnails Attached Thumbnails Spiral Staircase Shading Macro Idea [CC2/CC3]-stairshading_125.jpg  
    Robbie Powell - Site Admin

  2. #2
    Guild Apprentice
    Join Date
    Jun 2006
    Location
    Hamilton, Ontario, CANADA
    Posts
    47

    Post

    I have a few questions before I start writing the script.
    1. Will your stairs always descend counter-clockwise (ie. start from the bottom)?
    2. Do you want to draw the arc of the stairs or specify the number of steps?
    3. If (in the former case) the step depth does not divide evenly into the arc length of the staircase, do you want to trim the staircase (at top or bottom) or adjust the step depth (top, bottom or all)?
    4. The step shadow is currently 1/3rd the step depth. Do you want to change this? What transparency level should I use for it?
    5. Do you want to add an optional railing on either or both sides?
    6. According to "Architectural Graphic Standards", staircases should have at least one landing every twelve feet. Would you like this as an option?

    --

    Dalton "who's written an aMazing script ... if he could just get it to work" Spence

  3. #3
      Robbie is offline
    Administrator Facebook Connected Robbie's Avatar
    Join Date
    Mar 2006
    Location
    Fairborn, OH
    Posts
    2,784
    Blog Entries
    5

    Post

    1. Will your stairs always descend counter-clockwise (ie. start from the bottom)? The original script I think only drew in one direction (a limitation of ARCS I think)...so I can deal with one direction, but two would be nice.
    2. Do you want to draw the arc of the stairs or specify the number of steps? I think the arc would be better...basing the shading on the path of an ARCS as mentioned before
    3. If (in the former case) the step depth does not divide evenly into the arc length of the staircase, do you want to trim the staircase (at top or bottom) or adjust the step depth (top, bottom or all)? I assume this means you will be implementing the shading into a staircase script altogether, thus redoing the CSTAIR macro altogether? if so, specifying a step depth and then adjusting all of them to fit would be ideal, but isn't required...Ralfs CSTAIR doesn't do this.
    4. The step shadow is currently 1/3rd the step depth. Do you want to change this? What transparency level should I use for it? If you're redoing the CStair to use transparencies for the step shadow too, then 20 or 30% should be enough...1/3rd depth is fine. I think Steps should be outlined in black, but step shadows shouldn't be. The overlapping transparent overlay arcs that show depth like in my example however should always be 10%, since they overlap and get darker.
    5. Do you want to add an optional railing on either or both sides? Would be really cool, but isn't necessary...maybe as a separate macro?
    6. According to "Architectural Graphic Standards", staircases should have at least one landing every twelve feet. Would you like this as an option? This would probably be a rairly used option, since I and most mappers when adhering to this rule would probably rather aesthetically place such a landing as opposed to sticking to the twelve feet rule...I wouldn't bother


    Questions answered in italics hanks for looking at this!
    Robbie Powell - Site Admin

  4. #4
    Guild Apprentice
    Join Date
    Jun 2006
    Location
    Hamilton, Ontario, CANADA
    Posts
    47

    Post

    Here's what I've got so far. I've skipped points 1, 5 and 6 (I'll add them later), but the rest are covered.
    Code:
    MACRO MyStairC
    savesettings
    selsave
    color 16
    fstyle Solid
    lstyle Solid
    gv vStepWidth 10
    gv vStepWidth ^DEnter the stairway width [10]:
    gv vStepDepth 1
    gv vStepDepth ^DEnter the step spacing [1]:
    lwidth vStepWidth
    iferr MSC_Done
    gp pCenter ^DCenter:
    iferr MSC_Done
    gp pStart ^DStarting (bottom) point:
    iferr MSC_Done
    arcs pCenter pStart ^D
    gp pEndPt @0,0
    selbyp
    outlineb
    gdist vRadius pCenter pStart
    gbrng vStartAngle pCenter pStart
    gbrng vEndAngle pCenter pEndPt
    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
    :MSC_Step
    gv vRiserAngle vEdgeAngle+vStepAngle
    ifp vRiserAngle-vEndAngle MSC_Done
    gv vShadowAngle vRiserAngle-vStepAngle/3
    lwidth vStepWidth
    fstyle solid 20 Bitmap
    arcr pCenter vRadius vShadowAngle vRiserAngle ESC
    fstyle solid 10 Bitmap
    arcr pCenter vRadius vStartAngle vRiserAngle ESC
    lwidth 0
    line ref pCenter <vRiserAngle,(vRadius-vStepWidth/2) <vRiserAngle,vStepWidth;
    gv vEdgeAngle vRiserAngle
    goto MSC_Step
    :MSC_Done
    selrest
    getsettings
    ENDM
    Note that my variable names are self explanatory and labels are prefixed to avoid conflicts. Rather than draw each step separately (and twice), I draw a common staircase background first, then put the shading and edge lines on top of it for effect. As to the optional railings (point 5), I'd prefer that they were in this macro so they could be inserted before the MSC_Step loop for depth shading and step shadows/edges can be narrowed so they don't overlap. What sheet/layer should I draw this in?

    --

    Dalton "who thinks code readability is important as documentation" Spence

  5. #5
      Robbie is offline
    Administrator Facebook Connected Robbie's Avatar
    Join Date
    Mar 2006
    Location
    Fairborn, OH
    Posts
    2,784
    Blog Entries
    5

    Post

    Looking good...I've got a dog issue at the house (our dog just bit a groomer) so as soon as I get back from dealing with that, I'll take a look at this.

    I put mine as follows:

    Stairs Layer: UP AND DOWN
    Stairs Sheet: SYMBOLS FLAT

    Stairs Shading Layer: UP AND DOWN SHADING
    Stairs Shading Sheet: SYMBOLS FLAT
    Robbie Powell - Site Admin

  6. #6
    Guild Apprentice
    Join Date
    Jun 2006
    Location
    Hamilton, Ontario, CANADA
    Posts
    47

    Post

    Hope your dog issues are resolved successfully. I'm inserting some error checking in the macro, and I need a minimum acceptable step width and depth. Using "Architectural standards for starship deckplans" by Christopher Thrash as a guide, minimum stair width should be 2.5' with 2' between railings. (Should railing thickness be fixed or variable?) Step tread depth is a little trickier, but my best guess (at least until I can get to the library and check their copy of "Architectural Graphic Standards") is that anything less than 6" would be a hazard. At the moment, all errors are fatal and end the macro. What do you think?

    EDIT: Here is the revised code without the minimums but with railing support. I'm breaking it into sections for comments.
    Code:
    MACRO MyStairC
    savesettings
    selsave
    rdoff
    sgetname sOldSheet
    Save current map setting and sheet.
    Code:
    gv vStepWidth 5
    gv vStepWidth ^DEnter stairway width [5]:
    ifn vStepWidth MSC_Error1
    ifz vStepWidth MSC_Error1
    gv vStepDepth 1
    gv vStepDepth ^DEnter step spacing [1]:
    ifn vStepDepth MSC_Error1
    ifz vStepDepth MSC_Error1
    gv vRailWidth 0.2
    gv vRailWidth ^DEnter railing width [0.2]
    ifn vRailWidth MSC_Error0
    gv vTreadWidth vStepWidth-2*vRailWidth 
    ifn vTreadWidth MSC_Error2
    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
    Input and check data for errors.
    Code:
    sset SYMBOLS FLAT
    color 16
    fstyle Solid
    lstyle Solid
    setlayer UP AND DOWN
    arcs pCenter pStart ^D
    gp pEndPt @0,0
    selbyp
    outlineb
    Draw staircase background.
    Code:
    gbrng vStartAngle pCenter pStart
    ifz vRailWidth MSC_NoRail
    color 14
    lwidth vRailWidth
    offset1 (vStepWidth-vRailWidth)/2
    pStart pCenter
    pStart <vStartAngle,1;
    outlineb
    :MSC_NoRail
    Draw the railings if necessary.
    Code:
    gbrng vEndAngle pCenter pEndPt
    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/3
    lwidth vTreadWidth
    fstyle solid 20 Bitmap
    arcr pCenter vRadius vShadowAngle vRiserAngle ESC
    lwidth vStepWidth
    fstyle solid 10 Bitmap
    arcr pCenter vRadius vStartAngle vRiserAngle ESC
    gv vEdgeAngle vRiserAngle
    goto MSC_Step
    Draw the step edges, shadows and shading.
    Code:
    :MSC_Error0
    msgbox ERROR! Invalid data entered.
    The previously entered data
    must be greater than zero.
    
    goto MSC_Done
    :MSC_Error1
    msgbox ERROR! Invalid data entered.
    The previously entered
    data must be greater than
    or equal to zero.
    
    goto MSC_Done
    :MSC_Error2
    msgbox ERROR! No space between railings.
    The width of the staircase is less
    than the combined width of both hand
    rails leaving no space between them.
    
    goto MSC_Done
    :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.
    Code:
    :MSC_Done
    sset sOldSheet
    rdon
    selrest
    getsettings
    ENDM
    Restore map settings and old sheet name.

    --

    Dalton "who think macros without error traps are asking for trouble" Spence

  7. #7
      RPMiller is offline
    Community Leader RPMiller's Avatar
    Join Date
    Apr 2006
    Location
    Watching you from in here
    Posts
    3,233

    Post

    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.

  8. #8
    Guild Apprentice
    Join Date
    Jun 2006
    Location
    Hamilton, Ontario, CANADA
    Posts
    47

    Post

    Quote 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
    Attached Thumbnails Attached Thumbnails Spiral Staircase Shading Macro Idea [CC2/CC3]-sample1b_919.png  

  9. #9
      Robbie is offline
    Administrator Facebook Connected Robbie's Avatar
    Join Date
    Mar 2006
    Location
    Fairborn, OH
    Posts
    2,784
    Blog Entries
    5

    Post

    Hmmm...I just tried your most recent...and assuming I pasted it in correctly...I got nothing but black steps. It drew the steps pretty well, but I ended up with a 5' wide black arc after it was done.
    Robbie Powell - Site Admin

  10. #10
    Guild Apprentice
    Join Date
    Jun 2006
    Location
    Hamilton, Ontario, CANADA
    Posts
    47

    Post

    Quote Originally Posted by Arcana
    Hmmm...I just tried your most recent...and assuming I pasted it in correctly...I got nothing but black steps. It drew the steps pretty well, but I ended up with a 5' wide black arc after it was done.
    Well, it works for me (as you can see above). Are you sure you have all the correct bitmap fills loaded? The ones required are:
    1. "Basic Stone 2 Bitmap" for the step surface,
    2. "solid 10 bitmap" for the depth shading and
    3. "solid 20 bitmap" for the step shadows.
    I've made some more changes recently to add a choice between clockwise and counterclockwise shading. You might notice that the "loose spiral" stairs (Sample1a.png and Sample1c.png) above have 21 steps. With 7" risers that's a total floor-to-floor height of 12'3" (assuming one step is at floor level). I'm thinking that the "tight spiral" has the same number of steps with an additional 360° turn hidden from view, which allows for stacked stairs with 6.5' headroom and a 16 square foot landing. I may turn these images into symbols.

    --

    Dalton "who hates going down stairs in the dark" Spence[/list]

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •