dimven / NavisPythonShell

An IronPython console for Navisworks
MIT License
69 stars 14 forks source link

Navisworks crashes when click on NPS #6

Closed MM-SalvoDragotta closed 2 years ago

MM-SalvoDragotta commented 4 years ago

I've recompiled in both manage 2018 and 2019 but Navisworks crashes when I try to open NPS. Any idea why?

dimven commented 4 years ago

Hi,

Did you have any problems when compiling? I just made some minor cleanup of the csproject files (removed the reference to a specific version of the api dll) and had to migrate them to NET 4.7 because that's what the 2020 was targeting.

Could you please try the 2020 release and the updated installation readme on your end and see if that helps?

MM-SalvoDragotta commented 4 years ago

No problems when compiling. I tried the 2020 version and same story. When I click on NPS, it spins for a bit but Navisworks crashes at the end with no messages. I'm using Manage 2020 (64bit) version 17.0.1336.83. could there be anything preventing add-ins from running?

Also how do I change the name of the tab in the Ribbon to say "Python Shell" instead of Tool add-ins 1?

image

dimven commented 4 years ago

Can't imagine what would cause it. Try setting a breakpoint at the start of the Execute method and debugging: image

Navisworks is kinda backwards about creating custom tabs. The best example on how to do it is probably the old CASE bcf plugin:

https://github.com/johnpierson/case-apps/blob/9c768658f1224a5ccd69ea06c5532ba05f4eeb6f/2015/Case.Navis2BCF/Case.Navis2BCF/CASERibbon.cs#L14

The command class needs to inherit from CommandHandlerPlugin instead of AddInPlugin and you need to create a special ribbon layout xml that you feed in as an argument. It should look like this one:

https://github.com/johnpierson/case-apps/blob/9c768658f1224a5ccd69ea06c5532ba05f4eeb6f/2015/Case.Navis2BCF/Case.Navis2BCF/CustomRibbon.xaml

pabloderen commented 4 years ago

Try finding the dump file created by Navisworks and debug it with Visual Studio.

You can access the actual exception message there.

On Tue, Sep 10, 2019, 4:03 PM MM-SalvoDragotta notifications@github.com wrote:

No problems when compiling. I tried the 2020 version and same story. When I click on NPS, it spins for a bit but Navisworks crashes at the end with no messages. I'm using Manage 2020 (64bit) version 17.0.1336.83. could there be anything preventing add-ins from running?

Also how do I change the name of the tab in the Ribbon to say "Python Shell" instead of Tool add-ins 1?

[image: image] https://user-images.githubusercontent.com/54158123/64656417-b2a48f00-d472-11e9-8aee-cb4886b3dcd5.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dimven/NavisPythonShell/issues/6?email_source=notifications&email_token=ADL2CE6LPOUJNSA7ORJDOO3QJARVFA5CNFSM4IUVH4J2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6MX6MI#issuecomment-530153265, or mute the thread https://github.com/notifications/unsubscribe-auth/ADL2CE2MOYEXZWED27U4M6DQJARVFANCNFSM4IUVH4JQ .

MM-SalvoDragotta commented 4 years ago

Try finding the dump file created by Navisworks and debug it with Visual Studio.

You can access the actual exception message there. …

Thanks! I got this msg

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Autodesk.Navisworks.Api.dll Could not load file or assembly 'PythonConsoleControl, Version=2017.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

image

sweco-sekrsv commented 4 years ago

I got something similar. I'm attaching my error dumps. I'm using the precompiled version from here: https://github.com/dimven/NavisPythonShell/releases/download/2020.0.1/NavisPythonShell_2020.zip

NavisPythonShell_2020_dump.zip

dimven commented 4 years ago

Did you download it from the releases? Is it possible the zip / dlls were blocked by windows? Try selecting Properties from the right-click menu on the zip before unpacking, or the dlls after unpacking, and check if there's an Unblock button/checkbox.

sweco-sekrsv commented 4 years ago

Yes, the zip is from the releases (2020.0.1). I unblocked the zip before unpacking. I have checked the plugin folder and the dll files have no unblock.

I'm using Navisworks 20 Version: 17.1.1338.62

sweco-sekrsv commented 4 years ago

I checked the error dump in Visual Studio and I got the same error as @MM-SalvoDragotta .

System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'NpsRuntime, Version=2017.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. Source= StackTrace:

I noticed it says **2017.0.0.0** while my Navisworks version is **17.1.1338.62**. Do you think this is the problem? Attaching another dump as well. [dumpdata.zip](https://github.com/dimven/NavisPythonShell/files/3722371/dumpdata.zip)
dimven commented 4 years ago

Not sure why that would be happening.

NpsRuntime is one of the dlls that gets compiled and referenced in the repo. Its version is hard-coded here: image

We're referencing it in the main NPS dll but it's reference without a specific version: image

Is it possible you have an older version of NpsRuntime.dll stored somewhere that is somehow creating a conflict?

sweco-sekrsv commented 4 years ago

Thank you for trying to sort this out! The only NpsRuntime.dll is the one I first downloaded from your releases here: https://github.com/dimven/NavisPythonShell/releases/download/2020.0.1/NavisPythonShell_2020.zip

Not sure what more to test!

dimven commented 4 years ago

Sorry I couldn't be of more help. Not sure either what else could be causing the dll to fail to load. Do you have any navisworks plugins installed? Maybe one of them is loading a different version of a dependent assembly?

spencerzha0 commented 4 years ago

I've got the same issue when try to run RPW then NW will crashes.

hoggs commented 4 years ago

Hi! I've had the exact same issues as described above, and it was very frustrating. Anyway, after some digging I found that the problem (at least for me) is that the dependencies for the NPS plugin are not found when executing it. ref.: Autodesk Forum

I've currently installed NPS to "%Program Files%\Autodesk\Navisworks Manage 2020\Plugins" and not "%APPDATA%\Autodesk Navisworks Manage 2020\Plugins", but had the same issues with both locations.

So by copying the NPS dependencies to the "%Program Files%\Autodesk\Navisworks Manage 2020/Dependencies" directory - it now works!

tomaszbielenin commented 4 years ago

The way @hoggs described above worked perfectly for me e.i. extracting NavisPythonShell_2020.zip to "%Program Files%\Autodesk\Navisworks Manage 2020\Plugins" and then copying files directly to the "%Program Files%\Autodesk\Navisworks Manage 2020/Dependencies" allowed me to run NPS. Thanks for sharing!

dronov-dmitry commented 1 month ago

NPS dependencies

Hallo I have the same problem I copy NavisPythonShell_2020.zip to "%Program Files%\Autodesk\Navisworks Manage 2020\Plugin But it still have problem I copy NPS to "%Program Files%\Autodesk\Navisworks Manage 2020/Dependencies" But it still have problem Can you help me please? What else problem can be? How can i fix it?

dronov-dmitry commented 1 month ago

I found that crushed typeof(NpsConfig)

image