Grasshopper

algorithmic modeling for Rhino

movement of an object in rhinospace as vector input for Python

Hey everyone,

Is there any way in the middle of the script you can make it pause, giving an opportunity for a movement of an object in rhinospace, then final confirmation to retrieve its vector displacement as a return value?

Thanks!

Matt

Views: 1518

Replies to This Discussion

Hi Mathew.
The question is a bit vague, can you post an example of what you want to do? Or a sketch?

Hi djordje,

i guess it would be similar to getObject, but instead of selecting, it allows direct user manipulation of the object (ie. move with a gumball) and log either the vector or the new coordinate 

Hi Matthew,

You can call the "Move" command from rs.Command function

import rhinoscriptsyntax as rs
import Rhino

pt = rs.AddPoint(0,0,0)
print "initial pt coordinates: ", rs.PointCoordinates(pt)

rs.Command("_-Move")
print "edited pt coordinates: ", rs.PointCoordinates(pt)

But if I understood correctly you want to connect the initial point with "moved" one? Then try using "Copy" instead of "Move" command:

pt1 = rs.AddPoint(0,0,0)

rs.Command("_-Copy")
pt2 = rs.FirstObject()

ln = rs.AddLine(pt1,pt2)

There's also rs.GetLine function:

lnPts = rs.GetLine()
ln = rs.AddLine(lnPts[0],lnPts[1])

The gumball can be used all along with above moving and copying, but it looks a bit buggy: even though it's turned on, for some reason you have to turn it off, then on (or just leave it turned off before running the script, then turn it on during the script) for it to work.

Thanks for the response djordje,

i did think about this as an option, but i guess i was really more interested in the ability to have something less 'final'. the move command sort of gives me only 1 chance to move, then its finished. i feel like what im looking for would be accessing something deeper like rhinocommon or system drawing or something more advanced like that.

i have been looking at the meier UI and starmaker scripts, and they have the ability to preview in real time (with help from sliders) a visual state change. i was curious if this sort of realtime feedback could take advantage of very fluid movements (similar to what gumball allows) not linked to sliders, but approaching the ease that rhinos interface allows.

Hi Mathew.

You can call the rhinocommon to achieve this effect,

Attachments:

Hi Naruto,

Thanks for the response. my goal isnt quite just to get a line drawn from two points. i think a good example of what im looking for is a user interaction much like in grasshopper, how it displays the line between two points while you are actively dragging a referenced point around.  it would be a script that would be running WHILE you are moving the point around.

Hi Mathew,

This may be the answer you want,Writing not perfect

Attachments:

Naruto, this is really great! this is getting very close to what i was looking for!

would you have any idea how we could get the points to be moved by the Gumball, or something that allowed for single axis movements? your current method makes it hard to put the points anywhere in space without some sort of reference geometry to snap to.

Thanks!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service