Using Rhino3dm in Blender

Hey,

I just pushed the latest changes to the import_3dm repository, so at least re-install the import_3dm.py file as add-on.

Further, make sure you have the latest rhino3dm.py package installed using pip3.7

Hi Nathan.

Thank you for this Blender add-on.

Unfortunately I can’t get this to work. I installed the “rhino3dm” module using the “pip install rhino3dm”.

Now if I install the “import_3dm.py” in Blender 2.80(latest Windows64 version from 30.11.2018) I get the following error:

Traceback (most recent call last):
File “C:\Programe\Blender_2.80\2.80\scripts\modules\addon_utils.py”, line 351, in enable
mod = import(module_name)
File “C:\Users\Alex\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\import_3dm.py”, line 18, in
import rhino3dm as r3d
ModuleNotFoundError: No module named ‘rhino3dm’

Please help-me to fix this error as I can’t find the rhino3dm.py anywhere on my computer. I only have this python file:

C:\Users\-\AppData\Local\Programs\Python\Python37\Lib\site-packages\rhino3dm\_rhino3dm.cp37-win_amd64.pyd

I do need to compile this file and put in some specific directory?

Best regards.

You shouldn’t have to compile anything.

The instructions mentioned to use pip3.7 install --user rhino3dm after installing Python 3.7.1. Using pip3.7 ensures you use the one for your Python 3.7 installation, and --user ensures it is in a location that most likely Blender 2.80 will be able to automatically find.

After importing rhino3dm into Blender it gives me:

<module 'rhino3dm' from 'C:\\Users\\Nathan\\AppData\\Roaming\\Python\\Python37\\site-packages\\rhino3dm\\__init__.py'>

I actually needed to copy the whole rhino3dm folder to my blender\addons folder for it to work after getting it via pip. Now importing…

Nice job Nathan.
FYI:
Note, instances are only coming in as the actual ‘instance’ and not all the references with their transforms applied.
But, got all my rhino layers as Blender collections and all rest of geometry assigned…

@nathanletwory
I’ll probably be poking at this a lot over next month. Would you rather I post feedback here or I noticed you posted in Blender Artists forum as well?

1 Like

Aye, instances aren’t nicely handled yet, although it can be possible. I have logged

Either place is fine.

Thank you. This way is working. I just copied the “rhino3dm” folder from “C:\Users\-\AppData\Local\Programs\Python\Python37\Lib\site-packages” into the “2.80\scripts\addons” folder and now also working here.

I hope we can streamline this at some point, but for now you all get to be my guinea pigs :slight_smile:

Nathan - moving our conversation here as requested.

I am attempting to address the changes required to merge the pull request, but I am in on way a git expert… My branch was several commits ahead and a few behind so to make this “easy” on myself i have deleted that fork archived my local copy and created a new fork with a new branch. As this current pull request will be about changing the project structure I am going to commit a new branch sans any of the features i have added but with the full new project structure I am proposing. Does this make sense?

joel

Hi @joel_putnam,

For future reference: you don’t have to delete your fork in the future. When working on anything for the importer the single most important thing to remember is to always work in a branch in your fork. Don’t do anything in the master branch of your fork. You’ll use that to pull any new changes that may have happened in the upstream repository (my repository).

So, to get the PRs going as I had requested in my code review you can indeed start a new branch on your repository. In that you make the necessary structural changes as you did in your first PR. Mind you to not include any new feature code. When you have made your structural changes you can make the PR as you did with your first attempt.

You can make multiple commits for your branch, but I very well might be squashing them together - nothing you have to worry about though. You will still be the author of the changes (:

Once that PR is in you can ensure you have your fork synced with my repository (upstream). GitHub has clear instructions on how to do that. When done with that you can create new branches for your feature work.

No matter how small a feature is I prefer them to go into new branches. That keeps my work manageable and I hope we can get to a clean commit history that documents well what happened and why.

I appreciate your efforts!

/Nathan

I knew the moment I deleted it there was a “better” way but I had polluted my master branch and it just seemed easier… Seems to me a good read on git is in my future

I have issued a pull for structural changes. Once I work out any changes you request going forward I will work on these in the following order.

  1. Upgrade the latest Rhino3dm and implement unit checking and miss match between files.
  2. Hidden Geometry handling (can this be done with hidden layer? as hidden objects so one feature?)
  3. Hidden Layer handling (see above)
  4. Overwrite/duplicate geometry on import
  5. Overwrite or keep existing blender materials
  6. Open to working on curves or other elements as they become available in Rhino3md

Joel

Github has some really nice docs to help get you started on the process of creating pull requests.
https://help.github.com/articles/fork-a-repo/

1 Like

Thank you for submitting your PR. I’ve reviewed your PR now, mostly cosmetic changes, and it should be good to get in. I leave the honor of making those changes to you. But all in all it is a good PR.

The single most important part of the review is to not use blanket asterisk imports. Lets keep the submodule names around - it is ok to alias them if you think the names stay clear and usable. I made some suggestions regarding those. I’m guessing that with your work to get this going well with Visual Studio Code this won’t be an issue.

Don’t forget to update the requirements.txt file.

I think the way to do that in Blender 2.8 is to create a collection that isn’t linked to the scene, but does have its usercount set to 1 so that it gets saved, not purged.

The options added/requested originally meant that one could select to import hidden geometry and hidden layers instead of just skipping them. I would stick with that, and then later add an extra option to control how these are imported: ‘hidden’ (not directly linked to the scene) or visible as currently would be the case.

Do you mean to add options for that?

Sure! Anything you feel you want to add you should! When in doubt you could create a feature request as new issue on GitHub where we can hash out how it should work.

Once again: thanks for your efforts!

I think ideally it may be better to simply keep it in the same collection but turn off its visibility no? But I will implement the simple version of simply skipping them first and we can get feedback.

There is an issue for updating and duplicating geometry now and I will implement it but there is also a glitch with the way we handle materials at the moment. If you import a file and make changes to the materials and then re import the file with some new geometry it will override the material and all of the changes. This needs option so that one can maintain the material changes in the blender file.

joel

That was the original intent, but

This I meant for hidden layers. Hidden geometry we should be able to create so that they are hidden in Blender as well, indeed.

is a good feature to have.

Same goes really for geometry.

@joel_putnam FYI, I merged your PR, thanks!

FWIW I made a first release as v0.0.2. A zip that users can now use to install.

Still needs manual installation of rhino3dm.py though.

Hi. have tried it and works really well.
Does 0.0.2 work with Blender 2.8?

And is it possible to import rhino curves? For now only the meshes apear… Cheers

0.0.2 works with Blender 2.8 yes. Currently the import_3dm development is being done solely against Blender 2.8.

Curve import is not yet done, but already logged as a feature request.

1 Like

whoops. stupid questions… thanks for the repies…
im looking forward to bring linedrawings from rhino to blender

could be the alternative to acad to 3dsmax workflow.