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

Could not determine the Run mode of this Dynamo script! #32

Closed
Bulkov opened this issue Apr 22, 2019 · 19 comments
Closed

Could not determine the Run mode of this Dynamo script! #32

Bulkov opened this issue Apr 22, 2019 · 19 comments
Assignees
Labels

Comments

@Bulkov
Copy link

Bulkov commented Apr 22, 2019

I am trying to use this tool to iterate a dynamo script through many models with one click. I keep getting the error message: "Could not determine the Run mode of this Dynamo script!" I have tried starting brand new project and brand new graphs. I have made sure I only have one version of dynamo installed. What else am I missing? I am trying to convert my simple graph into designscript so maybe if I can get some help doing that I could bypass needing to run via Dynamo. I will attach where I am with the script. Thanks to anyone who can help!

Scripting.pdf

@DanRumery
Copy link
Contributor

DanRumery commented Apr 23, 2019

@Bulkov Hi there

It may be to do with a new Dynamo workspace file format... can you make a copy of your script, remove whatever is there and send me the file? I suspect I'll need to account for the newer format in Dynamo 2.x+ versions.

@DanRumery DanRumery added the bug label Apr 23, 2019
@DanRumery DanRumery self-assigned this Apr 23, 2019
@Bulkov
Copy link
Author

Bulkov commented Apr 23, 2019

Enable Python support and load DesignScript library

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

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

The inputs to this node will be stored as a list in the IN variables.

dataEnteringNode = IN

collector = FilteredElementCollector(doc)

filter = ElementCategoryFilter(BuiltInCategory.OST_RvtLinks)

links = collector.WherePasses(filter).ToElements()

Assign your output to the OUT variable.

OUT = links

Is this what your looking for? Sorry for being so dense.

@Bulkov
Copy link
Author

Bulkov commented Apr 23, 2019

lol that looks like crap. The bold is comments obviously. sorry

@Bulkov
Copy link
Author

Bulkov commented Apr 23, 2019

Here are all the errors I am having.

Second%20Error|690x335 First%20Error|690x336 Rest%20of%20Second%20Error|690x324

Here is my starting window for the Batch Processor.
Batch%20Processor%20Window|690x251 !

@Bulkov
Copy link
Author

Bulkov commented Apr 23, 2019

Here are all the errors I am having.

First Error
Rest of Second Error
Second Error
Batch Processor Window

Second Error
Batch Processor Window
First Error
Rest of Second Error
Rest of Second Error
Second Error
Batch Processor Window
First Error

Here is the start window for the Batch Processor. Sorry about the wonky posts. First post on github.

Batch Processor Window
First Error
Rest of Second Error
Second Error

@DanRumery
Copy link
Contributor

DanRumery commented Apr 23, 2019

Sorry I wasn't clear, I just need a copy of your Dynamo script workspace file (.dyn). You can remove nodes if you want before attaching it, I just need to see the file format itself (it's probably a json or xml file).

@Bulkov
Copy link
Author

Bulkov commented Apr 23, 2019

OverlayLinks.zip

@Bulkov
Copy link
Author

Bulkov commented Apr 23, 2019

I made it with 2.x so im guessing your right it is json and the Batcher is for xml? If you get this to work I can't even explain how much of as bad ass you will make me look like. I am trying to delve further into the rabbit hole of pythonshell, and designscript to simplify my graphs and make things a little more user friendly for my firm. I appreciate you responding so quickly. It seems like this community of developers is extremely helpful. Hopefully one day I can be on your end of the stick and help develop more.

@DanRumery
Copy link
Contributor

Yep the error is due to the change in format to JSON for Dynamo 2+. I didn't account for that probably because my test scripts were upgraded from Dynamo 1.3 so they were still in XML format.

I'll release a new version over the next day or so with the fix and get you to test that the fix works for your script. (You could try building from source code with the latest changes/commits if you feel confident doing so, or just wait until I've released the new version...)

