Sei sulla pagina 1di 16

Sub Superstructure()

' this macro draws sectional elevation and plan of superstructure


Dim NosLines, NosLinesplan As Integer
Dim lineObj As AcadLine
Dim counter, No_of_spans As Integer
Set myExcel = GetObject(, "Excel.Application")
filepath = "C:\DATA\New folder\GADcircularpierboxabutment.xls"
myExcel.Workbooks.Open (filepath)
Set myWorksheet = myExcel.Worksheets("superstructure")

'myWorksheet.Range("X1") = "Get Range"


myExcel.Visible = True
'Set myRange = myExcel.InputBox( _
'Prompt:="Select a range of cells", _
'Title:="Select Row", _
'Type:=8)
'CurRow = myRange.Row
'CurCol = myRange.Column
'MsgBox ("You selected Row " + CStr(CurRow))
'MsgBox ("You selected Column " + CStr(CurCol))
'myWorksheet.Range("X2") = "Row " + CStr(myRange.Row)
NosLines = myWorksheet.Range("b2")
MsgBox ("No. of lines to be drawn are " + CStr(NosLines))
'noArrayElem = 3 * NosLines
'MsgBox ("No. of array elements " + CStr(noArrayElem))
ReDim StartPoint(0 To 2) As Double
ReDim EndPoint(0 To 2) As Double
Dim newlayer As AcadLayer
Dim layColor As AcadAcCmColor
Set newlayer = ThisDrawing.Layers.Add("drawing")
ThisDrawing.ActiveLayer = newlayer
'Dim col As New AcadAcCmColor
' col.ColorMethod = AutoCAD.acColorMethodForeground
' Set the layer to the color
' Set layColor = _
AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
' Call layColor.SetRGB(122, 199, 25)
' ThisDrawing.ActiveLayer.TrueColor = layColor
' col.ColorMethod = AutoCAD.acColorMethodByLayer
No_of_spans = myWorksheet.Range("p18")
'No_of_spans = InputBox(Message, Title, Default)
MsgBox ("No_of_spans " + CStr(No_of_spans))
Length_of_spans = myWorksheet.Range("p12")
MsgBox ("Length of spans " + CStr(Length_of_spans))
countery = 0
For y = 1 To No_of_spans
'MsgBox ("countery " + CStr(countery))
counterx = 0
For x = 1 To NosLines
CurrRow = 4
CurrCol = 1
'MsgBox (" counter is " + CStr(counter))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol).Value +
countery: _
'MsgBox ("xcord1 " + CStr(StartPoint(0)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol))
StartPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 1).Value: _
'MsgBox ("ycord1 " + CStr(StartPoint(1)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 1))
StartPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 2).Value
'MsgBox ("zcord1 " + CStr(StartPoint(2)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 2))
EndPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 3).Value +
countery: _
'MsgBox ("xcord2 " + CStr(EndPoint(0)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 3))
EndPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 4).Value: _
'MsgBox ("ycord2 " + CStr(EndPoint(1)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 4))
EndPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 5).Value
'MsgBox ("zcord2 " + CStr(EndPoint(2)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 5))
'startPoint(1) = x1: startPoint(2) = y1: startPoint(2) = z1
'endPoint(0) = x2: endPoint(1) = y2: endPoint(2) = z2
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Linetype = "continuous"
lineObj.Update
counterx = counterx + 1
Next x
countery = countery + Length_of_spans
'MsgBox ("countery " + CStr(countery))
Next y

ReDim StartPoint(0 To 2) As Double


ReDim EndPoint(0 To 2) As Double

If (Abs(No_of_spans / 2) > Int(No_of_spans / 2)) Then


