Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Help moving objects along the Z plane

$
0
0

Hello,
Very new to scripting but have been using rhino for over 10 years now. Im working through building out simple geometry to try to gain a better understanding of Python and scripting.

Below is a copy of the script i have right now which just draws a circle and a square but i want to try to move the circle up the Z axis, and anyone help me out with the syntax to do so?

import Rhino
import scriptcontext
import System.Guid
import rhinoscriptsyntax as rs

plane = rs.WorldXYPlane()
rs.AddCircle( plane, 5.0)

def DoSomething():
plane = rs.WorldXYPlane()
width, height = 10.0, 10.0

rc = AddRectangleFromCenter(plane, width, height)
if rc:
    curve = rc.ToNurbsCurve()
    scriptcontext.doc.Objects.AddCurve(curve)
    scriptcontext.doc.Views.Redraw()

def AddRectangleFromCenter(plane, width, height):
a = plane.PointAt(-width * 0.5, -height * 0.5 )
b = plane.PointAt( width * 0.5, height * 0.5 )
rectangle = Rhino.Geometry.Rectangle3d(plane, a, b)
if isinstance(rectangle, Rhino.Geometry.Rectangle3d):
if rectangle.IsValid:
return rectangle

DoSomething()

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles