I'm using Alibre and WizoScript to make a contour map of a sloping property. It is based on elevation measurements along several lines with four foot spacing that run the length of the property. I'm fitting b-splines to the elevation readings along each line.
I've been running into seemingly unpredictable problems using AddBsplines. The length of my lists of measurements vary depending on what I thought would adequately capture the lot surface. I eventually noticed that the script failed when the lists got over a certain length. It seems that a list of length 104 succeeds and a list of length 106 fails. It doesn't look like AddLines has the same problem.
I've isolated the problem in a test script, and uploaded it here as a TXT file. (Which, it turns out, you can open directly as a script in AlibreScript without renaming!) The lists of points are identical except one has two more members.
I'll paste the contents here and also upload a file:
========================================
# specify which libraries we are going to use
Units.Current = UnitTypes.Inches
# create part -------------------------------------------------
TestPart = Part('LotLoft')
#create and initiate points arrays -----------------------------
Points1 = [-240.0, -22.0, -192.0, -22.0, -144.0, -22.0, -120.0, -22.0, -96.0, -22.0, -72.0, -22.0, -48.0, -12.0, 0.0, 32.0, 48.0, 61.0, 96.0, 90.0, 144.0, 109.0, 156.0, 114.0, 180.0, 141.0, 192.0, 150.0, 216.0, 161.0, 240.0, 166.0, 288.0, 178.0, 336.0, 194.0, 384.0, 208.0, 432.0, 222.0, 480.0, 236.0, 528.0, 266.0, 576.0, 279.0, 624.0, 303.0, 672.0, 322.0, 720.0, 345.0, 768.0, 362.0, 804.0, 382.0, 816.0, 404.0, 828.0, 413.0, 840.0, 405.0, 864.0, 415.0, 912.0, 424.0, 960.0, 440.0, 1008.0, 459.0, 1056.0, 476.0, 1104.0, 485.0, 1152.0, 496.0, 1200.0, 513.0, 1248.0, 526.0, 1296.0, 529.0, 1344.0, 536.0, 1392.0, 554.0, 1440.0, 586.0, 1488.0, 612.0, 1536.0, 627.0, 1584.0, 655.0, 1632.0, 664.0, 1680.0, 695.0, 1716.0, 697.0, 1728.0, 753.0, 1776.0, 789.0]
print 'Length of Points1 is ' + str(len(Points1)) # ***NOTE: LENGTH POINTS1 = 104
Points2 = [-240.0, -22.0, -192.0, -22.0, -144.0, -22.0, -120.0, -22.0, -96.0, -22.0, -72.0, -22.0, -48.0, -12.0, 0.0, 32.0, 48.0, 61.0, 96.0, 90.0, 144.0, 109.0, 156.0, 114.0, 180.0, 141.0, 192.0, 150.0, 216.0, 161.0, 240.0, 166.0, 288.0, 178.0, 336.0, 194.0, 384.0, 208.0, 432.0, 222.0, 480.0, 236.0, 528.0, 266.0, 576.0, 279.0, 624.0, 303.0, 672.0, 322.0, 720.0, 345.0, 768.0, 362.0, 804.0, 382.0, 816.0, 404.0, 828.0, 413.0, 840.0, 405.0, 864.0, 415.0, 912.0, 424.0, 960.0, 440.0, 1008.0, 459.0, 1056.0, 476.0, 1104.0, 485.0, 1152.0, 496.0, 1200.0, 513.0, 1248.0, 526.0, 1296.0, 529.0, 1344.0, 536.0, 1392.0, 554.0, 1440.0, 586.0, 1488.0, 612.0, 1536.0, 627.0, 1584.0, 655.0, 1632.0, 664.0, 1680.0, 695.0, 1716.0, 697.0, 1728.0, 753.0, 1776.0, 789.0, 1824.0, 789.0]
print 'Length of Points2 is ' + str(len(Points2)) # ***NOTE: LENGTH POINTS2 = 106
# create and name sketch ----------------------------------------
MySketch1 = TestPart.AddSketch('MySketch01', TestPart.GetPlane('XY-Plane'))
# add LINES through the points ----------------------------------
MySketch1.AddLines( Points1, False )
print 'Line 1 success!'
MySketch1.AddLines( Points2, False )
print 'Line 2 success!'
# add SPLINE through the points ------------------------------------
MySketch1.AddBspline( Points1, False )
print 'Spline 1 success!'
MySketch1.AddBspline( Points2, False )
print 'Spline 2 success!'
# --------------------------------------------------------------------
I've been running into seemingly unpredictable problems using AddBsplines. The length of my lists of measurements vary depending on what I thought would adequately capture the lot surface. I eventually noticed that the script failed when the lists got over a certain length. It seems that a list of length 104 succeeds and a list of length 106 fails. It doesn't look like AddLines has the same problem.
I've isolated the problem in a test script, and uploaded it here as a TXT file. (Which, it turns out, you can open directly as a script in AlibreScript without renaming!) The lists of points are identical except one has two more members.
I'll paste the contents here and also upload a file:
========================================
# specify which libraries we are going to use
Units.Current = UnitTypes.Inches
# create part -------------------------------------------------
TestPart = Part('LotLoft')
#create and initiate points arrays -----------------------------
Points1 = [-240.0, -22.0, -192.0, -22.0, -144.0, -22.0, -120.0, -22.0, -96.0, -22.0, -72.0, -22.0, -48.0, -12.0, 0.0, 32.0, 48.0, 61.0, 96.0, 90.0, 144.0, 109.0, 156.0, 114.0, 180.0, 141.0, 192.0, 150.0, 216.0, 161.0, 240.0, 166.0, 288.0, 178.0, 336.0, 194.0, 384.0, 208.0, 432.0, 222.0, 480.0, 236.0, 528.0, 266.0, 576.0, 279.0, 624.0, 303.0, 672.0, 322.0, 720.0, 345.0, 768.0, 362.0, 804.0, 382.0, 816.0, 404.0, 828.0, 413.0, 840.0, 405.0, 864.0, 415.0, 912.0, 424.0, 960.0, 440.0, 1008.0, 459.0, 1056.0, 476.0, 1104.0, 485.0, 1152.0, 496.0, 1200.0, 513.0, 1248.0, 526.0, 1296.0, 529.0, 1344.0, 536.0, 1392.0, 554.0, 1440.0, 586.0, 1488.0, 612.0, 1536.0, 627.0, 1584.0, 655.0, 1632.0, 664.0, 1680.0, 695.0, 1716.0, 697.0, 1728.0, 753.0, 1776.0, 789.0]
print 'Length of Points1 is ' + str(len(Points1)) # ***NOTE: LENGTH POINTS1 = 104
Points2 = [-240.0, -22.0, -192.0, -22.0, -144.0, -22.0, -120.0, -22.0, -96.0, -22.0, -72.0, -22.0, -48.0, -12.0, 0.0, 32.0, 48.0, 61.0, 96.0, 90.0, 144.0, 109.0, 156.0, 114.0, 180.0, 141.0, 192.0, 150.0, 216.0, 161.0, 240.0, 166.0, 288.0, 178.0, 336.0, 194.0, 384.0, 208.0, 432.0, 222.0, 480.0, 236.0, 528.0, 266.0, 576.0, 279.0, 624.0, 303.0, 672.0, 322.0, 720.0, 345.0, 768.0, 362.0, 804.0, 382.0, 816.0, 404.0, 828.0, 413.0, 840.0, 405.0, 864.0, 415.0, 912.0, 424.0, 960.0, 440.0, 1008.0, 459.0, 1056.0, 476.0, 1104.0, 485.0, 1152.0, 496.0, 1200.0, 513.0, 1248.0, 526.0, 1296.0, 529.0, 1344.0, 536.0, 1392.0, 554.0, 1440.0, 586.0, 1488.0, 612.0, 1536.0, 627.0, 1584.0, 655.0, 1632.0, 664.0, 1680.0, 695.0, 1716.0, 697.0, 1728.0, 753.0, 1776.0, 789.0, 1824.0, 789.0]
print 'Length of Points2 is ' + str(len(Points2)) # ***NOTE: LENGTH POINTS2 = 106
# create and name sketch ----------------------------------------
MySketch1 = TestPart.AddSketch('MySketch01', TestPart.GetPlane('XY-Plane'))
# add LINES through the points ----------------------------------
MySketch1.AddLines( Points1, False )
print 'Line 1 success!'
MySketch1.AddLines( Points2, False )
print 'Line 2 success!'
# add SPLINE through the points ------------------------------------
MySketch1.AddBspline( Points1, False )
print 'Spline 1 success!'
MySketch1.AddBspline( Points2, False )
print 'Spline 2 success!'
# --------------------------------------------------------------------