NosLinesplan = myWorksheet.Range("b97")
MsgBox ("No. of lines to be drawn in plan are " + CStr(NosLinesplan))
countery1 = 0
No_of_spans1 = Int(No_of_spans / 2)
For y = 1 To No_of_spans1
MsgBox ("countery " + CStr(countery1))
counterxx = 0
For x = 1 To NosLinesplan
CurrRow = 99
CurrCol = 1
MsgBox (" countery is " + CStr(countery1))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterxx, CurrCol).Value +
countery1: _
StartPoint(1) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 1).Value: _
StartPoint(2) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 2).Value
EndPoint(0) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 3).Value +
countery1: _
EndPoint(1) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 4).Value: _
EndPoint(2) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 5).Value
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Linetype = "continuous"
lineObj.Update
counterxx = counterxx + 1
Next x
countery1 = countery1 + Length_of_spans
'MsgBox ("countery " + CStr(countery))
Next y
NosLinesplan1 = myWorksheet.Range("b104")
MsgBox ("No. of lines to be drawn in plan are " + CStr(NosLinesplan1))
ReDim StartPoint(0 To 2) As Double
ReDim EndPoint(0 To 2) As Double
counterxx = 0
For x = 1 To NosLinesplan
CurrRow = 105
CurrCol = 1
MsgBox (" countery is " + CStr(countery1))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterxx, CurrCol).Value: _
StartPoint(1) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 1).Value: _
StartPoint(2) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 2).Value
EndPoint(0) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 3).Value: _
EndPoint(1) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 4).Value: _
EndPoint(2) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 5).Value
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Linetype = "continuous"
lineObj.Update
counterxx = counterxx + 1
Next x
Else

NosLinesplan = myWorksheet.Range("b97")
MsgBox ("No. of lines to be drawn in plan are " + CStr(NosLinesplan))
countery1 = 0
No_of_spans1 = Int(No_of_spans / 2)
For y = 1 To No_of_spans1
MsgBox ("countery " + CStr(countery1))
counterxx = 0
For x = 1 To NosLinesplan
CurrRow = 99
CurrCol = 1
MsgBox (" countery is " + CStr(countery1))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterxx, CurrCol).Value +
countery1: _
StartPoint(1) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 1).Value: _
StartPoint(2) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 2).Value
EndPoint(0) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 3).Value +
countery1: _
EndPoint(1) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 4).Value: _
EndPoint(2) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 5).Value
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Linetype = "continuous"
lineObj.Update
counterxx = counterxx + 1
Next x
countery1 = countery1 + Length_of_spans
'MsgBox ("countery " + CStr(countery))
Next y
End If
End Sub

Private Function Example1_AddLine(x1, y1, z1, x2, y2, z2, NosLines, noArrayElem) As
AcadLine
' This example adds a line in model space
Dim lineObj1 As AcadLine
'Dim startPoint(1 To 18) As Double
'Dim endPoint(1 To 18) As Double
'Dim x1 As Double
'Dim y1 As Double
'Dim z1 As Double
'Dim x2 As Double
'Dim y2 As Double
'Dim z2 As Double
'Define the start and end points for the line
ReDim StartPoint(1 To NosLines * 2) As Double
ReDim EndPoint(1 To NosLines * 2) As Double
StartPoint(1) = x1: StartPoint(2) = y1: StartPoint(2) = z1
'MsgBox (" start point" + CStr(startPoint(0)))
EndPoint(0) = x2: EndPoint(1) = y2: EndPoint(2) = z2
'Create the line in model space
Set lineObj1 = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
ZoomAll
End Function
Sub Ch5_CreateLinearDimension()
Dim dimObj As AcadDimAligned
Dim dimObj1 As AcadDimRotated
Dim objDimstyle As AcadDimStyle
Dim NosLines As Integer
Dim lineObj As AcadLine
Dim counter As Integer
Dim StartPoint(0 To 2) As Double
Dim EndPoint(0 To 2) As Double
Dim TextPosition(0 To 2) As Double
Set objDimstyle = ThisDrawing.DimStyles.Add("manish")
Set myExcel = GetObject(, "Excel.Application")
filepath = "f:\piercap.xls"
myExcel.Workbooks.Open (filepath)
Set myWorksheet = myExcel.Worksheets("Sheet4")
myExcel.Visible = True
NosLines = myWorksheet.Range("b2")
counter = 0
For x = 1 To NosLines
CurrRow = 4
CurrCol = 1
StartPoint(0) = myWorksheet.Cells(CurrRow + counter, CurrCol).Value: _
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 5))
StartPoint(0) = myWorksheet.Cells(CurrRow + counter, CurrCol).Value: _
StartPoint(1) = myWorksheet.Cells(CurrRow + counter, CurrCol + 1).Value: _
StartPoint(2) = myWorksheet.Cells(CurrRow + counter, CurrCol + 2).Value
EndPoint(0) = myWorksheet.Cells(CurrRow + counter, CurrCol + 3).Value: _
EndPoint(1) = myWorksheet.Cells(CurrRow + counter, CurrCol + 4).Value: _
EndPoint(2) = myWorksheet.Cells(CurrRow + counter, CurrCol + 5).Value
'MsgBox ("current row " + CStr(CurrRow + counter + 6))
TextPosition(0) = myWorksheet.Cells(CurrRow + counter, CurrCol + 6).Value: _
TextPosition(1) = myWorksheet.Cells(CurrRow + counter, CurrCol + 7).Value: _
TextPosition(2) = myWorksheet.Cells(CurrRow + counter, CurrCol + 8).Value
MsgBox ("current row " + CStr(CurrRow + counter))
MsgBox ("current col " + CStr(CurrCol + 6))
MsgBox ("current col " + CStr(CurrCol + 7))
MsgBox ("current col " + CStr(CurrCol + 8))
'If myWorksheet.cells(CurrRow + counter, CurrCol).Value _
' <> myWorksheet.cells(CurrRow + counter, CurrCol + 3).Value Then
Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(StartPoint, EndPoint,
TextPosition)
' Else
' Set dimObj1 = ThisDrawing.ModelSpace.AddDimRotated _
' (StartPoint, EndPoint, TextPosition, 45)
' dimObj.StyleNames = objDimstyle
'End If
counter = counter + 1
Next x
ZoomAll
End Sub
Sub Ch4_CreateMText()
Dim mtextObj As AcadMText
Dim insertPoint(0 To 2) As Double
Dim width As Double
Dim textString As String

