I am newish to Rhino but somewhat familiar with python. I want to be able to create a small app that runs along side Rhino and is able to perform some analysis and manipulate the model I am currently working on. For example I would like click a button on a GUI and it opens a prompt in the rhino window I have open to select a surface that it will then section and reports the area and perimeter. I am currently working in Pycharm partly due to it is what I am used to, I have built several methods with it (in python 3.13), and finally I feel like it will be the easiest way to interface with other software packages such as FEmap. Is this possible? From what I have read rhinoinside opens a new instance of rhino so it wouldn’t be possible to do this but I could very well be wrong.
I have experimented with rhino inside to try and draw a line as a test with no luck so any help or guidance that someone could provide would be much appreciated.
It’s straightforward inside Rhino with RhinoPython, with or without Eto Forms for a litte GUI.
If a separate Python instance makes the changes to an active .3dm file, alongside a distinct Rhino instance with the same file open, even if this works at all (doesn’t Rhino lock the file?) I shouldn’t be at all surprised if the changes are lost when the user next saves the file inside Rhino.
It would work to make those changes to the file before Rhino is opened though, if you really really want to work outside Rhino with the raw file, with none of the helper libraries
Yes, I have. Rhinoinside seems to be functioning correctly however I can’t figure out how to modify a file I have open in rhino. If I was running this within rhino script context would take care of it but in the external IDE I am unable to import it. Is there a way around this?
In RhinoPython or Grasshopper, I often append to sys.path the path of whatever Python package I’m working on in an external IDE, and just run a launcher script to import it, run some smoke tests on the fly, and then delete it from sys.modules (so the next time I run the launcher, Python reimports the new version, with all the changes I’ve made in the IDE since then)
Otherwise, unfortunately I think this is not possible (or falls into the murky waters of hacking, not robust software solutions).
It’s the Rhino user who created that file’s prerogative to make changes to it, and save that file. That user needs to initiate changes to their file, even ones made by Python scripts.
If it’s still necessary to work with a Rhino file from an external process, copy it, make the changes to that copy, and let the user in Rhino import it in, or close their existing file and open the modified copy.