本文整理汇总了Python中pivy.coin.SoSeparator方法的典型用法代码示例。如果您正苦于以下问题:Python coin.SoSeparator方法的具体用法?Python coin.SoSeparator怎么用?Python coin.SoSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pivy.coin
的用法示例。
在下文中一共展示了coin.SoSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def build(self):
self.active = False
if not hasattr(self,'switch'):
self.sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
self.switch = coin.SoSwitch()
if hasattr(self,'Object'):
self.switch.setName("%s_ControlPoints"%self.Object.Name)
self.empty = coin.SoSeparator() # Empty node
self.node = coin.SoSeparator()
self.coord = CoinNodes.coordinate3Node()
self.poly = CoinNodes.polygonNode((0.5,0.5,0.5),1)
self.marker = CoinNodes.markerSetNode((1,0,0),coin.SoMarkerSet.DIAMOND_FILLED_7_7)
self.node.addChild(self.coord)
self.node.addChild(self.poly)
self.node.addChild(self.marker)
self.switch.addChild(self.empty)
self.switch.addChild(self.node)
self.sg.addChild(self.switch)
示例2: __init__
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def __init__(self, points, dynamic=False, arrow_size=0.04, length=2):
super(Arrow, self).__init__(points, dynamic)
self.arrow_sep = coin.SoSeparator()
self.arrow_rot = coin.SoRotation()
self.arrow_scale = coin.SoScale()
self.arrow_translate = coin.SoTranslation()
self.arrow_scale.scaleFactor.setValue(arrow_size, arrow_size, arrow_size)
self.cone = coin.SoCone()
arrow_length = coin.SoScale()
arrow_length.scaleFactor = (1, length, 1)
arrow_origin = coin.SoTranslation()
arrow_origin.translation = (0, -1, 0)
self.arrow_sep += [self.arrow_translate, self.arrow_rot, self.arrow_scale]
self.arrow_sep += [arrow_length, arrow_origin, self.cone]
self += [self.arrow_sep]
self.set_arrow_direction()
示例3: main
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def main():
app = QtWidgets.QApplication(sys.argv)
viewer = quarter.QuarterWidget()
# build a scene (sphere, cube)
plane = coin.SbPlane(coin.SbVec3f(0, 0, 1), coin.SbVec3f(0, 0, 0))
root = coin.SoSeparator()
myCallback = coin.SoCallback()
cap = CapPlane(plane, root)
myCallback.setCallback(myCallbackRoutine, cap)
root += myCallback, coin.SoSphere()
viewer.setSceneGraph(root)
viewer.setBackgroundColor(coin.SbColor(.5, .5, .5))
viewer.setWindowTitle("GL stencil buffer")
viewer.show()
sys.exit(app.exec_())
示例4: simple_quad_mesh
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def simple_quad_mesh(points, num_u, num_v, colors=None):
msh_sep = coin.SoSeparator()
msh = coin.SoQuadMesh()
vertexproperty = coin.SoVertexProperty()
vertexproperty.vertex.setValues(0, len(points), points)
msh.verticesPerRow = num_u
msh.verticesPerColumn = num_v
if colors:
vertexproperty.materialBinding = coin.SoMaterialBinding.PER_VERTEX
for i in range(len(colors)):
vertexproperty.orderedRGBA.set1Value(i, coin.SbColor(colors[i]).getPackedValue())
msh.vertexProperty = vertexproperty
shape_hint = coin.SoShapeHints()
shape_hint.vertexOrdering = coin.SoShapeHints.COUNTERCLOCKWISE
shape_hint.creaseAngle = np.pi / 3
msh_sep += [shape_hint, msh]
return msh_sep
示例5: simple_poly_mesh
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def simple_poly_mesh(verts, poly, color=None):
color = color or COLORS["grey"]
_vertices = [list(v) for v in verts]
_polygons = []
for pol in poly:
_polygons += list(pol) + [-1]
sep = coin.SoSeparator()
vertex_property = coin.SoVertexProperty()
face_set = coin.SoIndexedFaceSet()
shape_hint = coin.SoShapeHints()
shape_hint.vertexOrdering = coin.SoShapeHints.COUNTERCLOCKWISE
shape_hint.creaseAngle = np.pi / 3
face_mat = coin.SoMaterial()
face_mat.diffuseColor = color
vertex_property.vertex.setValues(0, len(_vertices), _vertices)
face_set.coordIndex.setValues(0, len(_polygons), list(_polygons))
vertex_property.materialBinding = coin.SoMaterialBinding.PER_VERTEX_INDEXED
sep += [shape_hint, vertex_property, face_mat, face_set]
return sep
示例6: main
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def main():
app = QtWidgets.QApplication(sys.argv)
root = coin.SoSeparator()
mat = coin.SoMaterial()
mat.diffuseColor.setValue(coin.SbColor(0.8, 1, 0.8))
mat.specularColor.setValue(coin.SbColor(1, 1, 1))
mat.shininess.setValue(1.0)
mat.transparency.setValue(0.9)
root.addChild(mat)
root.addChild(coin.SoSphere())
root.addChild(coin.SoCube())
viewer = quarter.QuarterWidget()
viewer.setSceneGraph(root)
viewer.setWindowTitle("minimal")
viewer.show()
sys.exit(app.exec_())
示例7: displaysphere
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def displaysphere(self,point,radius=5,color=(1,1,1)):
try:
sg=self._sg
except:
sg = SoSeparator()
self._sg= sg
root=FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
root.addChild(sg)
p=point
#say(point,color,"##########")
trans = coin.SoTranslation()
trans.translation.setValue(p.x,p.y,p.z)
cub = coin.SoSphere()
cub.radius.setValue(radius)
col = coin.SoBaseColor()
col.rgb=color
myCustomNode = coin.SoSeparator()
myCustomNode.addChild(col)
myCustomNode.addChild(trans)
myCustomNode.addChild(cub)
sg.addChild(myCustomNode)
示例8: __init__
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def __init__(self,pl=None, scale=[100,100,20],offset=100,name='ARROW'):
# define main properties
self.view=FreeCADGui.ActiveDocument.ActiveView
self.sg=self.view.getSceneGraph()
self.cb=self.view.addEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.pickCB)
# define OpenInventor properties
self.node=coin.SoSeparator() #self.node=coin.SoSelection()
self.name=name
self.node.setName(self.name)
self.color=coin.SoBaseColor(); self.color.rgb=0,0.8,0
self.transform=coin.SoTransform(); self.transform.scaleFactor.setValue(scale)
self.cone=coin.SoCone()
# create children of node
self.node.addChild(self.color)
self.node.addChild(self.transform)
self.node.addChild(self.cone)
# draw the arrow and move it to its Placement with the specified offset
self.sg.addChild(self.node)
self.offset=offset
if not pl:
pl=FreeCAD.Placement()
self.moveto(pl)
示例9: main
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def main():
app = QApplication(sys.argv)
root = coin.SoSeparator()
vert = coin.SoVertexShader()
vert.sourceProgram = "vertex.glsl"
frag = coin.SoFragmentShader()
frag.sourceProgram = "frag.glsl"
shaders = [vert,frag]
pro = coin.SoShaderProgram()
pro.shaderObject.setValues(0,len(shaders),shaders)
mat = coin.SoMaterial()
mat.diffuseColor.setValue(coin.SbColor(0.8, 0.8, 0.8))
mat.specularColor.setValue(coin.SbColor(1, 1, 1))
mat.shininess.setValue(1.0)
mat.transparency.setValue(0.5)
sphere = coin.SoSphere()
sphere.radius = 1.2
root.addChild(pro)
root.addChild(sphere)
root.addChild(mat)
root.addChild(coin.SoCube())
viewer = quarter.QuarterWidget()
viewer.setSceneGraph(root)
viewer.setWindowTitle("minimal")
viewer.show()
sys.exit(app.exec_())
示例10: __init__
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def __init__(self):
super(Axis, self).__init__()
self.xAxisSep = coin.SoSeparator()
self.yAxisSep = coin.SoSeparator()
self.zAxisSep = coin.SoSeparator()
self.xaxisColor = coin.SoBaseColor()
self.yaxisColor = coin.SoBaseColor()
self.zaxisColor = coin.SoBaseColor()
self.xaxisColor.rgb = (0.8,0,0)
self.xpts = [] #[[p[0]-1000,p[1],p[2]],[p[0]+1000,p[1],p[2]]]
self.yaxisColor.rgb = (0,0.8,0)
self.ypts = [] #[[p[0],p[1]-1000,p[2]],[p[0],p[1]+1000,p[2]]]
self.zaxisColor.rgb = (0,0,0.8)
self.zpts = [] #[[p[0],p[1],p[2]-1000],[p[0],p[1],p[2]+1000]]
self.xaxis = coin.SoLineSet()
self.xaxisPoints = coin.SoCoordinate3()
self.xaxisPoints.point.setValue(0,0,0)
self.xaxisPoints.point.setValues(0,len(self.xpts),self.xpts)
self.xAxisSep.addChild(self.xaxisColor)
self.xAxisSep.addChild(self.xaxisPoints)
self.xAxisSep.addChild(self.xaxis)
self.yaxis = coin.SoLineSet()
self.yaxisPoints = coin.SoCoordinate3()
self.yaxisPoints.point.setValue(0,0,0)
self.yaxisPoints.point.setValues(0,len(self.ypts),self.ypts)
self.yAxisSep.addChild(self.yaxisColor)
self.yAxisSep.addChild(self.yaxisPoints)
self.yAxisSep.addChild(self.yaxis)
self.zaxis = coin.SoLineSet()
self.zaxisPoints = coin.SoCoordinate3()
self.zaxisPoints.point.setValue(0,0,0)
self.zaxisPoints.point.setValues(0,len(self.zpts),self.zpts)
self.zAxisSep.addChild(self.zaxisColor)
self.zAxisSep.addChild(self.zaxisPoints)
self.zAxisSep.addChild(self.zaxis)
self.xState = False
self.yState = False
self.zState = False
示例11: __init__
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def __init__(self, color = (0.,0.,0.), font = 'sans', size = 16, offset = 0):
super(multiTextNode, self).__init__()
self.fontNode = coin.SoFont()
self.textSep = coin.SoSeparator()
self.nodeList = []
self._data = []
self.addChild(self.fontNode)
self.addChild(self.textSep)
self.color = color
self.font = font
self.size = size
self.offset = offset
示例12: data
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def data(self, datarr):
if not ((len(self._data) == len(datarr[0])) & (len(self._data) == len(datarr[1]))): # lengths of the 2 arrays are different. Wipe the Separator and populate it.
self.nodeList = []
self._data = []
self.textSep.removeAllChildren()
for i in range(min(len(datarr[0]),len(datarr[1]))):
sep = coin.SoSeparator()
textpos = coin.SoTransform()
textpos.translation.setValue([datarr[0][i][0],datarr[0][i][1],datarr[0][i][2]])
text = coin.SoText2()
field = [""]*self.offset + [datarr[1][i]]
text.string.setValues(0,len(field),field)
sep.addChild(textpos)
sep.addChild(text)
self.textSep.addChild(sep)
self.nodeList.append((textpos,text))
self._data.append((datarr[0][i],datarr[1][i]))
else:
for i in range(min(len(datarr[0]),len(datarr[1]))):
print(range(min(len(datarr[0]),len(datarr[1]))))
print(self.nodeList[i][0])
self.nodeList[i][0].translation.setValue([datarr[0][i][0],datarr[0][i][1],datarr[0][i][2]])
field = [""]*self.offset + [datarr[1][i]]
self.nodeList[i][1].string.setValues(0,len(field),field)
self._data[i] = (datarr[0][i],datarr[1][i])
#c = coordinate3Node([(0,1,0),(1,1,0),(2,2,1)])
#p = polygonNode((0.5,0.9,0.1),2)
#m = markerSetNode((1,0.35,0.8),1)
#t = text2dNode((0.2,0.9,0.9),'osiFont',15,(10,15,20),'blabla')
#mt = multiTextNode((0.2,0.9,0.9),'osiFont',15,(10,15,20))
#mt.data = ([(1,2,3),(4,5,6)],['bla','blublu'])
示例13: __init__
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def __init__(self, name = "GridView"):
super(gridView, self).__init__()
self.setName(name)
self._number_of_points = 50
self._center = (0,0)
self._scale = 1.0
self._axis = 0 # 1=X 2=Y 3=Z
self.transform = coin.SoTransform()
self.coord = coin.SoCoordinate3()
self.sep1 = coin.SoSeparator()
self.sep1.setName("Snap_Points")
self.sep2 = coin.SoSeparator()
self.sep2.setName("Grid")
self.sep3 = coin.SoSeparator()
self.sep3.setName("Axis")
self.addChild(self.transform)
self.addChild(self.coord)
self.addChild(self.sep1)
self.addChild(self.sep2)
self.addChild(self.sep3)
ps = coin.SoPointSet()
ds = coin.SoDrawStyle()
ds.pointSize = 1
self.sep1.addChild(ds)
self.sep1.addChild(ps)
self.color1 = (0.82, 0.15, 0.15) # red (X)
self.color2 = (0.40, 0.59, 0.20) # green (Y)
self.color3 = (0.13, 0.49, 0.88) # blue (Z)
示例14: __init__
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def __init__(self):
debug("HUD init")
self.HUDNode = coin.SoSeparator()
self.cam = coin.SoOrthographicCamera()
self.cam.aspectRatio = 1
self.cam.viewportMapping = coin.SoCamera.LEAVE_ALONE
self.HUDNode.addChild(self.cam)
示例15: main
# 需要导入模块: from pivy import coin [as 别名]
# 或者: from pivy.coin import SoSeparator [as 别名]
def main():
app = QApplication(sys.argv)
viewer = quarter.QuarterWidget()
root = coin.SoSeparator()
root += coin.SoCone()
root += test()
viewer.setSceneGraph(root)
viewer.setBackgroundColor(QColor(255, 255, 255))
viewer.setWindowTitle("minimal")
viewer.show()
sys.exit(app.exec_())