Unexpected error during GenericAnalysis execution with Dynamo integration

Hello @mslootweg

I installed the VIKTOR cli, Formit, the generic worker, and I also ran the create first app tutorial successfully. However, on attempting to run the dynamo integration, I am getting an execution error at line 68 of the code, which was copy-pasted from the dynamo tutorial in the VIKTOR docs. See the error below.

Traceback (most recent call last):
  File "viktor_connector\connector.pyx", line 295, in connector.Job.execute
  File "viktor\core.pyx", line 1926, in viktor.core._handle_job
  File "viktor\core.pyx", line 1911, in viktor.core._handle_job._handle_view
  File "viktor\views.pyx", line 1944, in viktor.views.View._wrapper
  File "C:\Users\Bayonle\viktor-apps\my-dyn-app\app.py", line 68, in geometry_and_data_view
    generic_analysis.execute(timeout=60)
  File "viktor\external\external_program.pyx", line 385, in viktor.external.external_program.ExternalProgram.execute     
viktor.errors.ExecutionError: Something went wrong during the execution.

Since the analysis is not being carried out, could it be an issue with my Formit installation? I have opened the software and it works correctly and I do have a license. In the VIKTOR developer environment, my worker integration is also green.

Thanks for your help.

Hi Bayo,

The error occurs because something went wrong during the integration calculation, which is sent via the GenericAnalysis object. Noting that the worker integration is showing that it is connected (green sign), I suspect that it has to do with the configuration of your worker. Could you check that all the paths defined in the config file of your worker is defined correctly?

Hi Marcel

My the config.yaml was set up as per the docs. See below.

# CONFIGURATION FILE FOR VIKTOR WORKER TO RUN GENERIC EXECUTABLE / SCRIPT
#
# > Required keys: executables (dictionary with name of executable as key containing key-value pairs for path, arguments and working directory) and maxParallelProcesses
# > The key of executable is used to distinguish between different jobs that can be transferred to the worker
# > Use either double quotes: "example", or single quotes: 'example' 
# > Double quotes require special characters to be escaped, whereas single quotes can be used for raw strings
# > Trailing slashes are not required in paths
# > If you do not want to call an executable set executables to: {}
# > If the executable does not take any additional arguments specify arguments as an empty sequence: []
executables:
  dynamo:
    path: 'C:\Program Files\Autodesk\FormIt\DynamoSandbox\DynamoWPFCLI.exe'
    arguments:
    - '-o'
    - 'input.dyn'
    - '-v'
    - 'output.xml'
    - '-gp'
    - 'C:\Program Files\Autodesk\FormIt' 
    - '-g'
    - 'geometry.json'
maxParallelProcesses: 1 # must be one, please do not change

Could you verify that the path defined in on the key path exists on your device?

And could you check that the C:\Program Files\Autodesk\FormIt also exists?

Hello Marcel
All present.

For others on the community: after Bayo and I had a call to dive into the issue at hand, it seemed that the DynamoWPFCLI gave an error during execution, due to not being able to find a certain path (ASM or LibG, if I recall correctly).

@Bayo , could you keep us updated on the steps you followed once you have solved this?

1 Like

Hi Marcel

Thanks for all the help last week.
I have started a thread querying this issue on the Dynamo forum.
I will keep you updated.
Thanks.

@mslootweg
I was asked the question in the image below on the Dynamo blog. Can you please provide some clarification? Also, the absence of the ASM/LibG libraries is not the issue. The command we entered last week had a little problem. The path at the end of the command did not have quotes. Here is the correct command: "C:\Program Files\Autodesk\FormIt\DynamoSandbox\DynamoWPFCLI.exe" -o input.dyn -v output.xml -gp "C:\Program Files\Autodesk\FormIt" -g geometry.json

Hi Bayo,

It seems, referring to the thread on the Dynamo forum, that the issue is resolved. Is that correct?

Hi Marcel

Yes and No.
I still could not get the Formit Dynamo sandbox CLI to work, but using a version of the DynamoWPFCLI that comes with the Dynamo Sandbox did the trick. So as a workaround, I will reconfigure the worker’s config file to reference the new Sandbox installation. I will post the solution here when I get it to work.
Thank you.

I think I now understand. I was confused by you mentioning Formit Dynamo Sandbox, as you get Dynamo Sandbox and Dynamo for Formit (as well as many others, such as Dynamo for Revit, Civil3D, etc.). The tutorial presents a case integrating with Dynamo Sandbox, rather than Dynamo for .

That is probably the reason it did not work. The reason why you still need either Formit or Revit is to make use of the geometry engine that these software provide to generate the 3D geometry.

1 Like

Hello Marcel

I think the generic analysis issue has been solved. Here is what I entered into the worker’s config file:

executables:
  dynamo:
    path: 'C:\Users\*username*\viktor-worker\DynamoSandbox\DynamoWPFCLI.exe'
    arguments:
    - '-o'
    - 'input.dyn'
    - '-v'
    - 'output.xml'
    - '--GeometryPath'
    - 'C:\Program Files\Autodesk\FormIt' 
    - '-g'
    - 'geometry.json'
    workingDirectoryPath: 'C:\Users\*username*\viktor-worker'
maxParallelProcesses: 1 # must be one, please do not change

I placed the Dynamo Sandbox download in a “viktor-worker” folder under my user name. The code fails at the following line where the output file is to be converted to a glb using the convert_geometry_to_glb method. See the error below:

Traceback (most recent call last):
  File "viktor_connector\connector.pyx", line 295, in connector.Job.execute
  File "viktor\core.pyx", line 1926, in viktor.core._handle_job
  File "viktor\core.pyx", line 1911, in viktor.core._handle_job._handle_view
  File "viktor\views.pyx", line 1944, in viktor.views.View._wrapper
  File "C:\Users\Bayonle\viktor-apps\my-dyn-app\app.py", line 72, in geometry_and_data_view
    glb_file = convert_geometry_to_glb(geometry_file)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "viktor\external\dynamo.pyx", line 261, in viktor.external.dynamo.convert_geometry_to_glb
  File "viktor\external\dynamo.pyx", line 240, in viktor.external.dynamo.convert_geometry_to_glb._add_path_to_scene        
  File "C:\Users\Bayonle\viktor-apps\my-dyn-app\venv\Lib\site-packages\viktor\_vendor\trimesh\path\path.py", line 104, in __init__
    self.merge_vertices()
  File "C:\Users\Bayonle\viktor-apps\my-dyn-app\venv\Lib\site-packages\viktor\_vendor\trimesh\path\path.py", line 608, in merge_vertices
    points = grouping.merge_runs(inverse[entity.points])
                                 ~~~~~~~^^^^^^^^^^^^^^^
IndexError: index 5 is out of bounds for axis 0 with size 5
2023-08-22 17:02:26.021 INFO    : Connection closed after KeyboardInterrupt

I got it to work. However, it seems the glb converter struggles with more complex geometry.

@mslootweg
I successfully ran the Viktor tutorial .dyn file, as well as another file with more intricate geometry. My initial thought that errors were due to geometry complexity was mistaken. I opened the Dynamo files using Dynamo Sandbox, addressing any errors from missing packages. After granting Dynamo Sandbox permission to execute .dyn files from my app’s directory, they functioned correctly.

However, I observed a potential issue. There are frequent generic analysis and GLB conversion errors when the curves (lines) from the Dynamo script are visible. In contrast, scripts run smoothly when only solid or surface geometry is shown. Could the GLB format or the analysis method be the root cause?

Hi Bayo,

Great to see that you may have found the issue at hand, and have been able to run a successful calculation. I see that this user also struggled with the same error:

Just to be clear on your case, is the error occurring on the Dynamo calculation side, or on VIKTOR’s side (the code of your app)?

Hello Marcel

The error is on Viktor’s side.
I get the generic analysis and glb converter errors very often when line (curve) geometry is visible in Dynamo.

Hi Bayo,

In the latest SDK release we have fixed this issue (SDK v14.6.1 released 🎉).

Thank you for reporting the problem!

No way. So you’re saying I can leave lines on in my app now? Awesome.

Hello @mslootweg @rdejonge

I am trying to visualize the attached geometry.json file on VIKTOR, but I am getting the traceback error below when converting it to a GLB file.
The geometry is shown in the image below.
Please let me know if there is a solution to this.
Thank you.

Traceback (most recent call last):
  File "viktor_connector\connector.pyx", line 295, in connector.Job.execute
  File "viktor\core.pyx", line 1926, in viktor.core._handle_job
  File "viktor\core.pyx", line 1911, in viktor.core._handle_job._handle_view
  File "viktor\views.pyx", line 1944, in viktor.views.View._wrapper
  File "C:\Users\Bayonle\viktor-apps\my-first-app\app.py", line 31, in beam_visualization
    glb_file = convert_geometry_to_glb(geometry_file)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "viktor\external\dynamo.pyx", line 261, in viktor.external.dynamo.convert_geometry_to_glb
  File "viktor\external\dynamo.pyx", line 240, in viktor.external.dynamo.convert_geometry_to_glb._add_path_to_scene
  File "C:\Users\Bayonle\viktor-apps\my-first-app\venv\Lib\site-packages\viktor\_vendor\trimesh\path\path.py", line 104, in __init__
    self.merge_vertices()
  File "C:\Users\Bayonle\viktor-apps\my-first-app\venv\Lib\site-packages\viktor\_vendor\trimesh\path\path.py", line 608, in merge_vertices
    points = grouping.merge_runs(inverse[entity.points])
                                 ~~~~~~~^^^^^^^^^^^^^^^
IndexError: index 5 is out of bounds for axis 0 with size 5

geometry.json (241.2 KB)