Grasshopper

algorithmic modeling for Rhino

hi all.
i wonder if it's possible to set up a slider to export geometry instead of a sequence of images...such as obj/dxf/iges/3ds.
ideas?????????
best

Views: 7136

Replies to This Discussion

This could probably be scripted. Take a look at the custom bake components people are writing (Damien Alomar has good one). You could probably add that functionality in a loop which also includes the information from the slider range you were using to animate.
Yes this is possible and wouldn't necessarily be too tough (I don't think). The only potential hiccup I think there might be is actually keeping track of the imported geometry. If you can do that, then you can delete it for the next import.

Ultimately though, this has the potential to bring GH and Rhino to its knees. I'm not exactly sure what you're thinking about doing, but the first thing that come to my mind is realflow meshes which would certainly not be a quick trivial import. What I would consider a better possible approach would be to import all of the geometry desired in some sort of ordered fashion (like in numbered layers) and simply switch the "visibility" of the desired object on/off (or change the reference within GH somehow). This is making the assumption that you're doing this for some sort of rendering purposes though.

Can you share where your files are coming from, the extent of those files (2 objects or 1000, nurbs or meshes), and what your purpose for them is. I think that the implementation depends largely on what your working with and what you intend to do with them.
Disregard most of this stuff as I thought the request was for importing when in actually it was just for exporting...so above is just my mindless rambling :)
If understand it right you want to export geometry to a file as soon as a slider changes it's value?

I used something similar once to export floorplates to seperate dxf files.

Attached I created a random example to export curves to dxf files.
The included VB component just uses a command macro to automate the export.
app.RunScript("_-export " & sFileName & " _Enter")

The same would work for any kind of surface or brep object. You'll have to alter the baking though. As Luis mentioned there are a lot of custom bake examples around here already.
Just make sure to provide the right number of arguments for the export format (e.g. export schemes)
Attachments:
hi!
thank you all for your replies...
Marc...i'll test your defintion...thanks for sharing!
Basically what i need to do is to bake every adaptation of the geometry in gh (every slider step), and export it as .obj.
then import it into 3ds max as a sequence
http://www.scriptspot.com/3ds-max/objloader-v1-3
best
Disregard my first post up there (or most of it anyway) as I thought you were looking to import, not export your object. Exporting is even easier

Marc's definition works fine here on my end with some slight modifications (changed an mRhinoCurveObject to a Brep and also with AddCurveObject to AddBrep). The only thing is that importing into max will require a mesh, and currently this will export the OBJ as a nurbs object. So you might want to export a mesh instead which can be done by either A) converting the objects into a mesh within GH, and passing that to a scripting component as a mesh with the appropriate adjustments made to the script (ie. MRhinoMeshObject & AddMeshObject) OR B) you can try and extract the mesh from the object within the scripting component and export just that. Personally I'd go for the first option as that's probably the easiest and won't rely on generating the mesh ourselves (or display meshes or anything).
Attachments:
Damien.
Thanks for your definition, i didn't have time to test it, until now, so i working on it right at this moment.
Some questions...
I understand the basic logic of it, but some things are not clear.
-one part of your def. is "some geometry" i guess those components should be deleted and replaced by the geometry im working on.
-the geometry im working on should be connected then to the mesh component (b)
-this is when it become tricky, i dont understand what should be connected to the x&y&z function in its y value....the geometry as well?
-also, the true/false value should be set to true?

i did those steps, then i went to the slider that makes the geometry transform, and hit animate, but im still getting only jpegs....no obj
Damien, thanks again for your help!
best
mario
Yes, replace "Some Geometry" with whatever you want to bake, then connect that to the mesh component.

The function component is simply building the string that will be used as the file name. Set up your folder in the sFolder post it (with a backslash at the end), and the extension type in the FileType post it (with a dot before the extension. Then feed the incrementor (slider in the case of an animation) into the y slot.

The true false value is for it to save. Since a possible update of the geometry could slow things down, make sure that's set to False while you're working and True when you're actually looking for the output.

Note: If you're trying to bake multiple objects, then that could possibly result in not all of those objects being saved in the file. Basically each file would save on its own, but with the same file name, so you'd only have the last one in the list. If you're trying to bake multiple objects, let me know and I can make some adjustments to the script for you.

Best,
Damien
damien.
mmmmm.....it's not working ...i'm still only getting images and no geometry.
I'm uploading my definition connected to yours.
And yes i do have multiple objects.
best
Attachments:
error:
value type "RMA.Rhino.MRhinoMeshObject" cannot be converted to "RMA.Rhino.MRhino.CurveObject"
best
m
Sorry about that...I thought I tested it, but I guess that was left over from Marc's version. I've fixed that and gone through the liberty of adding support for multiple mesh objects and hooking it up to an animation slider. So it should be pretty much plug and play.
Attachments:
Damien.
Thanks for your reply.
Still.....not working.
I'm uploading a video with the steps i'm following...my guess is that i'm doing something wrong.
I first plugged your ExportMeshes.ghx definition to mine, and it didn't work.
So then i tested your definition alone, and noting came out.
best
Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service