Grasshopper

algorithmic modeling for Rhino

How do i move actual meshes with their textures in rhino ? from GH? python?

Hello all 

so i've been playing around with this for a while.

and even used the opportunity to try and pick up a bit of beginner python if necessary.

i've got these original meshes in rhino with textures mapped already.

and i want to move them in rhino according to a list of values (in Z axis- easy) i've created in GH - specific to their order obviously.

* [just for interest- basically i'm trying to "drape" 3d buildings from a curved aerial ground mesh to a flat one. so each mesh has a different z value it needs to move with.]

i've been trying to do this through GH or python with out success,

I understand i can create a list of the Z axis values, and also a list of the meshes IDguides to be recognized in rhinosyntax (so i can select them by id)

any thoughts ? please ?

thanks very much 

:)

Views: 1620

Attachments:

Replies to This Discussion

any-one? 

cheers 

:)

If you'd like to transform the objects directly in Rhino, it's easy enough to do so: 

http://wiki.mcneel.com/developer/rhinocommonsamples/transformbrep

The Rhinocommon wiki has loads of good examples.  You generally need to alter how the objects are selected/assigned, and it's also useful to activate your code with a boolean input.

thank you david !

for responding firstly :)

it looks as though you've understood me, but unfortunately i've not yet completely understood what you meant :)

what is the workflow if you dont mind helping me out a bit more?

1.code in python everything? 

2.or just the input method into GH?

i'm afraid the whole process in python will take me years :) as i've already measured for each mesh centroid the z delta to the new location...

thanks very much 

amir

let me just clarify as i'm probably not so clear..

i've got already textured meshes in rhino which i need to transform (move on z axis) with different value for each mesh.

i'm able to compile a list of values and obviously move these meshes to the right place accordingly but the new meshes i bake are without the textures (obviously.. sadly.)

so i'm looking for a way to transform (perhaps that's what you're suggesting) the original meshes with the list of values i've come up with

Or anyother way you can kindly suggest?

thanks very much 

:)

Yes...I mean that you can directly move the Rhino geometry through any script component in grasshopper.  The key lies in getting the correct reference information from your geometry in rhino...but then you can transform your geometry just as you would in Rhino, not having to bake or remap, etc.

I don't use python myself (I use vb.net) but I think this discussion should help you read the object id's in rhino.

http://www.grasshopper3d.com/forum/topics/finding-guids-in-python

The sample script I linked to from the rhinocommon wiki should give you all the syntax you need to transform your objects.

There are several logical problems though:

  1. If you reference a Rhino object and then transform that Rhino object Grasshopper notices this change and will try to update the reference. Which in turn triggers your script which transforms the object, Grasshopper notices this change and will try to update the reference. Which in turn triggers your script which transforms the object, Grasshopper notices this change and will try to update the reference.  Which in turn ... enfin, you get the idea.
  2. Successive transformations stack up as each transformation 'inherits' the changes made by all previous transformations. So just moving your shapes up for X units every time the script runs is a bad idea as your geometry will then tend to lift off towards outer space. This is where regular plugins and scripts are safer as they only run when you want them to run, whereas Grasshopper solutions run when they feel like it.
  3. Successive transformations may damage the quality of geometry. Floating point mathematics is not exact in digital computing and every mathematical operation you perform (addition, subtraction, division etc.) introduces a tiny amount of noise in the result. Do it often enough and the noise may start to be visible on large scales.

I don't have ready answers to these problems, they really are actual problems that will need to be solved on a per-project basis. Based on your description of what you want to achieve, I think RhinoScript is probably a better approach than Grasshopper.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks David-s :)

Well, first things first- i've managed (what i regard as a sufficient workaround) - using "Human" utilities by andrew heumann - for figuring out the referenced geometry's materials - in this case - the actual textures. - i was surprised to find out with just a custom bake component - to bake the attribute to the new geometry created in GH- images attached.)

Basically that's exactly what I thought I was looking for initially but then I realized I was lost when it came to the relationship between GH and rhino. I'm not sure I'm there yet having read your answers (my lack of coding background I presume) but I'm trying to figure it out:

* So python inside GH is basically a way to reach out to the rhinoscriptsyntax? To the more "hardcore" or basic code of rhino? But once doing this inside GH, all Geometry is referenced already and is sequential? Is this referring to David (Rutten) philosophical answer? If so, then I think I understand.

 

* Also- David (Rutten :) ) – when you say at the end of your answer- that you suggest rhinoscript- do you mean "outside – "in the cold" :) - in rhino? with the pythoneditor?

 

As always, many thanks 

:)

 

 

 

I use the line owner.locked = true at the end of a script to make it run only when I want (by enabling the component) and avoid the problems David mentions.

Not sure if there is any catch using this method, it has always worked fine for me.

There's also now a boolean button component but I think if the component runs faster than the time it takes you to unclick it might run more than once.

thanks so much David !

please see my reply to David Rutten above and the "workaround" GH approach i ended up taking.

The direction you've pointed me to - looks like exactly what i thought i had in mind - but unfortunately- well above my head for the moment... :(

cheers again 

:)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service