determining subdomains on Cooker generated files

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

determining subdomains on Cooker generated files

mumić
Hello to you all!

I'm just getting into GranOO and one of the problems I found was to determine subdomains on my generated domain files via Cooker.

What I wish to do is to apply a displacement on yMin position my domain, pretty much the way it is done on ./granoo/tags/2.0/Example/Continuous/BendingTest/

From what I analyzed, the xMin and xMax positions were found on the generated agdd file used in that case, but, still, the same couldn't be said to my custom domain. I tried a really poor approach to this problem by loading the file into python and tried to manually do that, but as my approach was a poor one, I found myself on an encoded string.

Is there any way to do it nativelly, without the use of extra codes or anything else?

Thank you!

@edit

I forgot to mention, but my generated domain comes from a .off file.
Reply | Threaded
Open this post in threaded view
|

Re: determining subdomains on Cooker generated files

Damien André
Administrator
Hello,
This is a common problem and at this time we do not have any user-friendly tool to do this job. However, you can do something thanks to the *.offset file trick. If you take a look in the Tool/Cooker/inp/CookingBook-polyhedron.inp you can see :
<PreProcessing>
    <PlugIn Id="_NewSupportShape" Type="Polyhedron" ID="Boundary"
	    File="./off/cube-and-cylinder.off" OffSetFile="./off/cube-and-cylinder.offset" />
....
Here, the cube-and-cylinder.off describes the geometry of the domain and the  cube-and-cylinder.offset file describes the different group of discrete elements that must be created during the cooking process. So, you can run this example, take a look on the generated sample with the granoo-viewer and read the related cube-and-cylinder.offset to understand how it works.

How to generate offset file ?

To generate offset file, you can take a look on the Tool/Script/ directory. Please read carefully the offset.readme file. Finally, when you are okay, you can take a look on   "Tool/Script/Examples/build-off.py" file that shows how to generate .off and .offset from python thanks to the great software openscad.

This is not so easy... So, feel free to come back here for asking any questions.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: determining subdomains on Cooker generated files

mumić
Thank you a lot for your quick reply!

I've read it all and it makes sense now, far simpler than what I thought it would be (trying to read the file as a string textfile was really a bad approach).
During the whole process, I only found one problem: on the build-off.py it tells you to set your GranOO installation path to, only then, import the offset python file on it.
With my Python version (3.7 via conda on Ubuntu 18.04 LTS), that didn't work, so I had to manually move the offset file to the folder I was working with.
Aside that, the offset file went alright and I managed to generate the subdomains the way you described.

Thank you a lot for the help!