home *** CD-ROM | disk | FTP | other *** search
Text File | 2003-09-29 | 29.3 KB | 1,317 lines |
- ' BasicCAD Program to draw a Sliced Deck
- ' Deck Data is stored in an ASCII data file in the
- ' Sample Macros folder.
- '
- ' Program Settings
- Sys(242) = 0 ' Turn off Select Object when Created for now
- ' Sys(800) = 1 ' Turn on Tracing Mode Dialog
- Sys(36) = 1 ' Turn on Silent Mode
- Sys(243) = 0 ' Turn off Shade when Created
- Precision 4
- '
- ' Items in Layers
- ' Layer 1 Posts
- ' Layer 2 Deck Outline on ground
- ' Layer 3 Beams
- ' Layer 4 Deck Frame
- ' Layer 5 Deck Joists
- ' Layer 6 Decking
- ' Layer 15 Attributes
- '
- ' All Deck Distance Variable names follow this format
- ' Character 1; F or I for Feet or Inches
- ' Character 2; X, Y, or Z for Axis
- ' Character 3; D for Deck, P for Post, B for Beam, J for Joist, etc.
- ' Character 4; T for Total, (Optional)
- '
- ' Declare and initialize Public Variables
- '
- ' Start Progress Bar
- Progress 1 "Drawing Deck, Please Wait . . . "
- '
- ' Get Values from ASCII text file
- open "i", 1, "*\Sample Macros\Deck_Slice2.txt"
- ' Deck Variables
-
- ' Get Deck Width
- input #1, temp$
- temp2$ = LEFT$(temp$, 8)
- FXDwide = VAL(temp2$) ' Deck Width
- IXDwide = FXDwide * 12 ' Deck Width
- ' Get Deck Depth
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- FZDdeep = VAL(temp2$) ' Deck Depth
- IZDdeep = FZDdeep * 12 ' Deck Depth
- ' Get Deck Height
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- FYDhigh = VAL(temp2$) ' Deck Height
- IYDhigh = FYDhigh * 12 ' Deck Height
- ' Get Deck Overhang
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- FXDover = VAL(temp2$) ' Max. Allowed Overhang
- IXDover = FXDover * 12 ' Max. Allowed Overhang
- ' Get Deck Overhang
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- FZDover = VAL(temp2$) ' Max. Allowed Overhang
- IZDover = FZDover * 12 ' Max. Allowed Overhang
- ' Get Length Between Posts
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- FXPlbep = VAL(temp2$) ' Length Between Posts
- IXPlbep = FXPlbep * 12 ' Length Between Posts
- ' Get Post Width
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IXPwide = VAL(temp2$) ' Post Width
-
- IXPhwide = IXPwide / 2 ' Post Width / 2 on X
- IZPhdeep = IXPwide / 2 ' Post Depth / 2 on Z
- ' Get Space Between Beams
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- FZBdeep = VAL(temp2$) ' Space Between Beams
- IZBdeep = FZBdeep * 12 ' Space Between Beams
- ' Get Beam Height
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IYBhigh = VAL(temp2$) ' Beam Height
- ' Get Beam Depth
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IZBdepe = VAL(temp2$) ' Beam Depth
- ' Get Beam Width
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- FXBwide = VAL(temp2$) ' Beam Width
- IXBwide = FXBwide * 12 ' Beam Width
- ' Get Joist Height
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IYJhigh = VAL(temp2$) ' Joist Height
- ' Get Joist Depth
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- FZJdepe = VAL(temp2$) ' Joist Depth
- IZJdepe = FZJdepe * 12 ' Joist Depth
- ' Get Joist Width
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IXJwide = VAL(temp2$) ' Joist Width
- ' Get Joist Spacing
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IXJcent = VAL(temp2$) ' Joist Center Spacing
- ' Get Decking Height
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IYKhigh = VAL(temp2$) ' Decking Height
- ' Get Decking Depth
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IZKdepe = VAL(temp2$) ' Decking Depth
- ' Get Decking Spacing
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- IXZKspc = VAL(temp2$) ' Decking Spacing
- ' Get Deck Type
- input #1, temp$
- temp2$ = LEFT$(temp$, 5)
- Dvalue = VAL(temp2$) ' Deck Type
- ' Get Post Type
- input #1, temp$
- PostType$ = temp$ ' Post Type String
- ' Get Beam Type
- input #1, temp$
- BeamType$ = temp$ ' Beam Type String
- ' Get Joist Type
- input #1, temp$
- JoisType$ = temp$ ' Joist Type String
- ' Get Decking String
- input #1, temp$
- Decking$ = temp$ ' Decking String
- ' Get Shading String
- input #1, Shade
- Close #1
- '
- IXPtlen = IXDwide - (2 * IXPoffs) ' Total Width Available for Posts after Subtracting Overhang
- IZPtlen = IZDdeep - (2 * IZPoffs) ' Total Depth Available for Posts after Subtracting Overhang
- IXKwide = ((3 * IXJcent) - IXZKspc) ' Calculated Width of Decking
- IXZJovr = ((IXJwide - IXZKspc) / 2) ' Calculated Overlap for Decking across Width of Joist
- IYPhigh = 0 ' Calculated Post Height
- NumoPstX = 0 ' Calculated number of Posts for Deck Width
- NumoBmsZ = 0 ' Calculated number of Beams for Deck Depth
- NumoJstX = 0 ' Calculated number of Joists for Deck Width
- NumoDckZ = 0 ' Calculated number of Rows of Decking for Deck Depth Divided by 3
- ' 3 Rows are Initially Drawn and All 3 are then Arrayed
- ' The Rows of Decking is All Rows of Decking Needed so It Needs to be Divided by 3
- '
- ' Misc Variables
- tn1 = 0 ' Numeric Local Placeholder
- t1$ = "" ' String Local Placeholder
- ps1 = 0 ' Temp Numeric Value passed to Status subroutine
- ps2 = 0 ' Temp Numeric Value divided by 12
- ps3 = 0 ' Temp Numeric Value multiplied by 12
- ps$ = "" ' Temp String Variable
-
- '
- ' Calculate Post Height
- ' Add Beam height + Joist Height
- tn1 = IYBhigh + IYJhigh
- ' Subtract the sum from the deck height in inches
- IYPhigh = IYDhigh - tn1
- ' ps1 = IYPhigh
- ' gosub status
- '
- ' Calculate Number of Posts Needed for Width
- ' Total Width Available for Posts
-
- IXPtlen = IXDwide - (2 * IXDover)
-
- ' Number of Posts is Total Width Available for Posts divided by Length between Posts
-
- NumoPstX = IXPtlen / IXPlbep
- NumoPstX = ROUND (NumoPstX)
- ' Distance Between Posts is refigured as Total Width Available for Posts Divided by the Newly figured Number of Posts
- IXPlbep = IXPtlen / NumoPstX
- ' ps1 =NumoPstX
- ' gosub status
- '
- ' IXPlbep = IXPlbep / 2
- ' NumoPstX = NumoPstX * 2
- ' Draw Posts for Deck Width
- '
- ' Posts go on Layer 1
- SYS(3)=1
- SYS$(93) = "Posts"
- ' Set Drawing Options
- ' Use Left Hand Coordinate System
- Sys(110) = -1
- '
- ' Select Object when Created
- Sys(242) = 1
- '
- ' Set Local Origin Location
- LOriginX = 0 + IXDover
- LOriginY = 0
- LOriginZ = 0 + IZDover
- ' Make sure we're in 3D
- if Sys(344) = 1 then
- >2DMode
- {
- }
- endif
- ' Make sure were in wireframe mode
- for a = 1 to 4
- Sys(71) = a
- Sys(2) = 0
- next a
- Sys(71) = 1
- ' Draw the First Post
- >Box
- {
- <PointXYZ [LOriginX - IXPhwide, LOriginY, LOriginZ - IZPhdeep]
- <PointXYZ [LOriginX + IXPhwide, IYPhigh, LOriginZ + IZPhdeep]
- }
- ' >>> Select Layers 1, Posts
- >SelectLayer
- {
- <Layer 1
- }
- ' Set current Material to Cherry
- Sys(349) = 5
- ' Set current color for Oak Material
- Sys(350) = 177
- Sys(351) = 76
- Sys(352) = 51
- ' Apply Current Material and Color to Layers
- >ApplyMaterial
- {
- }
- >ApplyColor
- {
- }
- ' Set the Post's center handle
- >SetHandle
- {
- <Pointxyz [LOriginX, LOriginY, LOriginZ]
- }
- >FitToAllWindow
- {
- }
- ' Array the Post for Width
- >Array
- {
- <PointXYZ [LOriginX + IXPlbep, LOriginY, LOriginZ]
- ' NumoPstX + 1 is Neccessary because DesignCAD Arrays with more than one entity only
- <NCopy [NumoPstX + 1,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' >>> Material List
- att$ = PostType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [NumoPstX,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- >SelectAll
- {
- }
- '
- ' Update Progress Bar
- Progress 10 100
- '
- ' Set the Post's center handle
- >SetHandle
- {
- <PointXYZ [LOriginX, LOriginY, LOriginZ]
- }
- >FitToAllWindow
- {
- }
- ' Total Depth Available for Posts
-
- IZPtlen = IZDdeep - (2 * IZDover)
-
- ' Calculate Number of Posts Needed for Depth
-
- NumoBmsZ = IZPtlen / IZBdeep
- NumoBmsZ = ROUND (NumoBmsZ)
- ' Distance Between Posts is refigured as Total Depth Available for Posts Divided by the Newly figured Number of Posts
- IZBdeep = IZPtlen / NumoBmsZ
-
- ' Draw Posts for Deck Depth
- ' Array the Post for Depth
- >Array
- {
- <PointXYZ [LOriginX, LOriginY, LOriginZ + IZBdeep]
- <NCopy [1,1,NumoBmsZ + 1]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' >>> Material List
- att$ = PostType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [NumoBmsZ + 1,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' If Deck is less than 24 feet wide, add supporting posts
- ' if FXDwide < 24 then
- ' If FXDwide > 17 then
- ' LOriginX = IXDwide / 3
- ' LOriginY = 0
- ' LOriginZ = IZDdeep - IZDover
- ' >Box
- ' {
- ' <PointXYZ [LOriginX - IXPhwide, LOriginY, LOriginZ - IZPhdeep]
- ' <PointXYZ [LOriginX + IXPhwide, IYPhigh, LOriginZ + IZPhdeep]
- ' }
- ' KDW5 = IXDwide / 3
- ' LOriginX = IXDwide - KDW5
- ' >Box
- ' {
- ' <PointXYZ [LOriginX - IXPhwide, LOriginY, LOriginZ - IZPhdeep]
- ' <PointXYZ [LOriginX + IXPhwide, IYPhigh, LOriginZ + IZPhdeep]
- ' }
- ' ' >>> Select Layers 1, Posts
- ' >SelectLayer
- ' {
- ' <Layer 1
- ' }
- ' ' Set current Material to Cherry
- ' Sys(349) = 5
- ' ' Set current color for Oak Material
- ' Sys(350) = 177
- ' Sys(351) = 76
- ' Sys(352) = 51
- ' ' Apply Current Material and Color to Layers
- ' >ApplyMaterial
- ' {
- ' }
- ' >ApplyColor
- ' {
- ' }
- ' endif
- ' endif
- ' Draw Deck Outline
- ' Deck outline goes on Layer 2
- SYS(3)=2
- SYS$(93) = "Deck_Outline"
- >Box
- {
- <PointXYZ 0,0,0
- <PointRel [IXDwide, 0, IZDdeep]
- }
- ' Set Line for Slice for Truncated Portion
- ' Deck Width / 3
- Ted1 = IXDwide / 3
- ' Deck Depth / 3
- Ted2 = IZDdeep / 3
- >Line
- {
- <PointXYZ [IXDwide - Ted1, 0, IZDdeep]
- <PointXYZ [IXDwide, 0, IZDdeep - Ted2]
- }
- >Line
- {
- <PointXYZ [0, 0, IZDdeep - Ted2]
- <PointXYZ [Ted1, 0, IZDdeep]
- }
- >FitToAllWindow
- {
- }
- ' Select Layer2, Deck Outline
- >SelectLayer
- {
- <Layer 2
- }
- ' Set current Material to Leaves
- Sys(349) = 12
- ' Set current color for Oak Material
- Sys(350) = 107
- Sys(351) = 255
- Sys(352) = 143
- ' Apply Current Material and Color to Layers
- >ApplyMaterial
- {
- }
- >ApplyColor
- {
- }
- '
- ' Update Progress Bar
- Progress 20 100
- '
- ' Draw the Beams
- ' Beams go on Layer 3
- SYS(3)=3
- SYS$(93) = "Beams"
- ' Get Z Starting Point
- ' Z offset - Post Width
- tn1 = IZDover - IXPwide
- '
- ' Loop for Beams Thru Width
- a = 0
- b = 0
- do while a < IXDwide
- ' Draw the 1st Beam
- >Box
- {
- <Pointxyz [a],[IYPhigh],[IZDover - IZPhdeep]
- <PointRel [IXBwide,-IYBhigh, -IZBdepe]
- }
- ' Draw the 2nd Beam
- >Box
- {
- <Pointxyz [a],[IYPhigh],[IZDover + IZPhdeep + IZBdepe]
- <PointRel [IXBwide,-IYBhigh, -IZBdepe]
- }
- a = a + IXBwide
- b = b + 1
- loop
- ' >>> Material List, Beam Width
- att$ = BeamType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [b, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
- >SelectLayer
- {
- <Layer 3
- }
- ' Update Progress Bar
- Progress 25 100
- '
- '
- ' Select Layers 3 and 6
- ' Decking and Beams
- '
- >SelectLayer
- {
- <Layer 3
- <Layer 6
- }
- ' Set current Material to Oak
- Sys(349) = 14
- ' Set current color for Oak Material
- Sys(350) = 255
- Sys(351) = 182
- Sys(352) = 74
- ' Apply Current Material and Color to Layers
- >ApplyMaterial
- {
- }
- >ApplyColor
- {
- }
- ' Not Using Sys(242) to set Handles
- ' Select Objects when Created on
- ' Sys(242) = 1
-
- ' Set the Beam's handle
- >SetHandle
- {
- <PointXYZ [0, IYPhigh, 0]
- }
- ' Array the Beams for Depth
- >Array
- {
- <PointXYZ [0, IYPhigh, IZBdeep]
- <NCopy [NumoBmsZ + 1, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' >>> Material List, Beam Depth
- att$ = BeamType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [NumoBmsZ * 2, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' Update Progress Bar
- Progress 30 100
- ' Section to delete, then redraw beams
- ' Select old beams first
- >SelectLayer
- {
- <Layer 3
- }
- ' Delete beams
- >SelectDelete
- {
- }
- ' Draw the 1st Beam
- >Box
- {
- <Pointxyz 0, [IYPhigh],[IZDover - IZPhdeep]
- <PointRel [IXDwide,-IYBhigh, -IZBdepe]
- }
- ' Draw the 2nd Beam
- >Box
- {
- <Pointxyz 0,[IYPhigh],[IZDover + IZPhdeep + IZBdepe]
- <PointRel [IXDwide,-IYBhigh, -IZBdepe]
- }
- ' Select new beams
- >SelectLayer
- {
- <Layer 3
- }
- ' Set the Beam's handle
- >SetHandle
- {
- <PointXYZ [0, IYPhigh, 0]
- }
- ' Array the Beams for Depth
- >Array
- {
- <PointXYZ [0, IYPhigh, IZBdeep]
- <NCopy [NumoBmsZ + 1, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
- '
- ' Update Progress Bar
- Progress 30 100
- '
- ' Select Layers 3 and 6
- ' Decking and Beams
- '
- >SelectLayer
- {
- <Layer 3
- <Layer 6
- }
- ' Set current Material to Oak
- Sys(349) = 14
- ' Set current color for Oak Material
- Sys(350) = 255
- Sys(351) = 182
- Sys(352) = 74
- ' Apply Current Material and Color to Layers
- >ApplyMaterial
- {
- }
- >ApplyColor
- {
- }
- '
- ' Beams will be Used for Deck Frame to Save on Materials Cost
- ' If neccessary New Variables May be Used in place of Beam Variables Should This Condition Change
- ' Draw the Frame
- ' Frame go on Layer 4
- SYS(3)=5
- SYS$(93) = "Joists"
- ' Loop for Front of Frame Thru Width
- a = 0
- b = 0
- do while a < IXDwide
- ' Draw the Front of Frame
- >Box
- {
- <Pointxyz [a, IYPhigh + IYJhigh, IZBdepe]
- <PointRel [IXBwide,-IYJhigh, -IZBdepe]
- }
- a = a + IXBwide
- b = b + 1
- loop
- ' >>> Material List, Deck Frame Width
- att$ = BeamType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [b, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
-
- >SelectLayer
- {
- <Layer 5
- }
- ' Set the Front Panel's handle
- >SetHandle
- {
- <PointXYZ [0, IYPhigh, 0]
- }
- ' Mirror the Front
- >Mirror
- {
- <PointXYZ [0, IYPhigh + IYJhigh, IZDdeep - IZBdepe]
- <Axis 1
- <Type 1
- }
- ' >>> Material List, Deck Frame Width
- att$ = BeamType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [b, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
-
- ' Loop for Side of Frame Thru Depth
- a = 0
- b = 0
- do while a < IZDdeep
- ' Draw the Side Panel of Frame
- >Box
- {
- <PointXYZ [IXDwide - IZBdepe, IYPhigh + IYJhigh, a + IZBdepe]
- <PointRel [IZBdepe, -IYJhigh, IXBwide]
- }
- a = a + IXBwide
- b = b + 1
- loop
- ' >>> Material List, Deck Frame Depth
- att$ = JoisType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [b, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' Update Progress Bar
- Progress 35 100
- '
- ' Draw the Joists
- ' Joists go on Layer 5
- SYS(3)=5
- SYS$(93) = "Joists"
- ' Draw the First Joist
- a = 0
- ted3 = IZDover - IZBdepe
- KDW1 = IZBdeep * 2
- KDW2 = KDW1 + IZDover
- >Box
- {
- <PointXYZ [0, IYPhigh + IYJhigh, 0]
- <PointRel [IXJwide, -IYJhigh, KDW2]
- }
- ' Loop for 1st Joist
- a = ted3
- a = KDW2
- b = 0
- do while a < IZDdeep
- >Box
- {
- <PointXYZ [0, IYPhigh + IYJhigh, a]
- ' <PointRel [IXJwide, -IYJhigh, IZJdepe]
- <PointRel [IXJwide, -IYJhigh, KDW2 - IZDover]
- }
- b = b + 1
- a = a + KDW1
- loop
- ' Select Layers 4 and 5
- ' Deck Frame and Joists
- >SelectLayer
- {
- <Layer 4
- <Layer 5
- }
- ' Set current Material to Walnut
- Sys(349) = 21
- ' Set current color for Oak Material
- Sys(350) = 177
- Sys(351) = 102
- Sys(352) = 25
- ' Apply Current Material and Color to Layers
- >ApplyMaterial
- {
- }
- >ApplyColor
- {
- }
- ' >>> Material List, Joists, first row
- ' b is one too large, so subtract one
- att$ = JoisType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [b - 1, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
-
- >SelectLayer
- {
- <Layer 5
- }
- ' Set the Joist's handle
- >SetHandle
- {
- <PointXYZ [0, IYPhigh, 0]
- }
- ' Array the Joists for Width
- >Array
- {
- <PointXYZ [IXJcent, IYPhigh, 0]
- NumoJstX = IXDwide / IXJcent
- ' NumoJstX + 1 is Neccessary because DesignCAD Arrays with more than one entity only
- <NCopy [NumoJstX + 1,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' >>> Material List, Joists, array
- ' gets b from above for extreme left row # of Joists, * the array to the right
- att$ = JoisType$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [NumoJstX * b, 0, 0]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' Update Progress Bar
- Progress 40 100
- '
- ' Slice the Back of Deck for Scraps
- >Slice
- {
- <Pointxyz 0, 0, [IZDdeep]
- <Pointxyz [IXDwide], 0, [IZDdeep]
- <Pointxyz [IXDwide], 2, [IZDdeep]
- <Pointxyz [IXDwide], 2, [IZDdeep + 10]
- }
- ' Draw the Decking
- ' Decking goes on Layer 6
- SYS(3)=6
- SYS$(93) = "Decking"
- ' Decking Pattern is Determined by the PointXYZ of the 1st and 2nd Piece of Decking
- ' The Current Pattern is the 1st Piece of the 1st Row Covers up to the 1st Joist
- ' The 1st Piece of the 2nd Row Covers up to the 2nd Joist
- ' While the 1st Piece of the 3rd Row Covers up to the 3rd Joist
-
- ' Draw the 1st Row of Decking
- ' Draw 1st Piece of Decking for 1st Row
- >Box
- {
- <PointXYZ [0, IYPhigh + IYJhigh + IYKhigh, 0]
- <PointRel [IXJcent + IXZJovr, -IYKhigh, IZKdepe]
- }
- ' Loop for First Row of Decking
- a = 0
- b = 0
- ted = IXDwide
- if IXDwide => 20 then
- ted = IXDwide - IXKwide
- endif
- do while a < ted
- ' Draw 2nd Piece of Decking for 1st Row
- >Box
- {
- <PointXYZ [a + IXJcent + IXZJovr + IXZKspc, IYPhigh + IYJhigh + IYKhigh, 0]
- <PointRel [IXKwide, -IYKhigh, IZKdepe]
- }
- if a < IXDwide then
- a = a + IXKwide + IXZKspc
- endif
- b = b + 1
- loop
- ' >>> Material List, Decking, first row
- ' + 1 because we drew a piece of decking outside the loop above first
- att$ = Decking$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [b + 1,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' Remember b for later
- RowOne = b
- ' Update Progress Bar
- Progress 50 100
-
- ' Draw the 2nd Row of Decking
- ' Draw 1st Piece of Decking for 2nd Row
- >Box
- {
- <PointXYZ [0, IYPhigh + IYJhigh + IYKhigh, IZKdepe + IXZKspc]
- <PointRel [2*IXJcent + IXZJovr, -IYKhigh, IZKdepe]
- }
- ' Loop for 2nd Row of Decking
- a = 0
- b = 0
- ted = IXDwide - IXKwide
- do while a < ted
- ' Draw 2nd Piece of Decking for 2nd Row
- >Box
- {
- <PointXYZ [a + 2*IXJcent + IXZJovr + IXZKspc, IYPhigh + IYJhigh + IYKhigh, IZKdepe + IXZKspc]
- <PointRel [IXKwide, -IYKhigh, IZKdepe]
- }
- if a < IXDwide then
- a = a + IXKwide + IXZKspc
- endif
- b = b + 1
- loop
- ' >>> Material List, Decking, first row
- ' + 1 because we drew a piece of decking outside the loop above first
- att$ = Decking$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [b + 1,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' Remember b for later
- RowOne = b
- ' Update Progress Bar
- Progress 50 100
- '
- ' Draw the 3rd Row of Decking
- ' Draw 1st Piece of Decking for 3rd Row
- >Box
- {
- <PointXYZ [0, IYPhigh + IYJhigh + IYKhigh, 2*IZKdepe + 2*IXZKspc]
- <PointRel [3*IXJcent + IXZJovr, -IYKhigh, IZKdepe]
- }
- ' Loop for 3rd Row of Decking
- a = 0
- b = 0
- ted = IXDwide - IXKwide
- do while a < ted
- ' Draw 2nd Piece of Decking for 3rd Row
- >Box
- {
- <PointXYZ [a + 3*IXJcent + IXZJovr + IXZKspc, IYPhigh + IYJhigh + IYKhigh, 2*IZKdepe + 2*IXZKspc]
- <PointRel [IXKwide, -IYKhigh, IZKdepe]
- }
- if a < IXDwide then
- a = a + IXKwide + IXZKspc
- endif
- b = b + 1
- loop
- ' >>> Decking and Beams
- '
- >SelectLayer
- {
- <Layer 6
- }
- ' Set current Material to Oak
- Sys(349) = 14
- ' Set current color for Oak Material
- Sys(350) = 255
- Sys(351) = 182
- Sys(352) = 74
- ' Apply Current Material and Color to Layers
- >ApplyMaterial
- {
- }
- >ApplyColor
- {
- }
- ' >>> Material List, Decking, first row
- ' + 1 because we drew a piece of decking outside the loop above first
- att$ = Decking$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [b + 1,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- ' Remember b for Later
- RowThree = b
- >SelectLayer
- {
- <Layer 6
- }
- ' Set the Decking's handle
- >SetHandle
- {
- <PointXYZ [0, IYPhigh, 0]
- }
- ' Calculate Number of Portions (The 3 Rows that have Been Drawn = 1 Portion) of Decking Needed for Depth
- NumoDckZ = (IZDdeep / (IXZKspc+IZKdepe)) / 3
- ' Array the Decking for Depth
- >Array
- {
- <PointXYZ [0, IYPhigh, 3*IZKdepe + 3*IXZKspc]
- ' NumoDckZ + 1 is Neccessary because DesignCAD Arrays with more than one entity only
- <NCopy [NumoDckZ + 1,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- >FitToAllWindow
- {
- }
- DeckDeep = RowOne + RowTwo + RowThree
- ' >>> Material List, Decking, first row
- ' # of pieces of decking on all 3 rows added together * array #
- att$ = Decking$
- gosub DeckData
- >Array
- {
- <PointXYZ 10, 10, 10
- <NCopy [NumoDckZ * DeckDeep,1,1]
- <AlongCurve 0
- <Perpendicular 0
- }
- '
- ' Update Progress Bar
- Progress 60 100
- '
- ' Turn Edit Current Layer Only Off
- Sys(26) = 0
- '
- ' Deselect everything
- Sys(34) = 0
- '
- ' Joists go on Layer 5
- SYS(3)=5
- SYS$(93) = "Joists"
- ' Slice for Truncating the Corner of Deck
- ' Origional Code used X and Z overhang values for slice,
- ' New Code uses 1/3 of the Deck Width and Depth
- ' >Slice
- ' {
- ' <Pointxyz [IXDwide - IXDover], 0, [IZDdeep]
- ' <Pointxyz [IXDwide], 0, [IZDdeep - IZDover]
- ' <Pointxyz [IXDwide], 2, [IZDdeep - IZDover]
- ' <Pointxyz [IXDwide + 10], 2, [IZDdeep - IZDover]
- ' }
- ' Update Progress Bar
- Progress 70 100
- '
- >Slice
- {
- <Pointxyz [IXDwide - Ted1], 0, [IZDdeep]
- <Pointxyz [IXDwide], 0, [IZDdeep - Ted2]
- <Pointxyz [IXDwide], 2, [IZDdeep - Ted2]
- <Pointxyz [IXDwide + 10], 2, [IZDdeep - Ted2]
- }
- ' Slice the left side of the deck
- >Slice
- {
- <Pointxyz 0, 0, [IZDdeep - Ted2]
- <Pointxyz [Ted1], 0, [IZDdeep]
- <Pointxyz 0, 2, [IZDdeep - Ted2]
- <Pointxyz 0, 2, [IZDdeep + 3]
- }
- ' Update Progress Bar
- Progress 80 100
- '
- ' Slice the Right Side of Deck for Scraps
- >Slice
- {
- <Pointxyz [IXDwide], 0, 0
- <Pointxyz [IXDwide], 0, [IZDdeep]
- <Pointxyz [IXDwide], 2, [IZDdeep]
- <Pointxyz [IXDwide + 10], 2, [IZDdeep]
- }
- ' Update Progress Bar
- Progress 90 100
- '
- ' Slice the Back of Deck for Scraps
- >Slice
- {
- <Pointxyz 0, 0, [IZDdeep]
- <Pointxyz [IXDwide], 0, [IZDdeep]
- <Pointxyz [IXDwide], 2, [IZDdeep]
- <Pointxyz [IXDwide], 2, [IZDdeep + 10]
- }
- ' Section to Cap off Slice
- ' ps1 = IYDhigh
- ' gosub status
- ' ps1 = IYBhigh
- ' gosub status
- >Wall
- {
- <thick 0.5
- <Pointxyz [IXDwide - Ted1], [IYPhigh], [IZDdeep]
- <Pointrel [Ted1], [IYJhigh], [- Ted2]
- }
- ' Caps off the right slice
- >Wall
- {
- <thick 0.5
- <Pointxyz [Ted1], [IYPhigh], [IZDdeep]
- <Pointrel [-Ted1], [IYJhigh], [-Ted2]
- }
- ' Select Layers 4 and 5
- ' Deck Frame and Joists
- >SelectLayer
- {
- <Layer 4
- <Layer 5
- }
- ' Set current Material to Walnut
- Sys(349) = 21
- ' Set current color for Oak Material
- Sys(350) = 177
- Sys(351) = 102
- Sys(352) = 25
- ' Apply Current Material and Color to Layers
- >ApplyMaterial
- {
- }
- >ApplyColor
- {
- }
- ' Slice ALWAYS get's turned around so the slice faces the user
- >SelectAll
- {
- }
- >SetHandle
- {
- <PointXYZ [0, IYPhigh, 0]
- }
- >Mirror
- {
- <PointXYZ [0, IYPhigh, IZDdeep]
- <Axis 2
- <Type 0
- }
- ' Section to add Post support for each sliced beam
- ' Hide all Layers up to 12
- For a = 1 to 12
- Layer(a) = 0
- next a
- ' Make Layer 13 Current
- Layer(13) = 14
- ' Deck Width / 3
- Ted1 = IXDwide / 3
- ' Deck Depth / 3
- Ted2 = IZDdeep / 3
- >Line
- {
- <PointXYZ [IXDwide - Ted1, 0, 0]
- <PointXYZ [IXDwide, 0, 0 + Ted2]
- }
- ' Left slice line
- >Line
- {
- <PointXYZ [0, 0, 0 + Ted2]
- <PointXYZ [Ted1, 0, 0]
- }
- ' Variables used in loop
- CurCount = IZDover
- MaxCount = Ted2
- b = 1
- Do while CurCount <= MaxCount
- ' Make Layer 13 Current
- Layer(13) = 14
- ' Draw First Guide Line
- >Line
- {
- <PointXYZ [0, 0, CurCount]
- <PointXYZ [IXDwide, 0, CurCount]
- }
- ' Select Objects when Created
- Sys(242) = 1
- ' Draw a pointmark at intersection
- >PointMark
- {
- <Type 3
- <Size 4
- <Int2 0, 0, [CurCount], [IXDwide - Ted1], 0, 0
- }
- ' Get the Entity ID of the pointmark
- getselect 1, a
- ' Load the pointmark into memory
- entity a
- ' Get the XYZ value of the pointmark
- for j = 1 to sys(1)
- pointval jx jy jz j
- next j
- '
- ' Take about a foot away for safety
- jx = jx - 16
- ' Make Layer 14 Current
- Layer(14) = 14
- SYS$(93) = "Support Posts"
- ' Draw Support Post
- >Box
- {
- <PointXYZ [jx+IXPwide], 0, [jz+IZPhdeep]
- <Pointrel [-IXPwide], [IYPhigh], [-IXPwide]
- }
- ' Increment Counters
- CurCount = CurCount + IZBdeep
- b = b + 1
- Loop
- ' Show all Layers up to 12
- For a = 1 to 12
- Layer(a) = 6
- next a
- ' Clean up Layer 13
- >SelectLayer
- {
- <Layer 13
- }
- ' Delete contents of that layer
- >SelectDelete
- {
- }
- ' Select Layer 14
- >SelectLayer
- {
- <Layer 14
- }
- ' Set it's handle
- >SetHandle
- {
- <Pointxyz [IXDwide / 2], 0, 0
- <Pointxyz [IXDwide / 2], 0, 0
- <Pointxyz [IXDwide / 2], 0, 0
- }
- ' Mirror Support Posts
- >Mirror
- {
- <axis 0
- <type 1
- <Pointxyz [IXDwide / 2], 0, 0
- }
- ' Turn Select Object when Created Off
- Sys(242) = 0
- ' Show entire deck
- >FitToAllWindow
- {
- }
- ' De-select the mirrored support posts
- >PointSelect
- {
- <Type 0
- <pointxyz -199, -199, -199
- }
- ' If user chose Deck Type that needs slice running on the
- ' left side . . .
- If Dvalue = 1 Then
- >FitToAllWindow
- {
- }
- Else
- >SelectAll
- {
- }
- >SetHandle
- {
- <PointXYZ [0, IYPhigh, 0]
- }
- >Mirror
- {
- <PointXYZ [0, IYPhigh, IZDdeep]
- <Axis 0
- <Type 0
- }
- ' Deselect everything
- Sys(34) = 0
- >FitToAllWindow
- {
- }
-
-
-
- End If
- ' Turn off Silent Mode
- Sys(36) = 0
- >PointSelect
- {
- <PointXYZ -34,-43,-32
- }
- '
- ' Deselect everything
- Sys(34) = 0
- ' Update Progress Bar
- Progress 99 100
- '
- ' Set Units back to feet so when users dimension the deck it comes up in feet, not inches
- ' Get Min and Max X Values for drawing
- MinX = Sys(120)
- MaxX = Sys(122)
- ' Use Units command to change deck drawing scale
- ' Deck Inches / 12 to get # of feet to set units to
- Ted = IXDwide / 12
- >Units
- {
- <pointxyz [MinX], 0, 0
- <pointxyz [MaxX], 0, 0
- <length [FXDwide]
- }
- if Shade = 0 then
- for a = 0 to 3
- Sys(71) = a
- Sys(2) = 0
- next a
- endif
- if Shade = 1 then
- for a = 0 to 3
- Sys(71) = a
- Sys(2) = 1
- next a
- endif
- if Shade = 2 then
- >ShadeView
- {
- <ShowLine 0
- <ShowArrow 1
- <ShowDim 1
- <ShowText 0
- }
- endif
- Sys(71) = 1
- ' Set current color back to black
- Sys(350) = 0
- Sys(351) = 0
- Sys(352) = 0
- ' Apply Current Color
- >ApplyColor
- {
- }
- ' Turn off Progress Bar
- Progress 0
- Layer(15) = 0 ' Turn off Layer 15
- '
- ' End of Program
- ' Do NOT display Attribs
- Sys(21) = 0
- ' Set Dimension Format to fractional
- Sys(101) = 3
- ' Set Text Size large for users
- if FXDwide > IZDdeep then
- KDW6 = FXDwide / 50
- else
- KDW6 = FZDdeep / 50
- end if
- Sys(438) = KDW6
- KDW7 = KDW6 *.50
- ' Make a Dimension with the NULL paramater to set Dimension settings which don't
- ' have a SYS function, and which use cryptic # values in the INI file.
- ' Pass a NULL to not actually draw a dimension, but it's settings
- ' remain sticky for each dimension you place in that session of Dcad.
- '
- >Dimension
- {
- <Color 0,0,0
- <Layer 1
- <PointXYZ -16.8023,-2.2529,0.0000
- <PointXYZ 9.1748,-5.0914,0.0000
- <PointXYZ 6.8080,7.6270,0.0000
- <Axis 0
- <Orientation 0
- <Precision 3
- <Location 0
- <ToleranceType 0
- <ToleranceSize 0.5000
- <ToleranceLow -0.01
- <ToleranceHigh +0.01
- <Tolerance 0.01
- <Suffix "0"
- <Prefix "0"
- <Type 0
- <Size [KDW7]
- <Fix 0
- <Gap 1.0000
- <Length 2.0000
- <OverShoot 0.5000
- <LinePosition 0
- <NULL
- }
- '
- End
- '
- ' Routine to display values on the Status Bar
- Status:
- ps2 = ps1 / 12
- ps3 = ps1 * 12
- ' Display Results
- ps$ = " Value Passed = ",ps1," Value Divided by 12 = ",ps2," Value Multiplied by 12 = ",ps3
- Message ps$
- Return
- '
- ' Routine to add Deck Data Items to the drawing
- DeckData:
- ' Turn Select Object when Created Off
- Sys(242) = 1
- ' Save Current Layer
- CurLay = SYS(3)
- ' Set Current Layer to 15
- SYS(3) = 15
- SYS$(93) = "Attributes"
- ' Write Attribute
- >Attribute
- {
- <Color 0,0,0
- <PointXYZ 10, 10, 10
- <Style 0
- <Justification 0
- <Size .005
- <Font "Arial"
- <Text [att$]
- }
- ' Set Layer's Back
- SYS(3) = CurLay
- ' Turn Select Object when Created Off
- Sys(242) = 0
- Return