vilemduha / blendercam

Automatically exported from code.google.com/p/blendercam
GNU General Public License v3.0
468 stars 119 forks source link

[Feature proposal] Calculate a toolpath around mesh including its surface modifiers #63

Closed taras-ko closed 8 years ago

taras-ko commented 8 years ago

Hi. Is it possible to calculate path around the mesh including its surface modifiers?

If Blendercam will work with modifiers we'll get many good things:

  1. Higher frames per second in 3D view (because we can make modifier invisible)
  2. Total size of .blend file will be much more lesser. For now I'm working with 300Mb blend file. I'm syncing it over cloud storage.
  3. Less copy-paste user operations. (I forced to duplicate my object with modifiers, apply modifiers for it. So for one object I must have at least one copy)
ghost commented 8 years ago

Yep, agreed. I have been experimenting with this and it is possible to do. A few years ago I worked on RibMosaic where I implemented the same thing. My computer only has 800 megs of ram so I look for any way to speed things up and cut memory usage. The couple of tests I have done using subsurface modifier and bevel modifier have worked. Its possible to get the final mesh with modifiers applied without having the user apply the modifiers so theoretically any modifier should work. Its a work in progress as I am still learning the code for blendercam.

ghost commented 8 years ago

If you are curious as to how its done its quite simple. I use the blender object method to_mesh() which creates a copy of the mesh and you can tell blender to apply modifiers etc. cammesh = obj.to_mesh(scene, True, 'RENDER') The True parameter tells to_mesh to apply all modifiers and to use RENDER settings for the final mesh. cammesh is then used for all of the Blendercam operations that involve obj. obj is the original blender object that can still be modified by the user. cammesh only exists while the operation is calculating and then is destroyed to free up the memory.

ghost commented 8 years ago

Tried it using the Boolean modifier and works no problem with all of the 3D operations ie parallel, block, circle etc.

taras-ko commented 8 years ago

Well ok, could you please share with me your code?

ghost commented 8 years ago

Don't worry, it will get pushed to master branch once it goes through a little more testing. I need to clean up the code and finish the ui stuff. Maybe first week of June.

Currently there is only one option for mesh modifier in the ui but there are a few more options that I will eventually add allowing a little more control over which modifiers get activated for a specific operation.

usemeshmodifier

taras-ko commented 8 years ago

I want to add one thing. It's will be very useful if Blendercam will leave original model with its modifiers untouched (modifiers will be applied only to the temporary copied object)

ghost commented 8 years ago

Yes, that is the way it behaves. to_mesh() creates a copy and the mesh copy is destroyed when the operation calculation is finished with it.

ghost commented 8 years ago

Code cleanup is done but still testing. I will commit this to master branch today and others can test it out. I moved the use mesh modifiers to the CAM operations panel and it is only visible if the Source of data is Object or Group.

I don't have OpenCAMlib running on my machine so can't test that portion.

Use exact mode works well but be careful if using subsurf modifier with a high render setting. A render setting of 6 made my machine crawl (only a single core). A setting of 3 seems to work well. All the modifiers seem to work but did not try all combinations.

ghost commented 8 years ago

Ok, its in master. Still a few things to fix but give it a try.

vilemduha commented 8 years ago

nfz - Big thanks for this work. Why didn't I implement this earlier? Original Blender CAM had no exact mode(real collision), all was image based and there modifiers work since the render is used. And, I forgot and didn't have time to implement this later when I did exact mode ;) so It's great this work has been done. There are more unfinished things like this... so thanks!

ghost commented 8 years ago

No problem. There is only so much one person can do.

ghost commented 8 years ago

@taras-ko any chance to test this out?

taras-ko commented 8 years ago

As I commented in issue #67 there is some troubles with generating of cam toolpath called '1'. Whole my RAM and swap was eaten by blender process, until my system was totally freezed down two times in a row. The second toolpath called 'profile' is generating without any issue.

taras-ko commented 8 years ago

Besides, I noticed that blendercam is really hungry to the RAM. To occupy 8Gb of RAM is a piece of cake for blendercam for not really big project.

ghost commented 8 years ago

I am slowly trying to improve that. I only have 800 megs (0.8Gb) to work with so it is of great concern to me too.