Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.97 KB | None | 0 0
  1. import Blender
  2. from Blender import Draw, BGL
  3. from Blender.BGL import *
  4. import math
  5. from math import *
  6. import time
  7. allPoints=[]
  8. XY=[0,0]
  9.  
  10.  
  11.                         # caanu niae?a?ony ana aaaaaiiua aaiiua
  12. def event(evt, val):    #ia?aaioea ia?aoey eeaaeo
  13.     if evt == Draw.ESCKEY :
  14.         Draw.Exit()         # exit when user presses ESC       
  15. def button_event(evt):  # Aucuaaao ooieoee aey oi?ie?iaaiey oaaeeou e aaiaa
  16.     global allPoints
  17.     global XY
  18.     if evt == 1:            # 1 – eaaioeoeeaoi? eiiiee auciaa
  19.         x1=Draw.Create(0)
  20.         y1=Draw.Create(0)
  21.         r1=Draw.Create(0)
  22.         r2=Draw.Create(0)
  23.         px=Draw.Create(0)
  24.         py=Draw.Create(0)       # Nicaaiea eiiiie n ia?aeuiuie aaiiuie
  25.         block=[]            # Aaiiua aey oi?ie?iaaiey oaaeeou
  26.         block.append(("X0 = ",x1,0,1000)) #Aaia n ia?aie?aieai a?aieo e oeia aaiiuo
  27.         block.append(("Y0 = ",y1,0,1000))
  28.         block.append(("rb = ",r1,0,1000)) #Aaia n ia?aie?aieai a?aieo e oeia aaiiuo
  29.         block.append(("rs = ",r2,0,1000))
  30.         block.append(("pX=",px,0,1000))
  31.         block.append(("pY =",py,0,1000))
  32.         retVal=Draw.PupBlock("Line coords",block) # Nicaaiea oaaeeou
  33.         allPoints.append(x1.val)
  34.         allPoints.append(y1.val)  
  35.         allPoints.append(r1.val)
  36.         allPoints.append(r2.val)
  37.         allPoints.append(px.val)
  38.         allPoints.append(py.val)
  39.        
  40.         if evt==2:
  41.             xb=allPoints[0]
  42.             yb=allPoints[1]
  43.             rb=allPoints[2]
  44.             rs=allPoints[3]
  45.    
  46.             px=allPoints[4]
  47.             py=allPoints[5]
  48.             i=0
  49.             XY=[xb+rb,yb]
  50.             glClearColor(0,0,0,0.2) # background color
  51.             glClear(BGL.GL_COLOR_BUFFER_BIT) # clear image buffer
  52.             glColor3f(1.0,0,0)
  53.             glLineWidth(1)
  54.             glBegin(GL_LINE_LOOP)
  55.    
  56.             while i<360:
  57.                 XY[0]=xb+rb*cos((radians(i)))
  58.                 XY[1]=yb+rb*sin((radians(i)))
  59.                 i+=1
  60.                 glVertex2f(XY[0],XY[1])
  61.             glEnd()
  62.            
  63.         Draw.Redraw(1)
  64.         return
  65.  
  66.            
  67.        
  68.    
  69.  
  70. def gui():              
  71.     Draw.PushButton("select data",1,1,10,65,20,"select information about the graphic")
  72.     Draw.PushButton("draw",2,1,70,65,20,"draw the circle")
  73. Draw.Register(gui, event, button_event)  # registering the 3 callbacks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement