This definition utilises Rhino’s Ironpython module via the GH-Python component. Specifically, it tracks the mouse’s position on the user’s screen, and at the same time records these values into Cartesian coordinates inside the Rhino viewport.
The source code inside the component can be found below:
#imports import System import Rhino as rc import scriptcontext as sc pointlist =[] # Add empty list to sticky / clear list if "points" not in sc.sticky or reset: sc.sticky["points"] = [] # Get the mouse position and append point to list if toggle: mp = System.Windows.Forms.Control.MousePosition sc.sticky["points"].append(rc.Geometry.Point3d(mp.X,-mp.Y,0)) mouse = mp pointlist = sc.sticky["points"] my_pt= pointlist[-1] # run the script elif toggle == False: print("turn me on")
And a snapshot of the canvas here:
Use the link below to download
Download Mouse Doodle Python
[GH]
By clicking the button below, I agree with the Terms & Conditions.
Download the Mouse Doodle Definition by Subscribing to our News
This wiki item was created and shared for the purposes of the online wiki page of the Decode fab lab training center.
This piece of code is for the pubic domain feel free to use it , share it and modify it for educational purposes, by providing proper citing. The authors, makes no warranty, expressed or implied, as to the usefulness of the software and documentation for any purpose. If this tool is used for commercial purposes please notify the authors. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
for more information visit: www.decodefablab.com
This piece of code is for the pubic domain feel free to use it , share it and modify it for educational purposes, by providing proper citing. The authors, makes no warranty, expressed or implied, as to the usefulness of the software and documentation for any purpose. If this tool is used for commercial purposes please notify the authors. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
for more information visit: www.decodefablab.com
Leave A Comment