capsule.py

capsule.py#

:capsule.py
capsule.py

This example generates the surface figure that consists of capsule

1# This example generates the surface figure that consists of capsule
2import coat
3
4class CapsulePrim:
5 def __init__(self):
6 self.Radius = 30
7 self.Height = 200
8
9 # this is class registration, look dialogs example
10 def ui(self):
11 return [
12 "Radius,[10,100]",
13 "Height,[20,200]"
14 ]
15 def build(self) :
16 voxId = coat.Scene.sculptRoot().childCount()
17 current = coat.Scene.sculptRoot().addChild("Capsule" + str(voxId))
18 volume = current.Volume()
19 volume.toSurface()
20 capsule = coat.capsule()
21 capsule.height(self.Height)
22 capsule.radiusTop(self.Radius)
23 capsule.radiusBottom(self.Radius)
24 capsule.details(0.5)
25 capsule.add(volume)
26
27# get to sculpt room
28coat.ui.toRoom("Sculpt")
29capsulePrim = CapsulePrim()
30# show the dialog
31if(coat.dialog().ok().cancel().params(capsulePrim).show() == 1) :# ok pressed, buttons start from 1
32 # build the figure
33 capsulePrim.build()
34
:capsule.py
 1     # This example generates the surface figure that consists of capsule
 2     import coat
 3
 4     class CapsulePrim:
 5             def __init__(self):
 6                     self.Radius = 30
 7                     self.Height = 200
 8
 9             # this is class registration, look dialogs example
10             def ui(self):
11                     return [
12                             "Radius,[10,100]",
13                             "Height,[20,200]"
14                     ]
15             def build(self) :
16                     voxId = coat.Scene.sculptRoot().childCount()
17                     current = coat.Scene.sculptRoot().addChild("Capsule" + str(voxId))
18                     volume = current.Volume()
19                     volume.toSurface()
20                     capsule = coat.capsule()
21                     capsule.height(self.Height)
22                     capsule.radiusTop(self.Radius)
23                     capsule.radiusBottom(self.Radius)
24                     capsule.details(0.5)
25                     capsule.add(volume)
26
27     # get to sculpt room
28     coat.ui.toRoom("Sculpt")
29     capsulePrim = CapsulePrim()
30     # show the dialog
31     if(coat.dialog().ok().cancel().params(capsulePrim).show() == 1) :# ok pressed, buttons start from 1
32             # build the figure
33             capsulePrim.build()