I'm new here and am also relatively new to VBA. I've been struggling with this problem for a while and can't seem to find a solution. I have points that correspond to either endpoint of a wall or intersections of a wall (Shown in an attached image).
enter code here
I need to turn this information into points along the wall boundary (from a given wall thickness) sorted in a clockwise manner from an arbitrary point. See the attached image.
I've managed to create points at boundaries (very roughly) by shrinking back each node by half of the wall thickness and then moving each resulting node "side to side" in the perpendicular direction by half of the wall thickness.
The data I have does show node pairs for each line. These "AtoB" line type connection pairs exist node to node and don't overlap of the cross.
Any suggestions or help would be greatly appreciated. I'm a bit stuck.
Thanks!
J
Below is output information for an "L" shaped wall: enter image description here
I then take the XY coordinates and shift them:
ReDim CoordsArr(9, 3) '10 Walls total available per pier
''' Store coord in variables '''
For coordrow = 0 To Counter - 2
CoordsArr(coordrow, 0) = Cells(24 + coordrow, 5)
CoordsArr(coordrow, 1) = Cells(24 + coordrow, 6)
CoordsArr(coordrow, 2) = Cells(24 + coordrow, 8)
CoordsArr(coordrow, 3) = Cells(24 + coordrow, 9)
Next coordrow
''' Generate New Corner Points '''
ReDim POINTS_XY(19, 7) 'Array as (x1,y1,x2,y2,x3,y3,x4,y4) for points
'above and below CL
For coordrow = 0 To Counter - 2
If Abs(CoordsArr(coordrow, 3) - CoordsArr(coordrow, 1)) = 0 Then
If CoordsArr(coordrow, 0) < CoordsArr(coordrow, 2) Then
XnewL = CoordsArr(coordrow, 0) + thick / 2
XnewR = CoordsArr(coordrow, 2) - thick / 2
POINTS_XY(coordrow, 0) = XnewL
POINTS_XY(coordrow, 1) = thick / 2
POINTS_XY(coordrow, 2) = XnewL
POINTS_XY(coordrow, 3) = -thick / 2
POINTS_XY(coordrow, 4) = XnewR
POINTS_XY(coordrow, 5) = thick / 2
POINTS_XY(coordrow, 6) = XnewR
POINTS_XY(coordrow, 7) = -thick / 2
ElseIf CoordsArr(coordrow, 0) > CoordsArr(coordrow, 2) Then
XnewL = CoordsArr(coordrow, 0) - thick / 2
XnewR = CoordsArr(coordrow, 2) + thick / 2
POINTS_XY(coordrow, 0) = XnewL
POINTS_XY(coordrow, 1) = thick / 2
POINTS_XY(coordrow, 2) = XnewL
POINTS_XY(coordrow, 3) = -thick / 2
POINTS_XY(coordrow, 4) = XnewR
POINTS_XY(coordrow, 5) = thick / 2
POINTS_XY(coordrow, 6) = XnewR
POINTS_XY(coordrow, 7) = -thick / 2
End If
ElseIf Abs(CoordsArr(coordrow, 2) - CoordsArr(coordrow, 0)) = 0 Then
If CoordsArr(coordrow, 1) < CoordsArr(coordrow, 3) Then
YnewD = CoordsArr(coordrow, 1) + thick / 2
YnewU = CoordsArr(coordrow, 3) - thick / 2
POINTS_XY(coordrow, 0) = -thick / 2
POINTS_XY(coordrow, 1) = YnewD
POINTS_XY(coordrow, 2) = thick / 2
POINTS_XY(coordrow, 3) = YnewD
POINTS_XY(coordrow, 4) = -thick / 2
POINTS_XY(coordrow, 5) = YnewU
POINTS_XY(coordrow, 6) = thick / 2
POINTS_XY(coordrow, 7) = YnewU
ElseIf CoordsArr(coordrow, 1) > CoordsArr(coordrow, 3) Then
YnewD = CoordsArr(coordrow, 1) - thick / 2
YnewU = CoordsArr(coordrow, 3) + thick / 2
POINTS_XY(coordrow, 0) = -thick / 2
POINTS_XY(coordrow, 1) = YnewD
POINTS_XY(coordrow, 2) = thick / 2
POINTS_XY(coordrow, 3) = YnewD
POINTS_XY(coordrow, 4) = -thick / 2
POINTS_XY(coordrow, 5) = YnewU
POINTS_XY(coordrow, 6) = thick / 2
POINTS_XY(coordrow, 7) = YnewU
End If
End If
Next coordrow