By the way, are all these explained methods for Dynamo Sandbox or will they also work for Revit Dynamo?
The current version is compatible with 3.9
Yes
Have you changed the __init__.py
file in the openseespywin
folder?
Have you added the path to TCL?
If you are getting an error, upload a screenshot with the error expanded so it may be possible to diagnose any issues
Thank you Mike for looking into this. Please see below:
-
installing openseespy: it is installed. see below.
-
tcl is installed. (I don’t understand why we need to install this. but I did. see below)
-
I changed line 14 from “if ‘DLLs’ in path:” to “if ‘Tcl86’ in path:”. see below:
-
here is the python script and the error I get in Revit Dynamo
What is the error when you try this code
import sys
from pathlib import Path
sys.path.append(str(Path.home().joinpath("AppData\\Local\\Apps\\Tcl86\\bin")))
import openseespywin
Solved with appending the address to the package location.
I don’t know why it was not looking at that location.
Thank you for all the help, Mike!
You can add the library path so that it is not hard coded as follows
import sys
import sysconfig
# ...
# site-package library paths
sys.path.append(sysconfig.get_path("platlib"))
So I have been using the openseespy successfully for a few cases. Now I am trying to see if I can use some visualization packages. I am looking at opsvis Welcome to Opsvis documentation! — opsvis 0.99.1 documentation
@Mike.Buttery just checking if you have tried this or anything similar to it. I successfully used it in a normal pyhton file but in Dynamo the plot does not show up. It does not give any errors though.
The neatest trick I’ve seen to getting Matplotlib to show anything in Dynamo is to have it create a bitmap stream. This you can feed to the Dynamo Watch Image Node.
Python 3 Skelitonization - plt.show() not work - Developers - Dynamo
It looks like the path only needs to be added once, at least per user. I needed this code in Dynamo Sandbox 2.19 with Python 3.9.12 to get the shapely package to be found. Then ran Revit with the same Python version and ‘import shapely’ worked instantly.
Thanks to the discussion here we were able to identify a bug in Dynamo around that missing site-packages path. Should be fixed in the next release! (or now in a daily build if you’re adventurous) It’s also fixed in the new PythonNet3 Python engine available on the package manager for Dynamo 3.3+.