I am creating a Ruby scrip to draw courses of a wall with a curve. The first three courses I draw with the follow me command works fine but after three courses they start to add extra faces on the curve.
Here is the script.
def draw_MyProject
model = Sketchup.active_model
entities = model.entities
layers = Sketchup.active_model.layers
layer = layers.add(“Spline”)
model.active_layer = layer
Draw the block - face
pts =
pts[0] = [437.3802, 347.0009, -38.75]
pts[1] = [437.6738, 350.8442, -38.75]
pts[2] = [437.7358, 351.6564, -31]
pts[3] = [437.3182, 346.1888, -31]
face = entities.add_face(pts)
connected = face.all_connected
Draw the block - face
pts =
pts[0] = [437.3182, 346.1888, -31]
pts[1] = [437.7358, 351.6564, -31]
pts[2] = [437.7979, 352.4686, -23.25]
pts[3] = [437.2561, 345.3766, -23.25]
face = entities.add_face(pts)
connected = face.all_connected
Draw the block - face
pts =
pts[0] = [437.2561, 345.3766, -23.25]
pts[1] = [437.7979, 352.4686, -23.25]
pts[2] = [437.8599, 353.2808, -15.5]
pts[3] = [437.1941, 344.5644, -15.5]
face = entities.add_face(pts)
connected = face.all_connected
Draw the block - face
pts =
pts[0] = [207.8086, 211.2927, -15.5]
pts[1] = [202.4888, 218.2295, -15.5]
pts[2] = [201.9931, 218.8758, -7.75]
pts[3] = [208.3043, 210.6464, -7.75]
face = entities.add_face(pts)
connected = face.all_connected
ptsSpine =
ptsSpine[0] = [208.8, 210, 0]
ptsSpine[1] = [347.28, 316.2, 0]
ptsSpine[2] = [347.28, 316.2, 0]
ptsSpine[3] = [352.5566, 320.0915, 0]
ptsSpine[4] = [358.0441, 323.6812, 0]
ptsSpine[5] = [363.7041, 326.9922, 0]
ptsSpine[6] = [369.5225, 330.0162, 0]
ptsSpine[7] = [375.4848, 332.7456, 0]
ptsSpine[8] = [381.576, 335.1736, 0]
ptsSpine[9] = [387.781, 337.2941, 0]
ptsSpine[10] = [394.0843, 339.1018, 0]
ptsSpine[11] = [400.4699, 340.5923, 0]
ptsSpine[12] = [406.9221, 341.7617, 0]
ptsSpine[13] = [413.4247, 342.6072, 0]
ptsSpine[14] = [419.9614, 343.1267, 0]
ptsSpine[15] = [426.5159, 343.3188, 0]
ptsSpine[16] = [433.0718, 343.1831, 0]
ptsSpine[17] = [437.07, 342.94, 0]
curve = entities.add_curve(ptsSpine)
status = face.followme(curve)
Draw the block - face
pts =
pts[0] = [208.3043, 210.6464, -7.75]
pts[1] = [201.9931, 218.8758, -7.75]
pts[2] = [201.4974, 219.5222, 0]
pts[3] = [208.8, 210, 0]
face = entities.add_face(pts)
connected = face.all_connected
ptsSpine =
ptsSpine[0] = [208.8, 210, 0]
ptsSpine[1] = [347.28, 316.2, 0]
ptsSpine[2] = [347.28, 316.2, 0]
ptsSpine[3] = [352.5566, 320.0915, 0]
ptsSpine[4] = [358.0441, 323.6812, 0]
ptsSpine[5] = [363.7041, 326.9922, 0]
ptsSpine[6] = [369.5225, 330.0162, 0]
ptsSpine[7] = [375.4848, 332.7456, 0]
ptsSpine[8] = [381.576, 335.1736, 0]
ptsSpine[9] = [387.781, 337.2941, 0]
ptsSpine[10] = [394.0843, 339.1018, 0]
ptsSpine[11] = [400.4699, 340.5923, 0]
ptsSpine[12] = [406.9221, 341.7617, 0]
ptsSpine[13] = [413.4247, 342.6072, 0]
ptsSpine[14] = [419.9614, 343.1267, 0]
ptsSpine[15] = [426.5159, 343.3188, 0]
ptsSpine[16] = [433.0718, 343.1831, 0]
ptsSpine[17] = [437.07, 342.94, 0]
curve = entities.add_curve(ptsSpine)
status = face.followme(curve)
Draw the block - face
pts =
pts[0] = [208.8, 210, 0]
pts[1] = [201.4974, 219.5222, 0]
pts[2] = [201.0017, 220.1686, 7.75]
pts[3] = [208.3043, 210.6464, 7.75]
face = entities.add_face(pts)
connected = face.all_connected
ptsSpine =
ptsSpine[0] = [208.8, 210, 0]
ptsSpine[1] = [347.28, 316.2, 0]
ptsSpine[2] = [347.28, 316.2, 0]
ptsSpine[3] = [352.5566, 320.0915, 0]
ptsSpine[4] = [358.0441, 323.6812, 0]
ptsSpine[5] = [363.7041, 326.9922, 0]
ptsSpine[6] = [369.5225, 330.0162, 0]
ptsSpine[7] = [375.4848, 332.7456, 0]
ptsSpine[8] = [381.576, 335.1736, 0]
ptsSpine[9] = [387.781, 337.2941, 0]
ptsSpine[10] = [394.0843, 339.1018, 0]
ptsSpine[11] = [400.4699, 340.5923, 0]
ptsSpine[12] = [406.9221, 341.7617, 0]
ptsSpine[13] = [413.4247, 342.6072, 0]
ptsSpine[14] = [419.9614, 343.1267, 0]
ptsSpine[15] = [426.5159, 343.3188, 0]
ptsSpine[16] = [433.0718, 343.1831, 0]
ptsSpine[17] = [437.07, 342.94, 0]
curve = entities.add_curve(ptsSpine)
status = face.followme(curve)
Draw the block - face
pts =
pts[0] = [208.3043, 210.6464, 7.75]
pts[1] = [201.0017, 220.1686, 7.75]
pts[2] = [200.506, 220.8149, 15.5]
pts[3] = [207.8086, 211.2927, 15.5]
face = entities.add_face(pts)
connected = face.all_connected
ptsSpine =
ptsSpine[0] = [208.8, 210, 0]
ptsSpine[1] = [347.28, 316.2, 0]
ptsSpine[2] = [347.28, 316.2, 0]
ptsSpine[3] = [352.5566, 320.0915, 0]
ptsSpine[4] = [358.0441, 323.6812, 0]
ptsSpine[5] = [363.7041, 326.9922, 0]
ptsSpine[6] = [369.5225, 330.0162, 0]
ptsSpine[7] = [375.4848, 332.7456, 0]
ptsSpine[8] = [381.576, 335.1736, 0]
ptsSpine[9] = [387.781, 337.2941, 0]
ptsSpine[10] = [394.0843, 339.1018, 0]
ptsSpine[11] = [400.4699, 340.5923, 0]
ptsSpine[12] = [406.9221, 341.7617, 0]
ptsSpine[13] = [413.4247, 342.6072, 0]
ptsSpine[14] = [419.9614, 343.1267, 0]
ptsSpine[15] = [426.5159, 343.3188, 0]
ptsSpine[16] = [433.0718, 343.1831, 0]
ptsSpine[17] = [437.07, 342.94, 0]
curve = entities.add_curve(ptsSpine)
status = face.followme(curve)
Draw the block - face
pts =
pts[0] = [207.8086, 211.2927, 15.5]
pts[1] = [200.506, 220.8149, 15.5]
pts[2] = [200.0103, 221.4613, 23.25]
pts[3] = [207.3129, 211.9391, 23.25]
face = entities.add_face(pts)
connected = face.all_connected
ptsSpine =
ptsSpine[0] = [208.8, 210, 0]
ptsSpine[1] = [347.28, 316.2, 0]
ptsSpine[2] = [347.28, 316.2, 0]
ptsSpine[3] = [352.5566, 320.0915, 0]
ptsSpine[4] = [358.0441, 323.6812, 0]
ptsSpine[5] = [363.7041, 326.9922, 0]
ptsSpine[6] = [369.5225, 330.0162, 0]
ptsSpine[7] = [375.4848, 332.7456, 0]
ptsSpine[8] = [381.576, 335.1736, 0]
ptsSpine[9] = [387.781, 337.2941, 0]
ptsSpine[10] = [394.0843, 339.1018, 0]
ptsSpine[11] = [400.4699, 340.5923, 0]
ptsSpine[12] = [406.9221, 341.7617, 0]
ptsSpine[13] = [413.4247, 342.6072, 0]
ptsSpine[14] = [419.9614, 343.1267, 0]
ptsSpine[15] = [426.5159, 343.3188, 0]
ptsSpine[16] = [433.0718, 343.1831, 0]
ptsSpine[17] = [437.07, 342.94, 0]
curve = entities.add_curve(ptsSpine)
status = face.followme(curve)
Draw the block - face
pts =
pts[0] = [437.2561, 345.3766, 23.25]
pts[1] = [438.1701, 357.3417, 23.25]
pts[2] = [438.2322, 358.1539, 31]
pts[3] = [437.3182, 346.1888, 31]
face = entities.add_face(pts)
connected = face.all_connected
Draw the block - face
pts =
pts[0] = [437.3182, 346.1888, 31]
pts[1] = [438.2322, 358.1539, 31]
pts[2] = [438.2942, 358.9661, 38.75]
pts[3] = [437.3802, 347.0009, 38.75]
face = entities.add_face(pts)
connected = face.all_connected
Draw the block - face
pts =
pts[0] = [437.3802, 347.0009, 38.75]
pts[1] = [438.2942, 358.9661, 38.75]
pts[2] = [438.3563, 359.7783, 46.5]
pts[3] = [437.4423, 347.8132, 46.5]
face = entities.add_face(pts)
connected = face.all_connected
Draw the spline - arc
ptsSpine =
ptsSpine[0] = [437.07, 342.94, 0]
ptsSpine[1] = [443.5937, 342.2763, 0]
ptsSpine[2] = [450.0761, 341.2883, 0]
ptsSpine[3] = [456.5011, 339.9776, 0]
ptsSpine[4] = [462.8526, 338.3474, 0]
ptsSpine[5] = [469.1146, 336.4019, 0]
ptsSpine[6] = [475.2716, 334.1457, 0]
ptsSpine[7] = [481.3081, 331.5847, 0]
ptsSpine[8] = [487.2091, 328.7252, 0]
ptsSpine[9] = [492.9597, 325.5743, 0]
ptsSpine[10] = [498.5458, 322.14, 0]
ptsSpine[11] = [503.9532, 318.4307, 0]
ptsSpine[12] = [509.1684, 314.4558, 0]
ptsSpine[13] = [514.1785, 310.2253, 0]
ptsSpine[14] = [518.9709, 305.7496, 0]
ptsSpine[15] = [521.76, 303, 0]
Draw the spline - arc
ptsSpine[16] = [521.76, 303, 0]
ptsSpine[17] = [526.7491, 298.0459, 0]
ptsSpine[18] = [531.9872, 293.3553, 0]
ptsSpine[19] = [537.4531, 288.9324, 0]
ptsSpine[20] = [543.1333, 284.7882, 0]
ptsSpine[21] = [549.0135, 280.933, 0]
ptsSpine[22] = [555.079, 277.3766, 0]
ptsSpine[23] = [561.3147, 274.1278, 0]
ptsSpine[24] = [567.705, 271.1947, 0]
ptsSpine[25] = [574.2339, 268.5846, 0]
ptsSpine[26] = [580.885, 266.3041, 0]
ptsSpine[27] = [587.6418, 264.3589, 0]
ptsSpine[28] = [594.4875, 262.7538, 0]
ptsSpine[29] = [601.4047, 261.4928, 0]
ptsSpine[30] = [607.69, 260.65, 0]
model.entities.add_curve(ptsSpine)
Draw the spline - arc
ptsSpine =
ptsSpine[0] = [607.69, 260.65, 0]
ptsSpine[1] = [614.6962, 260.0549, 0]
ptsSpine[2] = [621.7231, 259.8073, 0]
ptsSpine[3] = [628.7535, 259.9113, 0]
ptsSpine[4] = [635.7701, 260.3665, 0]
ptsSpine[5] = [642.7551, 261.1718, 0]
ptsSpine[6] = [649.6911, 262.3252, 0]
ptsSpine[7] = [656.5608, 263.8238, 0]
ptsSpine[8] = [663.347, 265.6638, 0]
ptsSpine[9] = [670.0328, 267.8408, 0]
ptsSpine[10] = [676.6014, 270.3492, 0]
ptsSpine[11] = [683.0365, 273.1827, 0]
ptsSpine[12] = [689.3218, 276.3344, 0]
ptsSpine[13] = [695.4419, 279.7962, 0]
ptsSpine[14] = [700.8, 283.2, 0]
Draw the spline - line
ptsSpine[15] = [700.8, 283.2, 0]
ptsSpine[16] = [917.4, 426.6, 0]
model.entities.add_curve(ptsSpine)
end
This is what it looks like.
How do I get it to draw the curves smooth like the first three courses?
JeffG