Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CPython and PyRevit

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
pedramno
737 Views, 8 Replies

CPython and PyRevit

Hello All,

first of all, this question might be repetitive. if so, please point me to the right solution.

Here is my question: I need to use CPython via PyRevit to have access to libraries such as numpy and pandas. At the same time, I want to take advantage of Pyrevit’s capabilities such as forms etc. As far as I understood, I can’t have both of these on a single script file. If I got this correctly, is there any way to do this?

Thanks in advance

Labels (1)
8 REPLIES 8
Message 2 of 9
jeremy_tammik
in reply to: pedramno

Sounds like a sensible question to me. However, this is not the optimal place for it. This forum is for discussing the Revit API, pure and simple. You might want to check out the issues and solutions in the pyRevit repository:

  

https://github.com/eirannejad/pyRevit

  

Quite a few people here in the forum also use pyRevit, though, and may be able to help. I am sure your goal can be achieved. There are many ways to disentangle and compartmentalise functionality. One important aspect to ponder is: how tightly are your Revit API bit and pieces interwoven with your numpy and pandas bits? I should hope that they are already pretty well decoupled to start with. In that case, you can make use of numerous IPC solutions to establish the connection required:

   

https://en.wikipedia.org/wiki/Inter-process_communication

   

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 3 of 9
pedramno
in reply to: jeremy_tammik

Thanks very much, Jeremy. I also checked the pyRevit forum and asked the same question there. The numpy part is quite decoupled since it is meant to help me with the data exchange process from other data sources and after that point, everything would be focused on Revit APIs. I'm not pretty familiar with IPC solutions but I'll take a look at them to familiarize myself more with them.
Message 4 of 9
RIPENG
in reply to: pedramno

Dealt with the same challenge a little while back.

 

Please click here for a short discussion on Python subprocess in the Revit/pyRevit context.

 

While I am not a Revit API / Python / pyRevit expert I can report that subprocess worked well enough. Learning subprocess should be a productive use of time assuming the underlying characteristics are a good match for your application.

 

-Jake

Message 5 of 9
pedramno
in reply to: RIPENG

Thanks, Jake. I tried the same process, and it also worked perfectly for my case. Appreciate it.

Message 6 of 9
RIPENG
in reply to: pedramno

Thanks for giving it a go. And thanks for the feedback.

 

-Jake

Message 7 of 9
minet.axel
in reply to: pedramno

Hello is there a similar solution for c#? I want to solve this problem of dll hell.

Message 8 of 9
jeremy_tammik
in reply to: minet.axel

Almost everything that exists in Python is open source, so you can of course re-implement the same in C#. Many other solutions have also been discussed. In general, the easiest solution is to use the same DLL in all your components and avoid the problem completely. The second-simplest solution is to decouple the components from each other and use some method to communicate the relevant data between them, e.g., IPC. Here is a collection of related discussions by The Building Coder:

 

 

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 9 of 9
jeanmarc.couffin
in reply to: pedramno

For the sake of completeness, questions related to pyRevit should be routed to https://discourse.pyrevitlabs.io/

 

This type of question has been formulated or answered in many different ways on the pyRevit forum https://discourse.pyrevitlabs.io/search?q=subprocess

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community