Esempio n. 1
0
import rhinoscriptsyntax as rs
# Creates cool sphere in center of Event
a = rs.AddSphere([0, 0, 0], 5)
rs.ObjectColor(a, [255, 0, 0])
# Creates planes that expand toward sphere
plane = rs.WorldZXPlane()
plane2 = rs.WorldZXPlane()
plane3 = rs.WorldZXPlane()
plane4 = rs.WorldZXPlane()
plane5 = rs.WorldZXPlane()

# Rotates planes and draws arcs with varying color
for i in range(0, 200):
    plane = rs.RotatePlane(plane, 2, [25, 25, 25])
    plane2 = rs.RotatePlane(plane2, 5, [25, 25, 25])
    plane3 = rs.RotatePlane(plane3, 11, [25, 25, 25])
    plane4 = rs.RotatePlane(plane4, 23, [25, 25, 25])
    plane5 = rs.RotatePlane(plane5, 47, [25, 25, 25])
    a1 = rs.AddArc(plane, 2, 45.0)
    a2 = rs.AddArc(plane, 2, -45.0)
    a3 = rs.AddArc(plane2, 5, 45.0)
    a4 = rs.AddArc(plane2, 5, -45.0)
    a5 = rs.AddArc(plane3, 11, 45.0)
    a6 = rs.AddArc(plane3, 11, -45.0)
    a7 = rs.AddArc(plane4, 23, 45.0)
    a8 = rs.AddArc(plane4, 23, -45.0)
    a9 = rs.AddArc(plane5, 47, 45.0)
    a10 = rs.AddArc(plane5, 47, -45.0)
    rs.ObjectColor(a1, [0, 255, 255])
    #    rs.ObjectColor(a2, [0,255,255])
    rs.ObjectColor(a3, [0, 230, 230])
Esempio n. 2
0
#Transform the width of the object into a 3D point
pnt_ste = (-obj_wid, 0, 0)

#Prepare the view for the axonometric view captures
rs.CurrentView(view='Perspective')
rs.ObjectsByGroup('obj_all', select=True)
rs.ZoomSelected()
rs.UnselectAllObjects()
for i in range(img_zoo):
    rs.Command('Zoom Out')

#Main loop taking the axonometry shots on each iteration
for i in range(vis_res + 2):

    #Clipping plane
    pla_obj = rs.AddClippingPlane(rs.WorldZXPlane(),
                                  obj_wid,
                                  obj_hei,
                                  views='Perspective')
    rs.ObjectLayer(pla_obj, 'lay_axo_pla')
    rs.MoveObject(pla_obj, pla_pos)

    #Section start and end
    sec_str = pla_pos
    sec_end = rs.PointAdd(pla_pos, pnt_ste)

    #Create and select the section curve
    rs.CurrentLayer(layer='lay_axo_sec')
    rs.ObjectsByGroup('obj_all', select=True)
    rs.CurrentView('Top')
    rs.Command('-_Section ' + str(sec_str) + ' ' + str(sec_end) + ' _Enter')
Esempio n. 3
0
import rhinoscriptsyntax as rs
from math import*
# Creates cool sphere in center of Event
a = rs.AddSphere([0,0,0], 5)
rs.ObjectColor(a,[255,0,0]) 
obs = []
# Creates planes that expand toward sphere
for i in range(0, 10):
    plane = rs.WorldZXPlane()
    obs.append(plane)
obsR = []
obsR1 = []
obsR2 = []
obsR3 = []
colObs = []
p = 25
x = 255
z = 25.0
# Rotates planes and draws arcs with varying color
for i in range(0,200): # Loop 100 times
    for k in range(0, 10): # Loop once for each plane
        o = rs.RotatePlane(obs[k], (k + 100), [p,p,p]) # Suppose to increase the size of the event, but not working
        v = rs.RotatePlane(obs[k], (k - 1000), [p,p,p])
        w = rs.RotatePlane(obs[k], (k + 10000), [p,p,p])
        y = rs.RotatePlane(obs[k], (k - 400), [p,p,p])
        print((k-1+2)**2) # print value for testing
        obsR.append(o) # append newly created obj to list
        obsR1.append(v)
        obsR2.append(w)
        obsR3.append(y)
Esempio n. 4
0
 def DrawPlane(self, dist, axis_of_rotation, angle_of_rotation):
     """
     function to draw the plane on Rhino interface. Returns the plane's
     Guid
     
     Parameters
     ----------
     dist: float
         dist to move away from y-axis (origin) if 'ZX' plane
         dist to move away from x-axis (origin) if 'YZ' plane
         dist to move away from z-axis (origin) if 'XY' plane
     axis_of_rotation: list
         list specifying axis of rotation on Rhino
         e.g. [1,0,0] is to rotate on x-axis
     angle_of_rotation: float
         angle to rotate the plane
     
     Raises
     ------
     ValueError
         if the argument 'dist' is less than than 0.
     """
     try:
         if dist < 0:
             raise ValueError
     except ValueError:
         print("draw_plane(): argument 'dist' should not be negative")
     else:
         if self.plane == 'XY':
             # axis for plane to be drawn
             myplane = rs.WorldXYPlane()
             # add a rectangle in the XY plane
             rec = rs.AddRectangle(myplane, self.width, self.height)
             # save the GUID of the plane
             self.GUID = rec
             # move the plane "dist" away from the z-axis
             # dist to move away from z-axis (origin)
             rs.MoveObject(rec, [0, 0, dist])
             # rotate plane
             rs.RotateObject(rec, [self.height / 2, self.width / 2, dist],
                             angle_of_rotation, axis_of_rotation)
             # return the GUID of the plane
             return rec
         if self.plane == 'YZ':
             # axis for plane to be drawn
             myplane = rs.WorldYZPlane()
             # add a rectangle in the YZ plane
             rec = rs.AddRectangle(myplane, self.width, self.height)
             # save the GUID of the plane
             self.GUID = rec
             # dist to move away from x-axis (origin)
             rs.MoveObject(rec, [dist, 0, 0])
             # rotate plane
             rs.RotateObject(rec, [dist, dist, self.height / 2],
                             angle_of_rotation, axis_of_rotation)
             # return the GUID of the plane
             return rec
         if self.plane == 'ZX':
             # axis for plane to be drawn
             myplane = rs.WorldZXPlane()
             # add a rectangle in the XZ plane
             rec = rs.AddRectangle(myplane, self.width, self.height)
             # save the GUID of the plane
             self.GUID = rec
             # dist to move away from y-axis (origin)
             rs.MoveObject(rec, [0, dist, 0])
             # rotate plane
             rs.RotateObject(rec, [dist, dist, self.height / 2],
                             angle_of_rotation, axis_of_rotation)
             # return the GUID of the plane
             return rec