-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dynamo Process checker #1
Comments
Ah that makes sense. Will end up adding that soon. One thing is, I would want to ensure that the Revit version matches the one I am checking it from. In the case of someone running 2022 and 2023 |
That makes sense to me! I could see this happening with multiple revit
sessions open for sure. Will get that added!
…On Mon, Sep 26, 2022 at 2:44 AM Brendan Cassidy ***@***.***> wrote:
@johnpierson <https://github.com/johnpierson> Probably worth adding a
process checker to check if Dynamo is in within memory. If dynamo is within
memory it will stop you from being able to delete or add new packages.
[image: image]
<https://user-images.githubusercontent.com/14090637/192232632-be7a42c8-9984-4163-afb0-ad412574991f.png>
You will need to add "using System.Diagnostics;" at the top of your code.
` ///
/// Gets all processes running on the machine then checks if they are
"Revit" based. Then if it does find any it checks if Dynamo dll's are in
memory.
/// If yes it changes Global "IsDynamoInMemory" to True
///
public static void CheckIfProcessContainDynamo()
{
List tempBoolList = new List();
foreach (Process process in Process.GetProcesses())
{
if (process.ProcessName.ToLower().Contains("revit"))
{
foreach (ProcessModule module in process.Modules)
{
if (module.FileName.ToLower().Contains("dynamo"))
{
tempBoolList.Add(true);
}
}
}
}
if (tempBoolList.Count() > 0)
{
Globals.IsDynamoInMemory = true;
}
else
{
Globals.IsDynamoInMemory = false;
}
}`
—
Reply to this email directly, view it on GitHub
<#1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYD5VB3CKATD6RQ4NYHLHDWAFO6RANCNFSM6AAAAAAQVR7BBQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@johnpierson Probably worth adding a process checker to check if Dynamo is within memory. If dynamo is within memory it will probably error out when either deleting or add new packages.
EG. Dynamo could be loaded within another revit instance or even previously been loaded within that instance, and therefore will error out this addon because it cannot delete or install the new packages.
Run this method to apply a value within the globals parameter, then if the parameter is true it wont download packages but if false it will. Or modify this method to output a bool as part of a check.
You will need to add "using System.Diagnostics;" at the top of your code, and add a new Globals called IsDynamoInMemory.
Edit: I have changed "Process.GetProcesses()" to "Process.GetProcessesByName("revit")" and got rid of the IF statement from the attached code but is still showing in the image.
The text was updated successfully, but these errors were encountered: