Hello Experts,
I have ground & ceiling geometrical data given in X, Y coordinates, which I plotted in thick brown in the chart below.
I want to add and plot vertical and horizontal lines (constituting building blocks) in between ground and ceiling; following some rules as follows:
# Vertical Lines
Shall be established every 4 feet apart. The lines' length is an even number with 2 feet increment (i.e. length is 2,4,6, or 8 etc.) as height permits at that location.
The vertical lines should NOT intersect with the ceiling. Each has to stop at least 2 feet before it hits the ceiling.
# Horizontal lines
Shall also be established every 4 feet apart. The lines' length has to be an even number with 4 feet increment (i.e. 4, 8, or 12, …to whatever it takes)
The lines should not intersect with the ceiling's side slopes, at least 5 feet needs to be before hitting sideways
The lines should end up creating a proper outline of building blocks (rectangles/squares) in an organized format.
I manually tried to create some lines (with formulas) for illustration purpose (attached) but I appreciate if I can accomplish this perfectly with VBA.
It would be also fantastic at the end to provide the final number of utilized blocks and the surface area, but this is optional, plotting is more important!
I also posted this in another forum about 36 hours ago with no luck as I write:
Thanks for your help!
I have ground & ceiling geometrical data given in X, Y coordinates, which I plotted in thick brown in the chart below.
I want to add and plot vertical and horizontal lines (constituting building blocks) in between ground and ceiling; following some rules as follows:
# Vertical Lines
Shall be established every 4 feet apart. The lines' length is an even number with 2 feet increment (i.e. length is 2,4,6, or 8 etc.) as height permits at that location.
The vertical lines should NOT intersect with the ceiling. Each has to stop at least 2 feet before it hits the ceiling.
# Horizontal lines
Shall also be established every 4 feet apart. The lines' length has to be an even number with 4 feet increment (i.e. 4, 8, or 12, …to whatever it takes)
The lines should not intersect with the ceiling's side slopes, at least 5 feet needs to be before hitting sideways
The lines should end up creating a proper outline of building blocks (rectangles/squares) in an organized format.
I manually tried to create some lines (with formulas) for illustration purpose (attached) but I appreciate if I can accomplish this perfectly with VBA.
It would be also fantastic at the end to provide the final number of utilized blocks and the surface area, but this is optional, plotting is more important!
I also posted this in another forum about 36 hours ago with no luck as I write:
VBA to generate and draw vertical and horizontal lines following some rules - OzGrid Free Excel/VBA Help Forum
I have ground & ceiling data given in X, Y coordinates, which I plotted I want to split the area in between vertical and horizontal lines (constituting building blocks) and plot all; following some rules: # Vertical Lines Shall be every 4 feet apart.…
www.ozgrid.com
Thanks for your help!
04092021.xlsx | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | AD | AE | AF | |||
1 | VBA to generate & plot this | VBA to generate & plot this | ||||||||||||||||
2 | FLOOR | CEILING | VL. Lines (every 4 feet) | Formulas used to create the vertical lines | HL Lines (every 4 feet) | |||||||||||||
3 | X | Y | X | Y | X | Y | Top Ceiling Elev at this location | Calculated Line end elev | Remaining height | X | Y | |||||||
4 | 0 | 2 | 0.0 | 14.0 | 0.0 | 2.0 | 14.00 | 12.00 | 2.00 | 0 | 6 | |||||||
5 | 400 | 2 | 103.7 | 26.0 | 0.0 | 12.0 | 400 | 6 | ||||||||||
6 | 310.0 | 26.0 | ||||||||||||||||
7 | 400.0 | 16.0 | 4.0 | 2.0 | 14.46 | 12.00 | 2.46 | 0 | 10 | |||||||||
8 | 4.0 | 12.0 | 400 | 10 | ||||||||||||||
9 | ||||||||||||||||||
10 | 8.0 | 2.0 | 14.93 | 12.00 | 2.93 | 8 | 14 | |||||||||||
11 | 8.0 | 12.0 | 400 | 14 | ||||||||||||||
12 | ||||||||||||||||||
13 | 12.0 | 2.0 | 15.39 | 12.00 | 3.39 | 40 | 18 | |||||||||||
14 | 12.0 | 12.0 | 376 | 18 | ||||||||||||||
15 | ||||||||||||||||||
16 | 76 | 22 | ||||||||||||||||
17 | 16.0 | 2.0 | 15.85 | 12.00 | 3.85 | 340 | 22 | |||||||||||
18 | 16.0 | 12.0 | ||||||||||||||||
19 | ||||||||||||||||||
20 | ||||||||||||||||||
21 | 20.0 | 2.0 | 16.31 | 12.00 | 4.31 | |||||||||||||
22 | 20.0 | 12.0 | ||||||||||||||||
23 | ||||||||||||||||||
24 | ||||||||||||||||||
25 | 24.0 | 2.0 | 16.78 | 12.00 | 4.78 | |||||||||||||
26 | 24.0 | 12.0 | ||||||||||||||||
27 | ||||||||||||||||||
28 | ||||||||||||||||||
29 | 28.0 | 2.0 | 17.24 | 12.00 | 5.24 | |||||||||||||
30 | 28.0 | 12.0 | ||||||||||||||||
31 | ||||||||||||||||||
32 | ||||||||||||||||||
33 | 32.0 | 2.0 | 17.70 | 12.00 | 5.70 | |||||||||||||
34 | 32.0 | 12.0 | ||||||||||||||||
35 | ||||||||||||||||||
36 | ||||||||||||||||||
37 | 36.0 | 2.0 | 18.17 | 16.00 | 2.17 | |||||||||||||
38 | 36.0 | 16.0 | ||||||||||||||||
39 | ||||||||||||||||||
40 | ||||||||||||||||||
41 | 40.0 | 2.0 | 18.63 | 16.00 | 2.63 | |||||||||||||
42 | 40.0 | 16.0 | ||||||||||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
X4 | X4 | =R4 |
Z4,Z41,Z37,Z33,Z29,Z25,Z21,Z17,Z13,Z10,Z7 | Z4 | =FORECAST(W4,OFFSET(KnownY,MATCH(W4,KnownX,1)-1,0,2),OFFSET(KnownX,MATCH(W4,KnownX,1)-1,0,2)) |
AA4 | AA4 | =IF(OR((FLOOR(Z4,4)=Z4),(Z4-FLOOR(Z4,4))<=1.5),FLOOR(Z4-3,2),FLOOR(Z4,4)) |
AB4,AB41,AB37,AB33,AB29,AB25,AB21,AB17,AB13,AB10,AB7 | AB4 | =Z4-AA4 |
AD4:AD5 | AD4 | =Q4 |
AE4:AE5 | AE4 | =R4+4 |
W5,W42,W38,W34,W30,W26,W22,W18,W14,W11,W8 | W5 | =W4 |
X5,X42,X38,X34,X30,X26,X22,X18,X14,X11,X8 | X5 | =AA4 |
W7,W41,W37,W33,W29,W25,W21,W17,W13,W10 | W7 | =W4+4 |
AA7,AA21,AA17,AA13,AA10 | AA7 | =IF(OR((FLOOR(Z7,4)=Z7),(Z7-FLOOR(Z7,4))<=1.5),FLOOR(Z7-3,4),FLOOR(Z7,4)) |
AD10,AD16,AD13 | AD10 | =CEILING(FORECAST(AE10,OFFSET(KnownX,MATCH(AE10,KnownY,1)-1,0,2),OFFSET(KnownY,MATCH(AE10,KnownY,1)-1,0,2))+5,4) |
AD14,AD17 | AD14 | =FLOOR(FORECAST(AE14,OFFSET(KnownX,MATCH(AE14,KnownY,1)+1,0,2),OFFSET(KnownY,MATCH(AE14,KnownY,1)+1,0,2))-5,4) |
AA25,AA41,AA37,AA33,AA29 | AA25 | =IF(OR((FLOOR(Z25,4)=Z25),(Z25-FLOOR(Z25,4))<=2),FLOOR(Z25-3,4),FLOOR(Z25,4)) |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
KnownX | =Sheet1!$T$4:$T$7 | Z41, Z25, Z37, Z21, Z33, Z17, Z29, Z13, Z10, Z7, Z4, AD16:AD17, AD10, AD13:AD14 |
KnownY | =Sheet1!$U$4:$U$7 | Z41, Z25, Z37, Z21, Z33, Z17, Z29, Z13, Z10, Z7, Z4, AD16:AD17, AD10, AD13:AD14 |