insertPoint(0) = 2
insertPoint(1) = 2
insertPoint(2) = 0
width = 4
' textString = "This is a text string for the mtext object."
textString = "hello."
' Create a text Object in model space
Set mtextObj = ThisDrawing.ModelSpace. _
AddMText(insertPoint, width, textString)
ZoomAll
End Sub
Sub Example_AddLeader()
' This example creates a leader in model space.
' The leader is not attached to any annotation object
' in this example.

Dim leaderObj As AcadLeader


Dim points(0 To 8) As Double
Dim leaderType As Integer
Dim annotationObject As AcadObject

points(0) = 0: points(1) = 0: points(2) = 0


points(3) = 4: points(4) = 4: points(5) = 0
points(6) = 4: points(7) = 5: points(8) = 0
leaderType = acLineWithArrow
Set annotationObject = Nothing
' Create the leader object in model space
Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, annotationObject,
leaderType)
ZoomAll

End Sub
Sub Ch5_CreateMText()
Dim mtextObj As AcadMText
Dim insertPoint(0 To 2) As Double
Dim width As Double
Dim MyValue As String
Dim textString As String
Dim counter As Integer
Dim colcounter As Integer
Set myExcel = GetObject(, "Excel.Application")
filepath = "f:\piercap.xls"
myExcel.Workbooks.Open (filepath)
Set myWorksheet = myExcel.Worksheets("Sheet2")
'myWorksheet.Range("X1") = "Get Range"
myExcel.Visible = True
NosLines = myWorksheet.Range("b2")
MsgBox (" NosLines " + CStr(NosLines))
counter = 0
colcounter = 0
For y = 1 To 9
For x = 1 To NosLines
CurrRow = 3 + counter
CurrCol = 1 + colcounter
currpointx = 1 + colcounter * width
currpointy = 1 - counter
currpointz = 0
'MsgBox (" counter is " + CStr(counter))
insertPoint(0) = currpointx
'MsgBox ("xcord1 " + CStr(currpointx))
insertPoint(1) = currpointy
'MsgBox ("ycord1 " + CStr(currpointy))
insertPoint(2) = currpointz
'MsgBox ("xcord1 " + CStr(currpointz))
width = 4
MyValue = myWorksheet.Cells(CurrRow, CurrCol).Value
textString = Str(MyValue)
'MsgBox ("text is" + CStr(textString))
Set mtextObj = ThisDrawing.ModelSpace. _
AddMText(insertPoint, width, textString)
counter = counter + 1
Next x
counter = 0
colcounter = colcounter + 1
Next y
ZoomAll
End Sub
Sub Ch10_InsertingABlock()
' Define the block
Dim blockObj As AcadBlock
Dim insertionPnt(0 To 2) As Double
insertionPnt(0) = 0
insertionPnt(1) = 0
insertionPnt(2) = 0
Set blockObj = ThisDrawing.Blocks.Add _
(insertionPnt, "CircleBlock")

' Add a circle to the block


Dim circleObj As AcadCircle
Dim center(0 To 2) As Double
Dim radius As Double
center(0) = 0
center(1) = 0
center(2) = 0
radius = 1
Set circleObj = blockObj.AddCircle(center, radius)

' Insert the block


Dim blockRefObj As AcadBlockReference
insertionPnt(0) = 2
insertionPnt(1) = 2
insertionPnt(2) = 0
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock _
(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
ZoomAll
MsgBox "The circle belongs to " & blockRefObj.ObjectName
End Sub
Public Sub pier()
' this macro draws sectional elevation and plan of piers and footing
Dim NosLines As Integer
Dim lineObj As AcadLine
Dim CirObj As AcadArc
Dim counter, No_of_spans As Integer
Dim StartAngle, EndAngle As Double
Set myExcel = GetObject(, "Excel.Application")
filepath = "C:\DATA\New folder\GADcircularpierboxabutment.xls"
myExcel.Workbooks.Open (filepath)
Set myWorksheet = myExcel.Worksheets("superstructure")
'myWorksheet.Range("X1") = "Get Range"
myExcel.Visible = True
'Set myRange = myExcel.InputBox( _
'Prompt:="Select a range of cells", _
'Title:="Select Row", _
'Type:=8)
'CurRow = myRange.Row
'CurCol = myRange.Column
'MsgBox ("You selected Row " + CStr(CurRow))
'MsgBox ("You selected Column " + CStr(CurCol))
'myWorksheet.Range("X2") = "Row " + CStr(myRange.Row)
NosLines = myWorksheet.Range("b10")
MsgBox ("No. of lines to be drawn are " + CStr(NosLines))
'noArrayElem = 3 * NosLines
'MsgBox ("No. of array elements " + CStr(noArrayElem))
ReDim StartPoint(0 To 2) As Double
ReDim EndPoint(0 To 2) As Double
Dim newlayer As AcadLayer
Dim layColor As AcadAcCmColor
Set newlayer = ThisDrawing.Layers.Add("drawing")
ThisDrawing.ActiveLayer = newlayer
'Dim col As New AcadAcCmColor
' col.ColorMethod = AutoCAD.acColorMethodForeground
' Set the layer to the color
' Set layColor = _AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
' Call layColor.SetRGB(122, 199, 25)
' ThisDrawing.ActiveLayer.TrueColor = layColor
' col.ColorMethod = AutoCAD.acColorMethodByLayer
No_of_spans = myWorksheet.Range("p18")
'No_of_spans = InputBox(Message, Title, Default)
MsgBox ("No_of_spans " + CStr(No_of_spans))
Length_of_spans = myWorksheet.Range("p12")
MsgBox ("Length of spans " + CStr(Length_of_spans))
countery = 0
For y = 1 To No_of_spans - 1
'MsgBox ("countery " + CStr(countery))
counterx = 0
For x = 1 To NosLines
CurrRow = 12
CurrCol = 1
'MsgBox (" counter is " + CStr(counter))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol).Value +
countery: _
'MsgBox ("xcord1 " + CStr(StartPoint(0)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol))
StartPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 1).Value: _
'MsgBox ("ycord1 " + CStr(StartPoint(1)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 1))
StartPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 2).Value
'MsgBox ("zcord1 " + CStr(StartPoint(2)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 2))
EndPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 3).Value +
countery: _
'MsgBox ("xcord2 " + CStr(EndPoint(0)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 3))
EndPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 4).Value: _
'MsgBox ("ycord2 " + CStr(EndPoint(1)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 4))
EndPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 5).Value
'MsgBox ("zcord2 " + CStr(EndPoint(2)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 5))
'startPoint(1) = x1: startPoint(2) = y1: startPoint(2) = z1
'endPoint(0) = x2: endPoint(1) = y2: endPoint(2) = z2
'RetVal = object.AddArc(Center, Radius, StartAngle, EndAngle)
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Update
counterx = counterx + 1
Next x
countery = countery + Length_of_spans
'MsgBox ("countery " + CStr(countery))
Next y

End Sub
Public Sub pierplan()
' this macro draws sectional elevation and plan of piers and footing
Dim NosLines As Integer
Dim lineObj As AcadLine
Dim CirObj As AcadArc
Dim counter, No_of_spans As Integer
Dim StartAngle, EndAngle As Double
Set myExcel = GetObject(, "Excel.Application")
filepath = "C:\DATA\New folder\GADcircularpierboxabutment.xls"
myExcel.Workbooks.Open (filepath)
Set myWorksheet = myExcel.Worksheets("superstructure")
'myWorksheet.Range("X1") = "Get Range"
myExcel.Visible = True
ReDim StartPoint(0 To 2) As Double
ReDim EndPoint(0 To 2) As Double
Dim newlayer As AcadLayer
Dim layColor As AcadAcCmColor
Set newlayer = ThisDrawing.Layers.Add("drawing")
ThisDrawing.ActiveLayer = newlayer
'Dim col As New AcadAcCmColor
' col.ColorMethod = AutoCAD.acColorMethodForeground
' Set the layer to the color
' Set layColor = _AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
' Call layColor.SetRGB(122, 199, 25)
' ThisDrawing.ActiveLayer.TrueColor = layColor
' col.ColorMethod = AutoCAD.acColorMethodByLayer
No_of_spans = myWorksheet.Range("p18")
'No_of_spans = InputBox(Message, Title, Default)
MsgBox ("No_of_spans " + CStr(No_of_spans))
Length_of_spans = myWorksheet.Range("p12")
MsgBox ("Length of spans " + CStr(Length_of_spans))

ReDim StartPoint(0 To 2) As Double


