Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BB nodes will return null if not located in default packages folder #15

Closed
andydandy74 opened this issue Mar 24, 2016 · 8 comments
Closed
Assignees

Comments

@andydandy74
Copy link
Collaborator

After moving my packages to a custom folder I noticed that BB nodes would return null.
The reason for this is that the Python scripts are looking for bumblebee.py in the default package location. A possible solution for this would be to have your script look at the package folder paths stored in DynamoSettings.xml, iterate through them and try to locate the file that way.

@ksobon
Copy link
Owner

ksobon commented Mar 24, 2016

Great suggestion, I will have that incorporated. Yes, originally when I wrote it I don't think that people could actually define their own custom location for packages. Great catch.

@ksobon
Copy link
Owner

ksobon commented Mar 24, 2016

This should get the job done:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

import os
appDataPath = os.getenv('APPDATA')
dynPath = appDataPath + r"\Dynamo\0.9"
if dynPath not in sys.path:
    sys.path.Add(dynPath)

bbPath = appDataPath + r"\Dynamo\0.9\packages\Bumblebee\extra"
if bbPath not in sys.path:
    try:
        sys.path.Add(bbPath)
        import bumblebee as bb
    except:
        import xml.etree.ElementTree as et
        root = et.parse(dynPath + "\DynamoSettings.xml").getroot()
        for child in root:
            if child.tag == "CustomPackageFolders":
                for path in child:
                    if path not in sys.path:
                        sys.path.Add(path)
        import bumblebee as bb

I will post update all of the nodes and post it to package manager.

@ksobon
Copy link
Owner

ksobon commented Mar 24, 2016

Ps. Let me know if this solved it and i will close this issue.

Cheers!

@ksobon
Copy link
Owner

ksobon commented Mar 24, 2016

pushed a package update out...should fix that.

@ksobon ksobon closed this as completed Mar 24, 2016
@andydandy74
Copy link
Collaborator Author

Doesn't work for me. Maybe because path is not a string?

Please note: I copy/pasted this into an Excel Read node in BB 2016.1.22 as that is the last 0.9.0 compatible version. So if it does work under 0.9.1 please ignore - I created a local 0.9.0 compatible version that has our package path hardcoded...

@andydandy74
Copy link
Collaborator Author

Just couldn't leave this alone... :-)
This should work:

for path in child:
   path_bb = path.text + "\Bumblebee\extra"
   if path_bb not in sys.path:
      sys.path.Add(path_bb)

@andydandy74 andydandy74 reopened this Mar 29, 2016
@ksobon
Copy link
Owner

ksobon commented Mar 29, 2016

yes, you are right my friend. Please see the latest in package manager.

@ksobon ksobon closed this as completed Mar 29, 2016
@mkdrafter
Copy link

Im currently experiencing same issue on Dynamo 1.0 and Bumblebee 2016.6.30. I posted screenshots to the Dynamo forum.

https://forum.dynamobim.com/t/bumblebee-null-values-w-custom-installation-location-on-a-network-drive/5400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants