1
1
Sub DrawPlan()
''****Read Input****
Dim SectionCoord(0 To 9) As Double
''Point 1
SectionCoord(0) = 0: SectionCoord(1) = 0
''Point 2
SectionCoord(2) = ActiveSheet.Range("f5").Value: SectionCoord(3) = 0
''Point 3
SectionCoord(4) = ActiveSheet.Range("f5").Value: SectionCoord(5) =
ActiveSheet.Range("f6").Value
''Point 4
SectionCoord(6) = 0: SectionCoord(7) = ActiveSheet.Range("f6").Value
''Point 1 again to close the polyline
SectionCoord(8) = 0: SectionCoord(9) = 0
''****Draw rectangle****
Dim Rectang As Object
On Error Resume Next
Set ActDoc = AutocadApp.ActiveDocument
On Error GoTo 0
' offset
Dim OffsetRect As Variant
Dim Cover As Integer
Dim Stirrup As Object
Cover = ActiveSheet.Range("f14")
OffsetRect = Rectang.Offset(-Cover)
Set Stirrup = OffsetRect(0)
Stirrup.constantwidth = 5
Stirrup.Color = acGreen
'comman
''***Bottom rebar*****
Dim BottomBar As Integer
Dim Nbrbotbar As Integer
Dim Botsize As Integer
Dim Marray(0) As Object
Nbrbotbar = ActiveSheet.Range("f10")
Botsize = ActiveSheet.Range("f11")
For i = 1 To Nbrbotbar
If i = 1 Then
centerCircle(0) = (Cover + Botsize / 2 + 5): centerCircle(1) = (Cover +
Botsize / 2 + 5)
Else
centerCircle(0) = (Cover + Botsize / 2 + 5 + Spacing * (i - 1)):
centerCircle(1) = (Cover + Botsize / 2 + 5)
End If
CirObj.Color = acRed
With FilledCir
.appendouterloop (Marray)
.Evaluate
.Color = acRed
.Update
End With
Next i
''***Top rebar*****
Dim Topbar As Integer
Dim Nbrtopbar As Integer
Dim Topsize As Integer
Nbrtopbar = ActiveSheet.Range("f8")
Topsize = ActiveSheet.Range("f9")
For i = 1 To Nbrtopbar
If i = 1 Then
centerCircle(0) = (Cover + Topsize / 2 + 5): centerCircle(1) =
(ActiveSheet.Range("F6") - Cover - Botsize / 2 - 5)
Else
centerCircle(0) = (Cover + Topsize / 2 + 5 + Spacing * (i - 1)):
centerCircle(1) = (ActiveSheet.Range("F6") - Cover - Topsize / 2 - 5)
End If
CirObj.Color = acRed
With FilledCir
.appendouterloop (Marray)
.Evaluate
.Color = acRed
.Update
End With
Next i
'Midbar
Dim midbar As Integer
Dim Midsize As Integer
midbar = ActiveSheet.Range("f12")
Midsize = ActiveSheet.Range("f13")
Set FilledCir =
ActDoc.modelspace.addhatch(acHatchPatternTypePreDefined, "Solid", True)
With FilledCir
.appendouterloop (Marray)
.Evaluate
.Color = acRed
.Update
End With
Set FilledCir =
ActDoc.modelspace.addhatch(acHatchPatternTypePreDefined, "Solid", True)
With FilledCir
.appendouterloop (Marray)
.Evaluate
.Color = acRed
.Update
End With
End If
AutocadApp.ZoomExtents
End Sub