ReDim EndPoint(0 To 2) As Double
ReDim CenterPoint(0 To 2) As Double
' else loop for odd no of spans starts here
If (Abs(No_of_spans / 2) > Int(No_of_spans / 2)) Then
NosLinesplan = myWorksheet.Range("b110")
MsgBox ("No. of lines to be drawn in plan are " + CStr(NosLinesplan))
Noscirclesplan = myWorksheet.Range("b127")
MsgBox ("No. of circles to be drawn in plan are " + CStr(Noscirclesplan))
countery1 = 0
counterz1 = 0
No_of_spans1 = Int(No_of_spans / 2)
For y = 1 To No_of_spans1
MsgBox ("countery " + CStr(countery1))
counterx = 0
For x = 1 To NosLinesplan
CurrRow = 112
CurrCol = 1
MsgBox (" countery is " + CStr(countery1))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol).Value +
countery1: _
StartPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 1).Value: _
StartPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 2).Value
EndPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 3).Value +
countery1: _
EndPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 4).Value: _
EndPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 5).Value
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Linetype = "continuous"
lineObj.Update
counterx = counterx + 1
Next x
countery1 = countery1 + Length_of_spans
' loop for circular pier notch
counterz = 0
For z = 1 To Noscirclesplan
CurrRow = 129
CurrCol = 1
MsgBox (" counterz is " + CStr(counterz1))
CenterPoint(0) = myWorksheet.Cells(CurrRow + counterz, CurrCol).Value +
counterz1: _
CenterPoint(1) = myWorksheet.Cells(CurrRow + counterz, CurrCol + 1).Value: _
CenterPoint(2) = myWorksheet.Cells(CurrRow + counterz, CurrCol + 2).Value
radius = myWorksheet.Cells(CurrRow + counterz, CurrCol + 3).Value
StartAngle = myWorksheet.Cells(CurrRow + counterz, CurrCol + 4).Value
EndAngle = myWorksheet.Cells(CurrRow + counterz, CurrCol + 5).Value
Set CirObj = ThisDrawing.ModelSpace.AddArc(CenterPoint, radius, StartAngle,
EndAngle)
CirObj.Layer = "drawing"
CirObj.color = acCyan
CirObj.Lineweight = acLnWt035
CirObj.LinetypeScale = 0.25
CirObj.Linetype = "continuous"
CirObj.Update
counterz = counterz + 1
Next z
counterz1 = counterz1 + Length_of_spans
MsgBox ("counterz " + CStr(counterz1))
Next y
' else loop for even no of spans starts here
Else
NosLinesplan = myWorksheet.Range("b110")
MsgBox ("No. of lines to be drawn in plan are " + CStr(NosLinesplan))
Noscirclesplan = myWorksheet.Range("b127")
MsgBox ("No. of circles to be drawn in plan are " + CStr(Noscirclesplan))
countery1 = 0
counterz1 = 0
No_of_spans1 = Int(No_of_spans / 2)
For y = 1 To No_of_spans1 - 1
MsgBox ("countery " + CStr(countery1))
counterx = 0
For x = 1 To NosLinesplan
CurrRow = 112
CurrCol = 1
MsgBox (" countery is " + CStr(countery1))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol).Value +
countery1: _
StartPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 1).Value: _
StartPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 2).Value
EndPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 3).Value +
countery1: _
EndPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 4).Value: _
EndPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 5).Value
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Linetype = "continuous"
lineObj.Update
counterx = counterx + 1
Next x
countery1 = countery1 + Length_of_spans
' loop for circular pier notch
counterz = 0
For z = 1 To Noscirclesplan
CurrRow = 129
CurrCol = 1
MsgBox (" counterz is " + CStr(counterz1))
CenterPoint(0) = myWorksheet.Cells(CurrRow + counterz, CurrCol).Value +
counterz1: _
CenterPoint(1) = myWorksheet.Cells(CurrRow + counterz, CurrCol + 1).Value: _
CenterPoint(2) = myWorksheet.Cells(CurrRow + counterz, CurrCol + 2).Value
radius = myWorksheet.Cells(CurrRow + counterz, CurrCol + 3).Value
StartAngle = myWorksheet.Cells(CurrRow + counterz, CurrCol + 4).Value
EndAngle = myWorksheet.Cells(CurrRow + counterz, CurrCol + 5).Value
Set CirObj = ThisDrawing.ModelSpace.AddArc(CenterPoint, radius, StartAngle,
EndAngle)
CirObj.Layer = "drawing"
CirObj.color = acCyan
CirObj.Lineweight = acLnWt035
CirObj.LinetypeScale = 0.25
CirObj.Linetype = "continuous"
CirObj.Update
counterz = counterz + 1
Next z
counterz1 = counterz1 + Length_of_spans
MsgBox ("counterz " + CStr(counterz1))
Next y
'
' drawing
'
Dim NosLinesplan1, NosLinesplan2, Noscirclesplan1, Noscirclesplan2 As Integer
NosLinesplan1 = myWorksheet.Range("b133")
MsgBox ("No. of lines to be drawn in plan are " + CStr(NosLinesplan1))
ReDim StartPoint(0 To 2) As Double
ReDim EndPoint(0 To 2) As Double
ReDim CenterPoint(0 To 2) As Double
counterxx = 0
For x = 1 To NosLinesplan1
CurrRow = 134
CurrCol = 1
MsgBox (" countery is " + CStr(countery1))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterxx, CurrCol).Value: _
StartPoint(1) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 1).Value: _
StartPoint(2) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 2).Value
EndPoint(0) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 3).Value: _
EndPoint(1) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 4).Value: _
EndPoint(2) = myWorksheet.Cells(CurrRow + counterxx, CurrCol + 5).Value
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Linetype = "continuous"
lineObj.Update
counterxx = counterxx + 1
Next x

Noscirclesplan2 = myWorksheet.Range("b145")
MsgBox ("No. of circles to be drawn in plan are " + CStr(Noscirclesplan2))
counterz1 = 0
For z = 1 To Noscirclesplan2
CurrRow = 147
CurrCol = 1
MsgBox (" counterz is " + CStr(counterz1))
CenterPoint(0) = myWorksheet.Cells(CurrRow + counterz1, CurrCol).Value: _
CenterPoint(1) = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 1).Value: _
CenterPoint(2) = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 2).Value
radius = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 3).Value
StartAngle = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 4).Value
EndAngle = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 5).Value
Set CirObj = ThisDrawing.ModelSpace.AddArc(CenterPoint, radius, StartAngle,
EndAngle)
CirObj.Layer = "drawing"
CirObj.color = acCyan
CirObj.Lineweight = acLnWt035
CirObj.LinetypeScale = 0.25
CirObj.Linetype = "continuous"
CirObj.Update
counterz1 = counterz1 + 1
Next z

