def sceneDrawFilledPaths(grpName, paths, scale_factor, color=(0, 0, 1)): global sg global topZ global scenePathNodes for i in range(0, len(paths)): path = paths[i] pts = [] for pt in path: pts.append( [1.0 * pt[0] / scale_factor, 1.0 * pt[1] / scale_factor, topZ]) coPoint = coin.SoCoordinate3() coPoint.point.setValues(0, len(pts), pts) ma = coin.SoMaterial() ma.diffuseColor = color if i == 0: ma.transparency.setValue(0.9) else: ma.transparency.setValue(0.8) hints = coin.SoShapeHints() hints.faceType = coin.SoShapeHints.UNKNOWN_FACE_TYPE #hints.vertexOrdering = coin.SoShapeHints.CLOCKWISE li = coin.SoIndexedFaceSet() li.coordIndex.setValues(range(0, len(pts))) pathNode = coin.SoSeparator() pathNode.addChild(hints) pathNode.addChild(coPoint) pathNode.addChild(ma) pathNode.addChild(li) sg.addChild(pathNode) if not scenePathNodes.has_key(grpName): scenePathNodes[grpName] = [] scenePathNodes[grpName].append(pathNode)
def get_scene_graph(self, resolution=None): """ Any object that provides a nice QuadMesh from the previous code should be able to render in Coin3D with with the following... Prefer to allow objects to calculate a 'suitable' resolution based on size. """ n = coin.SoSeparator() X, Y, Z = self.mesh(resolution) nr, nc = X.shape A = [(X.flat[i], Y.flat[i], Z.flat[i]) for i in range(len(X.flat))] coor = coin.SoCoordinate3() coor.point.setValues(0, len(A), A) n.addChild(coor) sh = coin.SoShapeHints() sh.shapeType = coin.SoShapeHintsElement.UNKNOWN_SHAPE_TYPE sh.vertexOrdering = coin.SoShapeHintsElement.COUNTERCLOCKWISE sh.faceType = coin.SoShapeHintsElement.UNKNOWN_FACE_TYPE n.addChild(sh) qm = coin.SoQuadMesh() qm.verticesPerRow = nc qm.verticesPerColumn = nr n.addChild(qm) return n
def mesh_sep(vertices, polygons, color=(1,1,0), draw_lines=False): _vertices = vertices _polygons = [] _lines = [] for i in polygons: _polygons += i _lines += i _lines.append(i[0]) _polygons.append(-1) _lines.append(-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 = coin.M_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 if draw_lines: line_set = coin.SoIndexedLineSet() line_set.coordIndex.setValues(0, len(_lines), list(_lines)) line_mat = coin.SoMaterial() line_mat.diffuseColor = (.0, .0, .0) sep += line_mat, line_set return sep
def onChanged(self,vobj,prop): if prop == "ShowNodes": if hasattr(self,"nodes"): vobj.Annotation.removeChild(self.nodes) del self.nodes if vobj.ShowNodes: from pivy import coin self.nodes = coin.SoAnnotation() self.coords = coin.SoCoordinate3() self.mat = coin.SoMaterial() self.pointstyle = coin.SoDrawStyle() self.pointstyle.style = coin.SoDrawStyle.POINTS self.pointset = coin.SoType.fromName("SoBrepPointSet").createInstance() self.linestyle = coin.SoDrawStyle() self.linestyle.style = coin.SoDrawStyle.LINES self.lineset = coin.SoType.fromName("SoBrepEdgeSet").createInstance() self.facestyle = coin.SoDrawStyle() self.facestyle.style = coin.SoDrawStyle.FILLED self.shapehints = coin.SoShapeHints() self.shapehints.faceType = coin.SoShapeHints.UNKNOWN_FACE_TYPE self.fmat = coin.SoMaterial() self.fmat.transparency.setValue(0.75) self.faceset = coin.SoIndexedFaceSet() self.nodes.addChild(self.coords) self.nodes.addChild(self.mat) self.nodes.addChild(self.pointstyle) self.nodes.addChild(self.pointset) self.nodes.addChild(self.linestyle) self.nodes.addChild(self.lineset) self.nodes.addChild(self.facestyle) self.nodes.addChild(self.shapehints) self.nodes.addChild(self.fmat) self.nodes.addChild(self.faceset) vobj.Annotation.addChild(self.nodes) self.updateData(vobj.Object,"Nodes") self.onChanged(vobj,"NodeColor") self.onChanged(vobj,"NodeLine") self.onChanged(vobj,"NodeSize") elif prop == "NodeColor": if hasattr(self,"mat"): l = vobj.NodeColor self.mat.diffuseColor.setValue([l[0],l[1],l[2]]) self.fmat.diffuseColor.setValue([l[0],l[1],l[2]]) elif prop == "NodeLine": if hasattr(self,"linestyle"): self.linestyle.lineWidth = vobj.NodeLine elif prop == "NodeSize": if hasattr(self,"pointstyle"): self.pointstyle.pointSize = vobj.NodeSize elif prop == "NodeType": self.updateData(vobj.Object,"Nodes") else: ArchComponent.ViewProviderComponent.onChanged(self,vobj,prop)
def initializeViewer(self): fmt = QtOpenGL.QGLFormat() fmt.setAlpha(True) QtOpenGL.QGLFormat.setDefaultFormat(fmt) self.rotor = self.buildRotor() hints = coin.SoShapeHints() hints.vertexOrdering = coin.SoShapeHints.COUNTERCLOCKWISE hints.shapeType = coin.SoShapeHints.SOLID hints.faceType = coin.SoShapeHints.CONVEX self.root.addChild(self.rotor) self.root.addChild(hints)
def createExtensionSoSwitch(self, ext): sep = coin.SoSeparator() pos = coin.SoTranslation() mat = coin.SoMaterial() crd = coin.SoCoordinate3() fce = coin.SoFaceSet() hnt = coin.SoShapeHints() if not ext is None: try: wire = ext.getWire() except FreeCAD.Base.FreeCADError: wire = None if wire: if isinstance(wire, (list, tuple)): p0 = [p for p in wire[0].discretize(Deflection=0.02)] p1 = [p for p in wire[1].discretize(Deflection=0.02)] p2 = list(reversed(p1)) polygon = [(p.x, p.y, p.z) for p in (p0 + p2)] else: poly = [p for p in wire.discretize(Deflection=0.02)][:-1] polygon = [(p.x, p.y, p.z) for p in poly] crd.point.setValues(polygon) else: return None mat.diffuseColor = self.ColourDisabled mat.transparency = self.TransparencyDeselected hnt.faceType = coin.SoShapeHints.UNKNOWN_FACE_TYPE hnt.vertexOrdering = coin.SoShapeHints.CLOCKWISE sep.addChild(pos) sep.addChild(mat) sep.addChild(hnt) sep.addChild(crd) sep.addChild(fce) switch = coin.SoSwitch() switch.addChild(sep) switch.whichChild = coin.SO_SWITCH_NONE self.material = mat return switch
def attach(self,vobj): ArchComponent.ViewProviderComponent.attach(self,vobj) from pivy import coin self.color = coin.SoBaseColor() self.font = coin.SoFont() self.text1 = coin.SoAsciiText() self.text1.string = " " self.text1.justification = coin.SoAsciiText.LEFT self.text2 = coin.SoAsciiText() self.text2.string = " " self.text2.justification = coin.SoAsciiText.LEFT self.coords = coin.SoTransform() self.header = coin.SoTransform() self.label = coin.SoSwitch() sep = coin.SoSeparator() self.label.whichChild = 0 sep.addChild(self.coords) sep.addChild(self.color) sep.addChild(self.font) sep.addChild(self.text2) sep.addChild(self.header) sep.addChild(self.text1) self.label.addChild(sep) vobj.Annotation.addChild(self.label) self.onChanged(vobj,"TextColor") self.onChanged(vobj,"FontSize") self.onChanged(vobj,"FirstLine") self.onChanged(vobj,"LineSpacing") self.onChanged(vobj,"FontName") self.Object = vobj.Object # footprint mode self.fmat = coin.SoMaterial() self.fcoords = coin.SoCoordinate3() self.fset = coin.SoIndexedFaceSet() fhints = coin.SoShapeHints() fhints.vertexOrdering = fhints.COUNTERCLOCKWISE sep = coin.SoSeparator() sep.addChild(self.fmat) sep.addChild(self.fcoords) sep.addChild(fhints) sep.addChild(self.fset) vobj.RootNode.addChild(sep)
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
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
def createExtensionSoSwitch(self, ext): sep = coin.SoSeparator() pos = coin.SoTranslation() mat = coin.SoMaterial() crd = coin.SoCoordinate3() fce = coin.SoFaceSet() hnt = coin.SoShapeHints() if not ext is None: wire = ext.getWire() if wire: poly = [p for p in wire.discretize(Deflection=0.01)][:-1] polygon = [(p.x, p.y, p.z) for p in poly] crd.point.setValues(polygon) else: return None mat.diffuseColor = self.ColourDisabled mat.transparency = self.TransparencyDeselected hnt.faceType = coin.SoShapeHints.UNKNOWN_FACE_TYPE hnt.vertexOrdering = coin.SoShapeHints.CLOCKWISE sep.addChild(pos) sep.addChild(mat) sep.addChild(hnt) sep.addChild(crd) sep.addChild(fce) switch = coin.SoSwitch() switch.addChild(sep) switch.whichChild = coin.SO_SWITCH_NONE self.material = mat return switch
def attach(self, vobj): ''' Create Object visuals in 3D view. ''' # GeoCoords Node. self.geo_coords = coin.SoGeoCoordinate() # Surface features. self.triangles = coin.SoIndexedFaceSet() shape_hints = coin.SoShapeHints() shape_hints.vertex_ordering = coin.SoShapeHints.COUNTERCLOCKWISE self.mat_color = coin.SoMaterial() mat_binding = coin.SoMaterialBinding() mat_binding.value = coin.SoMaterialBinding.OVERALL edge_color = coin.SoBaseColor() edge_color.rgb = (0.5, 0.5, 0.5) offset = coin.SoPolygonOffset() # Line style. line_style = coin.SoDrawStyle() line_style.style = coin.SoDrawStyle.LINES line_style.lineWidth = 2 # Contour features. cont_color = coin.SoBaseColor() cont_color.rgb = (1, 1, 0) self.cont_coords = coin.SoGeoCoordinate() self.cont_lines = coin.SoLineSet() # Contour root. contours = coin.SoSeparator() contours.addChild(cont_color) contours.addChild(line_style) contours.addChild(self.cont_coords) contours.addChild(self.cont_lines) # Face root. faces = coin.SoSeparator() faces.addChild(shape_hints) faces.addChild(self.mat_color) faces.addChild(mat_binding) faces.addChild(self.geo_coords) faces.addChild(self.triangles) # Highlight for selection. highlight = coin.SoType.fromName('SoFCSelection').createInstance() #highlight.documentName.setValue(FreeCAD.ActiveDocument.Name) #highlight.objectName.setValue(vobj.Object.Name) #highlight.subElementName.setValue("Main") highlight.addChild(edge_color) highlight.addChild(line_style) highlight.addChild(self.geo_coords) highlight.addChild(self.triangles) # Surface root. surface_root = coin.SoSeparator() surface_root.addChild(contours) surface_root.addChild(offset) surface_root.addChild(faces) surface_root.addChild(offset) surface_root.addChild(highlight) vobj.addDisplayMode(surface_root,"Surface") # Take features from properties. self.onChanged(vobj,"TriangleColor")
def createExtensionSoSwitch(self, ext): if not ext: return None sep = coin.SoSeparator() pos = coin.SoTranslation() mat = coin.SoMaterial() crd = coin.SoCoordinate3() fce = coin.SoFaceSet() hnt = coin.SoShapeHints() numVert = list() # track number of vertices in each polygon face try: wire = ext.getWire() except FreeCAD.Base.FreeCADError: wire = None if not wire: return None if isinstance(wire, (list, tuple)): p0 = [p for p in wire[0].discretize(Deflection=0.02)] p1 = [p for p in wire[1].discretize(Deflection=0.02)] p2 = list(reversed(p1)) polygon = [(p.x, p.y, p.z) for p in (p0 + p2)] else: if ext.extFaces: # Create polygon for each extension face in compound extensions allPolys = list() extFaces = ext.getExtensionFaces(wire) for f in extFaces: pCnt = 0 wCnt = 0 for w in f.Wires: if wCnt == 0: poly = [p for p in w.discretize(Deflection=0.01)] else: poly = [p for p in w.discretize(Deflection=0.01) ][:-1] pCnt += len(poly) allPolys.extend(poly) numVert.append(pCnt) polygon = [(p.x, p.y, p.z) for p in allPolys] else: # poly = [p for p in wire.discretize(Deflection=0.02)][:-1] poly = [p for p in wire.discretize(Deflection=0.02)] polygon = [(p.x, p.y, p.z) for p in poly] crd.point.setValues(polygon) mat.diffuseColor = self.ColourDisabled mat.transparency = self.TransparencyDeselected hnt.faceType = coin.SoShapeHints.UNKNOWN_FACE_TYPE hnt.vertexOrdering = coin.SoShapeHints.CLOCKWISE if numVert: # Transfer vertex counts for polygon faces fce.numVertices.setValues(tuple(numVert)) sep.addChild(pos) sep.addChild(mat) sep.addChild(hnt) sep.addChild(crd) sep.addChild(fce) # Finalize SoSwitch switch = coin.SoSwitch() switch.addChild(sep) switch.whichChild = coin.SO_SWITCH_NONE self.material = mat return switch
def get_scene_graph(self, resolution, fluxmap, trans, vmin, vmax): """ Any object that provides a nice QuadMesh from the previous code should be able to render in Coin3D with with the following... """ from pivy import coin import matplotlib.cm as cm from matplotlib import colors n0 = self.get_scene_graph_transform() o = self.get_optics_manager() if (o.__class__.__name__ == N.array(['Reflective', 'RealReflective'])).any(): mat = coin.SoMaterial() mat.diffuseColor = (.5, .5, .5) mat.specularColor = (.6, .6, .6) mat.shininess = 1. - o._abs n0.addChild(mat) fluxmap = False elif fluxmap != None: if hasattr(o, 'get_all_hits'): e, h = o.get_all_hits() xyz = self.global_to_local(h)[:3] # plot the histogram into the scenegraph g = self.get_geometry_manager() if hasattr(g, 'get_fluxmap'): flux = g.get_fluxmap(e, xyz, resolution) if not (hasattr(flux[0], '__len__')): flux = [flux] else: fluxmap = False meshes = self._geom.get_scene_graph(resolution) for m in xrange(len(meshes) / 3): n = coin.SoSeparator() X, Y, Z = meshes[3 * m:3 * m + 3] nr, nc = X.shape A = [(X.flat[i], Y.flat[i], Z.flat[i]) for i in range(len(X.flat))] coor = coin.SoCoordinate3() coor.point.setValues(0, len(A), A) n.addChild(coor) qm = coin.SoQuadMesh() qm.verticesPerRow = nc qm.verticesPerColumn = nr n.addChild(qm) sh = coin.SoShapeHints() sh.shapeType = coin.SoShapeHintsElement.UNKNOWN_SHAPE_TYPE sh.vertexOrdering = coin.SoShapeHintsElement.COUNTERCLOCKWISE sh.faceType = coin.SoShapeHintsElement.UNKNOWN_FACE_TYPE n.addChild(sh) if fluxmap: # It works using n0 instead of n here but I have absolutely not clue why. norm = colors.Normalize(vmin=vmin, vmax=vmax) M = cm.ScalarMappable(norm=norm, cmap=cm.viridis) colormap = M.to_rgba(flux[m]) mat = coin.SoMaterial() mat.ambientColor = (1, 1, 1) mat.diffuseColor.setValues(0, colormap.shape[0], colormap) if trans == True: mat.transparency.setValues(0, colormap.shape[0], 1. - flux[m] / N.amax(flux[m])) n0.addChild(mat) mymatbind = coin.SoMaterialBinding() mymatbind.value = coin.SoMaterialBinding.PER_FACE n0.addChild(mymatbind) n0.addChild(n) return n0
def dim_symbol(symbol=None, invert=False): """Return the specified dimension symbol. Parameters ---------- symbol: int, optional It defaults to `None`, in which it gets the value from the parameter database, `get_param("dimsymbol", 0)`. A numerical value defines different markers * 0, `SoSphere` * 1, `SoSeparator` with a `SoLineSet`, a circle (in fact a 24 sided polygon) * 2, `SoSeparator` with a `soCone` * 3, `SoSeparator` with a `SoFaceSet` * 4, `SoSeparator` with a `SoLineSet`, calling `dim_dash` * Otherwise, `SoSphere` invert: bool, optional It defaults to `False`. If it is `True` and `symbol=2`, the cone will be rotated -90 degrees around the Z axis, otherwise the rotation is positive, +90 degrees. Returns ------- Coin.SoNode A `Coin.SoSphere`, or `Coin.SoSeparator` (circle, cone, face, line) that will be used as a dimension symbol. """ if symbol is None: symbol = utils.get_param("dimsymbol", 0) if symbol == 0: # marker = coin.SoMarkerSet() # marker.markerIndex = 80 # Returning a sphere means that the bounding box will # be 3-dimensional; a marker will always be planar seen from any # orientation but it currently doesn't work correctly marker = coin.SoSphere() return marker elif symbol == 1: marker = coin.SoSeparator() v = coin.SoVertexProperty() for i in range(25): ang = math.radians(i * 15) v.vertex.set1Value(i, (math.sin(ang), math.cos(ang), 0)) p = coin.SoLineSet() p.vertexProperty = v marker.addChild(p) return marker elif symbol == 2: marker = coin.SoSeparator() t = coin.SoTransform() t.translation.setValue((0, -2, 0)) t.center.setValue((0, 2, 0)) if invert: t.rotation.setValue(coin.SbVec3f((0, 0, 1)), -math.pi / 2) else: t.rotation.setValue(coin.SbVec3f((0, 0, 1)), math.pi / 2) c = coin.SoCone() c.height.setValue(4) marker.addChild(t) marker.addChild(c) return marker elif symbol == 3: marker = coin.SoSeparator() # hints are required otherwise only the bottom of the face is colored h = coin.SoShapeHints() h.vertexOrdering = h.COUNTERCLOCKWISE c = coin.SoCoordinate3() c.point.setValues([(-1, -2, 0), (0, 2, 0), (1, 2, 0), (0, -2, 0)]) f = coin.SoFaceSet() marker.addChild(h) marker.addChild(c) marker.addChild(f) return marker elif symbol == 4: return dim_dash((-1.5, -1.5, 0), (1.5, 1.5, 0)) else: _wrn( translate("draft", "Symbol not implemented. Using a default symbol.")) return coin.SoSphere()
def draw_RotationPad(p1=App.Vector(0.0, 0.0, 0.0), color=FR_COLOR.FR_GOLD, scale=(1, 1, 1), opacity=0, _rotation=[0.0, 0.0, 0.0]): try: root = coin.SoSeparator() separatorX = coin.SoSeparator() separatorY = coin.SoSeparator() separatorZ = coin.SoSeparator() tempRX = coin.SbVec3f() tempRX.setValue(1, 0, 0) tempRY = coin.SbVec3f() tempRY.setValue(0, 1, 0) tempRZ = coin.SbVec3f() tempRZ.setValue(0, 0, 1) transformX = coin.SoTransform() transformY = coin.SoTransform() transformZ = coin.SoTransform() transformX.rotation.setValue(tempRY, math.radians(_rotation[0])) transformY.rotation.setValue(tempRX, math.radians(_rotation[1])) transformZ.rotation.setValue(tempRZ, math.radians(_rotation[2])) material = coin.SoMaterial() material.transparency.setValue(opacity) material.diffuseColor.setValue(coin.SbColor(color)) Shapehint = coin.SoShapeHints() Shapehint.shapeType = coin.SoShapeHints.UNKNOWN_FACE_TYPE Shapehint.vertexOrdering = coin.SoShapeHints.CLOCKWISE Shapehint.faceType = coin.SoShapeHints.UNKNOWN_FACE_TYPE soIndexFace = coin.SoIndexedFaceSet() cordinate = coin.SoCoordinate3() vertexPositions = [ (0, 0, 0.5), (0.01, 0, 0.5), (0.02, 0, 0.5), (0.02, 0, 0.49), (0.03, 0, 0.49), (0.04, 0, 0.49), (0.04, 0, 0.48), (0.04, 0, 0.47), (0.05, 0, 0.47), (0.05, 0, 0.46), (0.05, 0, 0.45), (0, 0, 0.4), (-0.01, 0, 0.4), (-0.02, 0, 0.4), (-0.02, 0, 0.41), (-0.03, 0, 0.41), (-0.04, 0, 0.41), (-0.04, 0, 0.42), (-0.04, 0, 0.43), (-0.05, 0, 0.43), (-0.05, 0, 0.44), (-0.05, 0, 0.45), (-0.05, 0, 0.46), (-0.05, 0, 0.47), (-0.04, 0, 0.47), (-0.04, 0, 0.48), (-0.04, 0, 0.49), (-0.03, 0, 0.49), (-0.02, 0, 0.49), (-0.02, 0, 0.5), (-0.01, 0, 0.5), (0.05, 0, 0.44), (0.05, 0, 0.43), (0.04, 0, 0.43), (0.04, 0, 0.42), (0.04, 0, 0.41), (0.03, 0, 0.41), (0.02, 0, 0.41), (0.02, 0, 0.4), (0.01, 0, 0.4), (-0.09, 0, 0.49), (-0.17, 0, 0.47), (-0.24, 0, 0.44), (-0.31, 0, 0.39), (-0.37, 0, 0.34), (-0.42, 0, 0.27), (-0.46, 0, 0.2), (-0.48, 0, 0.13), (-0.5, 0, 0.05), (-0.5, 0, -0.03), (-0.49, 0, -0.11), (-0.46, 0, -0.19), (-0.43, 0, -0.26), (-0.38, 0, -0.33), (-0.32, 0, -0.38), (-0.25, 0, -0.43), (-0.18, 0, -0.47), (-0.1, 0, -0.49), (-0.02, 0, -0.5), (0.06, 0, -0.5), (0.14, 0, -0.48), (0.21, 0, -0.45), (0.28, 0, -0.41), (0.35, 0, -0.36), (0.4, 0, -0.3), (0.44, 0, -0.23), (0.47, 0, -0.16), (0.49, 0, -0.08), (0.5, 0, 0), (0.49, 0, 0.08), (0.48, 0, 0.15), (0.45, 0, 0.22), (0.41, 0, 0.29), (0.36, 0, 0.35), (0.3, 0, 0.4), (0.24, 0, 0.44), (0.17, 0, 0.47), (0.09, 0, 0.49), (0.1, 0, 0.48), (0.1, 0, 0.46), (0.1, 0, 0.45), (0.1, 0, 0.43), (0.09, 0, 0.41), (0.08, 0, 0.39), (0.4, 0, 0), (0.39, 0, 0.07), (0.38, 0, 0.13), (0.35, 0, 0.2), (0.31, 0, 0.25), (0.26, 0, 0.3), (0.21, 0, 0.34), (0.15, 0, 0.37), (-0.08, 0, 0.39), (-0.15, 0, 0.37), (-0.21, 0, 0.34), (-0.27, 0, 0.29), (-0.32, 0, 0.24), (-0.36, 0, 0.18), (-0.38, 0, 0.11), (-0.4, 0, 0.04), (-0.4, 0, -0.03), (-0.39, 0, -0.1), (-0.36, 0, -0.17), (-0.33, 0, -0.23), (-0.28, 0, -0.29), (-0.22, 0, -0.33), (-0.16, 0, -0.37), (-0.09, 0, -0.39), (-0.02, 0, -0.4), (0.05, 0, -0.4), (0.12, 0, -0.38), (0.19, 0, -0.35), (0.25, 0, -0.31), (0.3, 0, -0.26), (0.34, 0, -0.21), (0.37, 0, -0.14), (0.39, 0, -0.07), (-0.09, 0, 0.41), (-0.1, 0, 0.43), (-0.1, 0, 0.45), (-0.1, 0, 0.47), (0, 0, 0.5), (0.05, 0, 0.45), (0, 0, 0.4), (-0.09, 0, 0.49), (0.5, 0, 0), (-0.08, 0, 0.39), (0.4, 0, 0), (0.08, 0, 0.39), (0.1, 0, 0.45), (0.09, 0, 0.49) ] cordinate.point.setValues(0, 468, vertexPositions) indices = [ 5, 1, 0, -1, 5, 2, 1, -1, 5, 3, 2, -1, 5, 4, 3, -1, 5, 7, 6, -1, 5, 8, 7, -1, 5, 9, 8, -1, 5, 10, 9, -1, 5, 12, 11, -1, 5, 13, 12, -1, 5, 14, 13, -1, 5, 15, 14, -1, 5, 16, 15, -1, 5, 17, 16, -1, 5, 18, 17, -1, 5, 19, 18, -1, 5, 20, 19, -1, 5, 21, 20, -1, 5, 22, 21, -1, 5, 23, 22, -1, 5, 24, 23, -1, 5, 25, 24, -1, 5, 26, 25, -1, 5, 27, 26, -1, 5, 28, 27, -1, 5, 29, 28, -1, 5, 30, 29, -1, 5, 0, 30, -1, 5, 31, 10, -1, 5, 32, 31, -1, 5, 33, 32, -1, 5, 34, 33, -1, 5, 35, 34, -1, 5, 36, 35, -1, 5, 37, 36, -1, 5, 38, 37, -1, 5, 39, 38, -1, 5, 11, 39, -1, 104, 53, 54, -1, 103, 52, 53, -1, 103, 53, 104, -1, 105, 54, 55, -1, 105, 104, 54, -1, 102, 52, 103, -1, 102, 51, 52, -1, 106, 55, 56, -1, 106, 105, 55, -1, 101, 51, 102, -1, 101, 50, 51, -1, 107, 106, 56, -1, 107, 56, 57, -1, 100, 48, 49, -1, 100, 49, 50, -1, 100, 50, 101, -1, 108, 107, 57, -1, 108, 57, 58, -1, 108, 58, 59, -1, 99, 47, 48, -1, 99, 48, 100, -1, 109, 108, 59, -1, 60, 109, 59, -1, 98, 47, 99, -1, 110, 109, 60, -1, 46, 47, 98, -1, 61, 110, 60, -1, 97, 46, 98, -1, 111, 110, 61, -1, 45, 46, 97, -1, 62, 111, 61, -1, 96, 45, 97, -1, 112, 111, 62, -1, 44, 45, 96, -1, 63, 112, 62, -1, 95, 44, 96, -1, 113, 112, 63, -1, 43, 44, 95, -1, 64, 113, 63, -1, 94, 43, 95, -1, 114, 113, 64, -1, 42, 43, 94, -1, 65, 114, 64, -1, 93, 42, 94, -1, 115, 114, 65, -1, 41, 42, 93, -1, 66, 115, 65, -1, 117, 93, 92, -1, 116, 115, 66, -1, 118, 41, 93, -1, 118, 93, 117, -1, 119, 41, 118, -1, 120, 41, 119, -1, 40, 41, 120, -1, 67, 84, 116, -1, 67, 116, 66, -1, 68, 84, 67, -1, 91, 82, 83, -1, 81, 82, 91, -1, 69, 84, 68, -1, 69, 85, 84, -1, 70, 85, 69, -1, 70, 86, 85, -1, 76, 81, 91, -1, 76, 77, 78, -1, 76, 78, 79, -1, 76, 79, 80, -1, 76, 80, 81, -1, 71, 86, 70, -1, 71, 87, 86, -1, 75, 76, 91, -1, 75, 91, 90, -1, 72, 87, 71, -1, 72, 88, 87, -1, 74, 75, 90, -1, 74, 90, 89, -1, 73, 88, 72, -1, 73, 74, 89, -1, 73, 89, 88, -1 ] soIndexFace.coordIndex.setValues(0, len(indices), indices) separatorX.addChild(transformX) separatorX.addChild(Shapehint) separatorX.addChild(cordinate) separatorX.addChild(soIndexFace) separatorY.addChild(transformY) separatorY.addChild(separatorX) separatorZ.addChild(transformZ) separatorZ.addChild(separatorY) transform = coin.SoTransform() # for scale only trans = coin.SoTranslation() trans.translation.setValue(p1) # Only for scale transform.scaleFactor.setValue([scale[0], scale[1], scale[2]]) root.addChild(trans) root.addChild(material) root.addChild(transform) root.addChild(separatorZ) return root except Exception as err: App.Console.PrintError("'draw draw_RotationPad' Failed. " "{err}\n".format(err=str(err))) exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print(exc_type, fname, exc_tb.tb_lineno)