What's new

Wizo AddBspline seems to have length limitation . . .

R-man

Senior Member
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!'

# --------------------------------------------------------------------
 

Attachments

  • WizoTestSplineLength.txt
    2.5 KB · Views: 5

ajayre

Alibre Super User
The full error is:

Code:
Object reference not set to an instance of an object.
   at com.alibre.automation.ExceptionMap.handleException(Exception inputException)
   at com.alibre.automation.AlibreSketchFigures.AddBsplineByInterpolation(Array& pInterpolationPoints)
   at AlibreScript.API.Sketch.AddBsplineInterpolated(List`1 Points, Boolean IsReference) in C:\Users\Andy\Documents\WizoScript\API\Sketch.cs:line 752
   at AlibreScript.API.Sketch.AddBsplineThroughPoints(List`1 Points, Boolean IsReference) in C:\Users\Andy\Documents\WizoScript\API\Sketch.cs:line 770
   at AlibreScript.API.Sketch.AddBspline(List Points, Boolean IsReference) in C:\Users\Andy\Documents\WizoScript\API\Sketch.cs:line 591
   at Microsoft.Scripting.Interpreter.ActionCallInstruction`3.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

This error is inside AD, not AlibreScript. I suggest you submit a support ticket including your test script and the full error I've given.

However to me 100+ points in a bspline sounds like a lot. Perhaps the best approach is to "smooth" the data before using it in AD?

Andy
 
However to me 100+ points in a bspline sounds like a lot.
It's been a while (1988), but the airfoil contours used to create the US Windpower turbine system were Wronskian curves composed of (about) 2500 knots per curve. There were 112 nsuch airfoil curves defining a blade.
 

R-man

Senior Member
Thanks Andy.
I've seen the full error so many times that I almost know it by heart! :( Since I made my post I've had the same problem on shorter lists too, so it's not simply length related. Before the recent update, I used AddSplineThroughPoints (sp?) but that seems to have disappeared. I'll take your advice and submit a ticket.

As Lew points out, 100 points is not such a big spline. And remember, a list of length 100 is only 50 points! In my case, my lot is 132 feet long and I'm including 20 feet at front and back. I measured the elevation at least every four feet. That's 44 points including the end points. But I actually had to measure every foot in some places to capture sharp changes in elevation. Which is how I got up over 50 points, and a list length over 100.
 

ajayre

Alibre Super User
Thanks Andy.
Before the recent update, I used AddSplineThroughPoints (sp?) but that seems to have disappeared.

It's been renamed to AddBSpline. There are now two versions of AddBSpline. One adds a spline through a set of points and the other is the same as the older version that uses control points and knot vectors.

Andy
 
Top