Apologies about the glitch and thanks for reporting this because I probably wouldn't have noticed a problem for a while!

BTW the error messages that start with [REVIT ERROR MESSAGE] are actually unrelated to this issue. RBP reports the internal Revit error stream which may be picking up messages from other addins or internal Revit modules. You can probably ignore them. I report them just in case there is something useful in them, for instance if Revit crashes and reports an error before doing so.)

@DanRumery
Copy link
Contributor

As for developing programming skills, the best way to learn it is just to dive in and struggle until it starts to become easier. :) Like anything it takes practice. I would definitely recommend learning python (IronPython in particular for Revit API development). C# isn't too hard after learning IronPython as they share the same windows API (.NET).

@Bulkov
Copy link
Author

Bulkov commented Apr 24, 2019 via email

@Bulkov
Copy link
Author

Bulkov commented Apr 24, 2019

Lol. The pyRevit guy literally just went over starting and commiting transactions.

@Bulkov
Copy link
Author

Bulkov commented Apr 24, 2019

Dan,

I just wanted to update you on my progress. I was able to convert the dynamo graph I wanted to run into a stand alone python script. Unfortunately I am still running into errors. Maybe you could take a look at what I have and throw me a bone to make my .py file able to run with your batch processor. When I run the script in the python shell it works beautifully. I am attaching all my log files from today as well as the script that runs fine in shell but not during batch. Hopefully it is just one post and everything formats well. :)
First Python w-imports.txt
BatchRvt_20190424_131244_330.log
BatchRvt_20190424_131540_955.log
BatchRvt_20190424_131844_846.log
BatchRvt_20190424_133856_868.log
BatchRvt_20190424_133856_868.txt
BatchRvt_20190424_134305_271.log
BatchRvt_20190424_134305_271.txt
BatchRvt_20190424_125103_084.log
BatchRvt_20190424_125103_084.txt

@DanRumery
Copy link
Contributor

Hi @Bulkov

I've uploaded a pre-release with support for newer JSON-based Dynamo workspace files. Can you remove the previous installed version, install the new version (1.5.1) and let me know if that solves this particular issue for you?

https://github.com/bvn-architecture/RevitBatchProcessor/releases/tag/v1.5.1

@DanRumery
Copy link
Contributor

@Bulkov The python task script will need some initialization code specific to RBP. If you generate a new python script via the RBP GUI (the 'New Script' button) and inspect the new script, you'll see what that initialization code looks like.

image

You'll notice that the initialization code sets the Revit document to doc and the UIApplication instance to uiapp. If you use that initialization code and use these variables instead of __revit__.XXX variables then your code is more likely to work.

@DanRumery
Copy link
Contributor

DanRumery commented Apr 25, 2019

@Bulkov Also, regarding the save file dialog dismissed in the log file output, this is because RBP leaves it up to your python or Dynamo script to perform a Save (or Synchronize) as needed. RBP can open, detach or create a new local file, but the rest is left up to the script to perform mostly because there are a lot of different potential workflows there.

@Bulkov
Copy link
Author

Bulkov commented Apr 25, 2019

@DanRumery ,

Awesome! Thanks Man! It worked great but of course did not save. So I will build something into my graphs and scripts. Thanks for the heads up on that initialization code. Do you mention that in the original post for RBP? If so, sorry for not looking a little harder.

Best,

@Bulkov
Copy link
Author

Bulkov commented Apr 25, 2019

Should I close this issue? or do you do that? I would assume you can since its your project. As far as I am concerned my issue is solved. I will let you know if I find anymore bugs.

@Bulkov Bulkov closed this as completed Apr 25, 2019
@DanRumery
Copy link
Contributor

Thanks @Bulkov glad it worked.

I do mention it in the README but I should probably add a FAQ/Wiki to avoid confusion.

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

No branches or pull requests

2 participants