Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Blender
- from Blender import Draw, BGL
- from Blender.BGL import *
- import math
- from math import *
- import time
- allPoints=[]
- XY=[0,0]
- # caanu niae?a?ony ana aaaaaiiua aaiiua
- def event(evt, val): #ia?aaioea ia?aoey eeaaeo
- if evt == Draw.ESCKEY :
- Draw.Exit() # exit when user presses ESC
- def button_event(evt): # Aucuaaao ooieoee aey oi?ie?iaaiey oaaeeou e aaiaa
- global allPoints
- global XY
- if evt == 1: # 1 – eaaioeoeeaoi? eiiiee auciaa
- x1=Draw.Create(0)
- y1=Draw.Create(0)
- r1=Draw.Create(0)
- r2=Draw.Create(0)
- px=Draw.Create(0)
- py=Draw.Create(0) # Nicaaiea eiiiie n ia?aeuiuie aaiiuie
- block=[] # Aaiiua aey oi?ie?iaaiey oaaeeou
- block.append(("X0 = ",x1,0,1000)) #Aaia n ia?aie?aieai a?aieo e oeia aaiiuo
- block.append(("Y0 = ",y1,0,1000))
- block.append(("rb = ",r1,0,1000)) #Aaia n ia?aie?aieai a?aieo e oeia aaiiuo
- block.append(("rs = ",r2,0,1000))
- block.append(("pX=",px,0,1000))
- block.append(("pY =",py,0,1000))
- retVal=Draw.PupBlock("Line coords",block) # Nicaaiea oaaeeou
- allPoints.append(x1.val)
- allPoints.append(y1.val)
- allPoints.append(r1.val)
- allPoints.append(r2.val)
- allPoints.append(px.val)
- allPoints.append(py.val)
- if evt==2:
- xb=allPoints[0]
- yb=allPoints[1]
- rb=allPoints[2]
- rs=allPoints[3]
- px=allPoints[4]
- py=allPoints[5]
- i=0
- XY=[xb+rb,yb]
- glClearColor(0,0,0,0.2) # background color
- glClear(BGL.GL_COLOR_BUFFER_BIT) # clear image buffer
- glColor3f(1.0,0,0)
- glLineWidth(1)
- glBegin(GL_LINE_LOOP)
- while i<360:
- XY[0]=xb+rb*cos((radians(i)))
- XY[1]=yb+rb*sin((radians(i)))
- i+=1
- glVertex2f(XY[0],XY[1])
- glEnd()
- Draw.Redraw(1)
- return
- def gui():
- Draw.PushButton("select data",1,1,10,65,20,"select information about the graphic")
- Draw.PushButton("draw",2,1,70,65,20,"draw the circle")
- Draw.Register(gui, event, button_event) # registering the 3 callbacks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement