1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Bspline.Subdivide error

Discussion in 'Alibre Script' started by NateLiqGrav, Jun 23, 2019.

  1. NateLiqGrav

    NateLiqGrav Alibre Super User

    When I try to Subdivide a Bspline found in a sketch I get the error:
    SystemError: The type initializer for 'TinySpline.tinysplinecsharpPINVOKE' threw an exception.

    Code:
    prt = CurrentPart()
    mysketch = prt.GetSketch('Sketch<1>')
    for fig in mysketch.Figures:
        if 'Bspline' in str(fig):
            segments = fig.Subdivide(10)
    Perhaps related to https://www.alibreforum.com/forum/index.php?threads/sample-script-error.20704/

    @ajayre I'm using the AlibreScriptVersion 1149
     
  2. ajayre

    ajayre Alibre Super User

    Please upload a part with a sketch that reproduces this. Thanks. Andy
     
  3. NateLiqGrav

    NateLiqGrav Alibre Super User

    I changed the script to print out the figures it finds before attempting the Subdivide on the Bspline. These changes are saved in the script in the test part.
    This test part was made at work with Alibre Design Expert
    Version: 2018.2 64-bit [Build 19071]
    and AlibreScriptVersion 1080

    Here is my Console output with full error msg.
    Code:
    >>>
    
    I found a Line: Line from -43.9012384414673,51.3844060897827 to -43.9012384414673,-48.9897918701172
    
    I found a Line: Line from -43.9012384414673,-48.9897918701172 to 56.4729595184326,-48.9897918701172
    
    I found a Line: Line from 56.4729595184326,-48.9897918701172 to 56.4729595184326,51.3844060897827
    
    I found a Line: Line from 56.4729595184326,51.3844060897827 to -43.9012384414673,51.3844060897827
    
    I found a Bspline: Bspline of order 4 with 11 points and 15 knot vectors
    System.TypeInitializationException: The type initializer for 'TinySpline.tinysplinecsharpPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'tinysplinecsharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
       at TinySpline.tinysplinecsharpPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_tinysplinecsharp(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
       at TinySpline.tinysplinecsharpPINVOKE.SWIGExceptionHelper..cctor()
       --- End of inner exception stack trace ---
       at TinySpline.tinysplinecsharpPINVOKE.SWIGExceptionHelper..ctor()
       at TinySpline.tinysplinecsharpPINVOKE..cctor()
       --- End of inner exception stack trace ---
       at TinySpline.tinysplinecsharpPINVOKE.new_BSpline__SWIG_2(UInt32 jarg1, UInt32 jarg2, UInt32 jarg3, Int32 jarg4)
       at TinySpline.BSpline..ctor(UInt32 nCtrlp, UInt32 dim, UInt32 deg, BSplineType type)
       at AlibreScript.API.Bspline.GetPointAt(Double u)
       at AlibreScript.API.Bspline.GetLengthtoPoint(Double u)
       at AlibreScript.API.Bspline.get_Length()
       at AlibreScript.API.Bspline.Subdivide(Int32 Segments)
       at Microsoft.Scripting.Interpreter.FuncCallInstruction`3.Run(InterpretedFrame frame)
       at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
       at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
       at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
       at Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
       at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
       at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
       at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
       at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
       at AlibreScript.UI.IronTextBoxControl.#ijb(Object #9A)
    >>>
     

    Attached Files:

  4. ajayre

    ajayre Alibre Super User

    This is what I get with the 2019 beta (I added a print segments line):

    Code:
    I found a Bspline: Bspline of order 4 with 11 points and 15 knot vectors
    [5.3971973763157353, 31.088732228803622, -16.163945880963578, 20.307646142382957, -23.11158391911669, -3.5273729246614725, -25.539136480363666, -28.37255307912794, -14.638819197637426, -22.209819806157476, 5.8193532764339047, -27.379551703061225, 24.478641412965594, -35.756875485445299, 31.972138831813002, -11.905346052115085, 38.852477067317785, 12.111487145496898]
    
    However - I have not changed anything in this area.

    The error message says that it is missing tinysplinecsharp.dll or TinySpline.dll. Perhaps a reinstall is needed?

    Andy
     
  5. NateLiqGrav

    NateLiqGrav Alibre Super User

    This is what I get on 2019 beta after Uninstall -> Restart -> CCleaner (temp files and registry) -> Download Beta -> Install -> Restart
    Alibre Design Expert
    Version: 2019BETA 64-bit [Build 20043]

    Code:
    I found a Line: Line from -43.9012384414673,51.3844060897827 to -43.9012384414673,-48.9897918701172
    
    I found a Line: Line from -43.9012384414673,-48.9897918701172 to 56.4729595184326,-48.9897918701172
    
    I found a Line: Line from 56.4729595184326,-48.9897918701172 to 56.4729595184326,51.3844060897827
    
    I found a Line: Line from 56.4729595184326,51.3844060897827 to -43.9012384414673,51.3844060897827
    
    I found a Bspline: Bspline of order 4 with 11 points and 15 knot vectors
    Traceback (most recent call last):
      File "<string>", line 8, in <module>
      File "<string>", line 8, in <module>
    SystemError: The type initializer for 'TinySpline.tinysplinecsharpPINVOKE' threw an exception.
     
  6. ajayre

    ajayre Alibre Super User

    Please check if both the DLLs I mentioned are in the AlibreScript add-on folder inside the AD installation. Thanks. Andy
     
  7. NateLiqGrav

    NateLiqGrav Alibre Super User

    Both files are there:
    "C:\Program Files\Alibre Design\Program\Addons\AlibreScript\tinysplinecsharp.dll"
    "C:\Program Files\Alibre Design\Program\Addons\AlibreScript\TinySpline.dll"
     

Share This Page