algorithmic modeling for Rhino
I am trying to allow the adjustment of two lines while always keeping them at a minimum distance of 3 units apart. In the attached definition I really want the simple two variable functions to take effect on the specific slider that is being changed. Currently, they both act at once. Any way I can essentially recreate an on-change type behavior?
Tags:
It probably can be hacked together somehow (for example, while a slider is being dragged it will be the 'active' object on the canvas, or you could even look at the most recent Undo record, to see which slider it pertains to), but it's going to be n-a-s-t-y.
Just to make sure I understand, you want to be able to move either line segment up and down freely, while ensuring the other one is never closer than X units?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks for the reply David.
Yes. One should be able to move either line segment with its corresponding slider. The only rule is that they must remain a minimum of X units apart. When enforcing the minimum distance rule, only the currently moved line segment may be moved. Not both of them.
I thought I got it, now I'm confused. If you're changing line segment A and it breaks the distance rule, should line segment B be moved as well? Or do you want neither line segment to move if the distance rule is broken.
I attached a script that actually tests the active object, so if you drag slider A it always affects value A and it might affect value B. If you drag slider B it always affects value B and it might affect value A.
This is very un-grasshopper and it bound to give rise to massive confusion.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks for the script David. I'll mess around with it.
In answer to your question, if you move line segment A and it breaks the distance rule you do NOT move line segment B. You just don't allow line segment A to move any further. So if A is told to moved to within 2.5 units of Line segment B it will stop moving at 3 units from B. The problem comes from wanting the freedom to move both line segments. If one were always fixed this would obviously not be an issue.
Is it the goal or the script that are un-grasshopper?
Ah, well it should be reasonably easy to adjust the script to do what you want then. It's un-grasshopper in that the solution now depends on how you set values instead of what values you set.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by