End If
End Sub
Sub testnose()
Dim NosLines, NosLinesplan1, NosLinesplan2, Noscirclesplan, Noscirclesplan1,
Noscirclesplan2 As Integer
ReDim CenterPoint(0 To 2) As Double
Noscirclesplan2 = myWorksheet.Range("b145")
MsgBox ("No. of circles to be drawn in plan are " + CStr(Noscirclesplan2))
counterz1 = 0
For z = 1 To Noscirclesplan2
CurrRow = 147
CurrCol = 1
MsgBox (" counterz is " + CStr(counterz1))
CenterPoint(0) = myWorksheet.Cells(CurrRow + counterz1, CurrCol).Value: _
CenterPoint(1) = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 1).Value: _
CenterPoint(2) = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 2).Value
radius = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 3).Value
StartAngle = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 4).Value
EndAngle = myWorksheet.Cells(CurrRow + counterz1, CurrCol + 5).Value
Set CirObj = ThisDrawing.ModelSpace.AddArc(CenterPoint, radius, StartAngle,
EndAngle)
CirObj.Layer = "drawing"
CirObj.color = acCyan
CirObj.Lineweight = acLnWt035
CirObj.LinetypeScale = 0.25
CirObj.Linetype = "continuous"
CirObj.Update
counterz1 = counterz1 + 1
Next z

' Draw Abutment A1 Plan

End Sub

Public Sub AbutmentA1()


Dim NosLines As Integer
Dim lineObj As AcadLine
Dim counter, No_of_spans As Integer
Set myExcel = GetObject(, "Excel.Application")
filepath = "C:\DATA\New folder\GADcircularpierboxabutment.xls"
myExcel.Workbooks.Open (filepath)
Set myWorksheet = myExcel.Worksheets("superstructure")
'myWorksheet.Range("X1") = "Get Range"
myExcel.Visible = True
'Set myRange = myExcel.InputBox( _
'Prompt:="Select a range of cells", _
'Title:="Select Row", _
'Type:=8)
'CurRow = myRange.Row
'CurCol = myRange.Column
'MsgBox ("You selected Row " + CStr(CurRow))
'MsgBox ("You selected Column " + CStr(CurCol))
'myWorksheet.Range("X2") = "Row " + CStr(myRange.Row)
NosLines = myWorksheet.Range("b37")
'MsgBox ("No. of lines to be drawn are " + CStr(NosLines))
'noArrayElem = 3 * NosLines
'MsgBox ("No. of array elements " + CStr(noArrayElem))
ReDim StartPoint(0 To 2) As Double
ReDim EndPoint(0 To 2) As Double
Dim newlayer As AcadLayer
Dim layColor As AcadAcCmColor
Set newlayer = ThisDrawing.Layers.Add("drawing")
ThisDrawing.ActiveLayer = newlayer
'Dim col As New AcadAcCmColor
' col.ColorMethod = AutoCAD.acColorMethodForeground
' Set the layer to the color
' Set layColor = _
AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
' Call layColor.SetRGB(122, 199, 25)
' ThisDrawing.ActiveLayer.TrueColor = layColor
' col.ColorMethod = AutoCAD.acColorMethodByLayer
No_of_spans = myWorksheet.Range("p18")
'No_of_spans = InputBox(Message, Title, Default)
MsgBox ("No_of_spans " + CStr(No_of_spans))
Length_of_spans = myWorksheet.Range("p12")
MsgBox ("Length of spans " + CStr(Length_of_spans))
countery = 0
'For y = 1 To No_of_spans - 1
'MsgBox ("countery " + CStr(countery))
'counterx = 0
For x = 1 To NosLines
CurrRow = 39
CurrCol = 1
'MsgBox (" counter is " + CStr(counter))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol).Value: _
'MsgBox ("xcord1 " + CStr(StartPoint(0)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol))
StartPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 1).Value: _
'MsgBox ("ycord1 " + CStr(StartPoint(1)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 1))
StartPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 2).Value
'MsgBox ("zcord1 " + CStr(StartPoint(2)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 2))
EndPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 3).Value: _
'MsgBox ("xcord2 " + CStr(EndPoint(0)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 3))
EndPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 4).Value: _
'MsgBox ("ycord2 " + CStr(EndPoint(1)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 4))
EndPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 5).Value
'MsgBox ("zcord2 " + CStr(EndPoint(2)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 5))
'startPoint(1) = x1: startPoint(2) = y1: startPoint(2) = z1
'endPoint(0) = x2: endPoint(1) = y2: endPoint(2) = z2
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Update
counterx = counterx + 1
Next x
'countery = countery + Length_of_spans
'MsgBox ("countery " + CStr(countery))
'next y
'ZoomAll
End Sub

