So, I want to recreate the move command in pythonscript (if it can be done directly from grasshopper better). This so I can add another option to move in a custom direction (like a preloaded vector), not only vertical or using the normal direction.
To see what I refer to as “options” when you type “move” in the rhino command line, you get these two options:
It would also help if there’s a way to see how this command is structured by default, I don’t know if there is any source code that I can copy to analyze and then modify.
What I am trying to do is to perform an interactive command with the user to modify a point from a curve, but with more options!
Thanks in advance for the help, and I’ll keep searching and document the solution if I find one!
@Frusciante
Hi,
Is this what you’re looking for? This moves an object based on the vector and a specified distance.
import rhinoscriptsyntax as rs
def custom_move():
obj_id = rs.GetObject("Select object to move")
if not obj_id:
return
start_point = rs.GetPoint("Pick the start point of the vector")
if not start_point:
return
end_point = rs.GetPoint("Pick the end point of the vector")
if not end_point:
return
direction_vector = rs.VectorCreate(end_point, start_point)
distance = rs.GetReal("Enter distance to move")
move_vector = rs.VectorScale(rs.VectorUnitize(direction_vector), distance)
rs.MoveObject(obj_id, move_vector)
custom_move()
It looks promising, but my limited understanding just doesn’t get why I get the following runtime error.
Runtime error (NotImplementedException): The method or operation is not implemented.
Traceback:
line 235, in GetObject, “C:\Users\DanielGalvánEcheverr\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\selection.py”
line 14, in custom_move, “”
line 28, in script
Windows 10 (10.0.19045 SR0.0) or greater (Physical RAM: 32Gb)
Computer platform: DESKTOP
Standard graphics configuration.
Primary display and OpenGL: NVIDIA GeForce GTX 1660 (NVidia) Memory: 6GB, Driver date: 6-6-2023 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 536.19
> Accelerated graphics device with 4 adapter port(s)
- Windows Main Display attached to adapter port #0
Secondary graphics devices.
Intel(R) UHD Graphics 630 (Intel) Memory: 1GB, Driver date: 4-3-2022 (M-D-Y).
> Integrated graphics device with 3 adapter port(s)
- Secondary monitor attached to adapter port #0
OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)
Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High
Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 6-6-2023
Driver Version: 31.0.15.3619
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 6 GB
Rhino plugins that do not ship with Rhino
C:\Users\DanielGalvánEcheverr\DUO\200_RD - D\02_AutoLot3d\01 AutoCivil\Lista de Plugins\PLUGINS\elefront422 (2)\elefront421\ElefrontProperties.rhp “ElefrontProperties” 1.0.0.0
C:\Users\DanielGalvánEcheverr\Downloads\rhinoplugin\RhinoToGrasshopper.rhp “RhinoToGrasshopper” 1.0.0.0
Hi,
Reinstalling Rhino should resolve the problem. @Frusciante
Maybe Dale knows a more efficient way to fix the Python Interpreter bug without having to reinstall Rhino.