Public Sub AbutmentA2()


Dim NosLines As Integer
Dim lineObj As AcadLine
Dim counter, No_of_spans As Integer
Set myExcel = GetObject(, "Excel.Application")
filepath = "C:\DATA\New folder\GADcircularpierboxabutment.xls"
myExcel.Workbooks.Open (filepath)
Set myWorksheet = myExcel.Worksheets("superstructure")
'myWorksheet.Range("X1") = "Get Range"
myExcel.Visible = True
'Set myRange = myExcel.InputBox( _
'Prompt:="Select a range of cells", _
'Title:="Select Row", _
'Type:=8)
'CurRow = myRange.Row
'CurCol = myRange.Column
'MsgBox ("You selected Row " + CStr(CurRow))
'MsgBox ("You selected Column " + CStr(CurCol))
'myWorksheet.Range("X2") = "Row " + CStr(myRange.Row)
NosLines = myWorksheet.Range("b67")
'MsgBox ("No. of lines to be drawn are " + CStr(NosLines))
'noArrayElem = 3 * NosLines
'MsgBox ("No. of array elements " + CStr(noArrayElem))
ReDim StartPoint(0 To 2) As Double
ReDim EndPoint(0 To 2) As Double
Dim newlayer As AcadLayer
Dim layColor As AcadAcCmColor
Set newlayer = ThisDrawing.Layers.Add("drawing")
ThisDrawing.ActiveLayer = newlayer
'Dim col As New AcadAcCmColor
' col.ColorMethod = AutoCAD.acColorMethodForeground
' Set the layer to the color
' Set layColor = _
AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
' Call layColor.SetRGB(122, 199, 25)
' ThisDrawing.ActiveLayer.TrueColor = layColor
' col.ColorMethod = AutoCAD.acColorMethodByLayer
No_of_spans = myWorksheet.Range("p18")
'No_of_spans = InputBox(Message, Title, Default)
MsgBox ("No_of_spans " + CStr(No_of_spans))
Length_of_spans = myWorksheet.Range("p12")
MsgBox ("Length of spans " + CStr(Length_of_spans))
countery = 0
'For y = 1 To No_of_spans - 1
'MsgBox ("countery " + CStr(countery))
'counterx = 0
For x = 1 To NosLines
CurrRow = 69
CurrCol = 1
'MsgBox (" counter is " + CStr(counter))
StartPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol).Value: _
'MsgBox ("xcord1 " + CStr(StartPoint(0)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol))
StartPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 1).Value: _
'MsgBox ("ycord1 " + CStr(StartPoint(1)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 1))
StartPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 2).Value
'MsgBox ("zcord1 " + CStr(StartPoint(2)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 2))
EndPoint(0) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 3).Value: _
'MsgBox ("xcord2 " + CStr(EndPoint(0)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 3))
EndPoint(1) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 4).Value: _
'MsgBox ("ycord2 " + CStr(EndPoint(1)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 4))
EndPoint(2) = myWorksheet.Cells(CurrRow + counterx, CurrCol + 5).Value
'MsgBox ("zcord2 " + CStr(EndPoint(2)))
'MsgBox ("current row " + CStr(CurrRow + counter))
'MsgBox ("current column " + CStr(CurrCol + 5))
'startPoint(1) = x1: startPoint(2) = y1: startPoint(2) = z1
'endPoint(0) = x2: endPoint(1) = y2: endPoint(2) = z2
Set lineObj = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
lineObj.Layer = "drawing"
lineObj.color = acCyan
lineObj.Lineweight = acLnWt035
lineObj.LinetypeScale = 0.25
lineObj.Update
counterx = counterx + 1
Next x
'countery = countery + Length_of_spans
'MsgBox ("countery " + CStr(countery))
'next y
'ZoomAll
End Sub

Potrebbero piacerti anche