def __init__(this, *args, **kwargs): heptagonsShape = Geom3D.IsometricShape(Vs=[], Fs=[], directIsometries=isomA5, name='FoldedHeptagonsA5', recreateEdges=False) xtraTrisShape = Geom3D.IsometricShape(Vs=[], Fs=[], directIsometries=isomA5, name='xtraTrisA5', recreateEdges=False) trisO3Shape = Geom3D.SymmetricShape(Vs=[], Fs=[], finalSym=isomA5, stabSym=isomO3, colors=[([rgb.cyan[:]], [])], name='o3TrisA5', recreateEdges=False) trisO5Shape = Geom3D.SymmetricShape(Vs=[], Fs=[], finalSym=isomA5, stabSym=isomO5, colors=[([rgb.cyan[:]], [])], name='o5PentasA5', recreateEdges=False) Heptagons.FldHeptagonShape.__init__( this, [heptagonsShape, xtraTrisShape, trisO3Shape, trisO5Shape], 5, 3, name='FoldedRegHeptA5xI') this.heptagonsShape = heptagonsShape this.xtraTrisShape = xtraTrisShape this.trisO3Shape = trisO3Shape this.trisO5Shape = trisO5Shape this.posAngleMin = -math.pi / 2 this.posAngleMax = math.pi / 2 this.height = 2.7 this.dihedralAngle = Geom3D.Deg2Rad * 119 this.initArrs() this.setTriangleFillPosition(0) this.setEdgeAlternative(trisAlt.strip_II, trisAlt.strip_II) this.setV()
def __init__(this, *args, **kwargs): heptagonsShape = Geom3D.IsometricShape( Vs = [], Fs = [], directIsometries = isomS4, name = 'FoldedHeptagonsS4', recreateEdges = False ) xtraTrisShape = Geom3D.IsometricShape( Vs = [], Fs = [], directIsometries = isomS4, name = 'xtraTrisS4', recreateEdges = False ) trisO3Shape = Geom3D.SymmetricShape( Vs = [], Fs = [], finalSym = isomS4, stabSym = isomO3, colors = [([rgb.cyan[:]], [])], name = 'o3TrisS4', recreateEdges = False ) trisO4Shape = Geom3D.SymmetricShape( Vs = [], Fs = [], finalSym = isomS4, stabSym = isomO4, colors = [([rgb.cyan[:]], [])], name = 'o4SquareS4', recreateEdges = False ) Heptagons.FldHeptagonShape.__init__(this, [heptagonsShape, xtraTrisShape, trisO3Shape, trisO4Shape], 4, 3, name = 'FoldedRegHeptS4xI' ) this.heptagonsShape = heptagonsShape this.xtraTrisShape = xtraTrisShape this.trisO3Shape = trisO3Shape this.trisO4Shape = trisO4Shape this.posAngleMin = -pos_angle_refl_2 this.posAngleMax = pos_angle_refl_2 this.height = 3.9 this.setEdgeAlternative(trisAlt.strip_1_loose, trisAlt.strip_1_loose) this.initArrs() this.setV()
def onApplySymmetry(this, e): print this.GetSize() Vs = this.showGui[this.__VsGuiIndex].get() Fs = this.showGui[this.__FsGuiIndex].get() if Fs == []: this.statusText('No faces defined!', LOG_ERR) return finalSymGui = this.showGui[this.__FinalSymGuiIndex] finalSym = finalSymGui.GetSelected() finalSymIndex = finalSymGui.getSelectedIndex() stabSymGui = this.showGui[this.__StabSymGuiIndex] stabSym = stabSymGui.GetSelected() stabSymIndex = stabSymGui.getSelectedIndex() this.finalSymSetup[finalSymIndex] = finalSym.setup # copy? this.stabSymSetup[finalSymIndex][stabSymIndex] = stabSym.setup # copy? try: this.shape = Geom3D.SymmetricShape(Vs, Fs, finalSym=finalSym, stabSym=stabSym, name=this.name) except isometry.ImproperSubgroupError: this.statusText('Stabiliser not a subgroup of final symmetry!', LOG_ERR) if e != None: e.Skip() return this.FsOrbit = this.shape.getIsometries()['direct'] this.FsOrbitOrg = True this.shape.recreateEdges() this.updateOrientation() this.canvas.panel.setShape(this.shape) updated0 = this.showGui[this.__FinalSymGuiIndex].isSymClassUpdated() updated1 = this.showGui[this.__StabSymGuiIndex].isSymClassUpdated() # Note the functions above need to be called to update the latest # status. I.e. don't call them in the or below, because the second will # not be called if the first is true. if (updated0 or updated1): this.addColourGui() else: this.onNrColsSel(this.colGuis[this.__nrOfColsGuiId]) this.panel.Layout() this.statusText('Symmetry applied: choose colours!', LOG_INFO) try: tst = this.cols except AttributeError: this.cols = [(255, 100, 0)] if e != None: e.Skip()
def onNrColsSel(this, e): try: this.selColSizer.Clear(True) except AttributeError: this.selColSizer = wx.BoxSizer(wx.VERTICAL) this.colSizer.Add(this.selColSizer, 0, wx.EXPAND) nextPrevColSizer = wx.BoxSizer(wx.HORIZONTAL) this.colGuis.append( wx.Button(this.panel, wx.ID_ANY, "Previous Alternative")) this.panel.Bind(wx.EVT_BUTTON, this.onPrevColAlt, id=this.colGuis[-1].GetId()) nextPrevColSizer.Add(this.colGuis[-1], 0, wx.EXPAND) this.colGuis.append( wx.Button(this.panel, wx.ID_ANY, "Next Alternative")) this.panel.Bind(wx.EVT_BUTTON, this.onNextColAlt, id=this.colGuis[-1].GetId()) nextPrevColSizer.Add(this.colGuis[-1], 0, wx.EXPAND) nextPrevColSizer.Add(wx.BoxSizer(wx.HORIZONTAL), 1, wx.EXPAND) this.colGuis.append( wx.Button(this.panel, wx.ID_ANY, "Reset Colours")) this.panel.Bind(wx.EVT_BUTTON, this.onResetCols, id=this.colGuis[-1].GetId()) nextPrevColSizer.Add(this.colGuis[-1], 0, wx.EXPAND) this.colSizer.Add(nextPrevColSizer, 0, wx.EXPAND) colDivNr = e.GetSelection() this.colAlternative[0] = colDivNr l0 = len(this.orbit.higherOrderStabiliserProps) if colDivNr < l0: this.colFinalSym = this.orbit.final this.colIsoms = this.orbit.higherOrderStabiliser(colDivNr) nrOfCols = this.orbit.higherOrderStabiliserProps[colDivNr]['index'] else: this.colFinalSym = this.orbit.altFinal this.colIsoms = this.orbit.lowerOrderStabiliser(colDivNr - l0) nrOfCols = this.orbit.lowerOrderStabiliserProps[colDivNr - l0]['index'] # now the FsOrbit might contain isometries that are not part of the # colouring isometries. Recreate the shape with isometries that only # have these: if this.FsOrbitOrg: finalSym = this.orbit.altFinal stabSym = this.orbit.altStab Vs = this.shape.getBaseVertexProperties()['Vs'] Fs = this.shape.getBaseFaceProperties()['Fs'] this.shape = Geom3D.SymmetricShape(Vs, Fs, finalSym=finalSym, stabSym=stabSym, name=this.name) this.FsOrbit = this.shape.getIsometries()['direct'] this.shape.recreateEdges() this.canvas.panel.setShape(this.shape) this.FsOrbitOrg = False # and do this only once assert len(this.colIsoms) != 0 this.selColGuis = [] initColour = (255, 255, 255) maxColPerRow = 12 # Add buttons for choosing individual colours: for i in range(nrOfCols): try: col = this.cols[i] except IndexError: col = initColour this.cols.append(col) if i % maxColPerRow == 0: selColSizerRow = wx.BoxSizer(wx.HORIZONTAL) this.selColSizer.Add(selColSizerRow, 0, wx.EXPAND) this.selColGuis.append( wxLibCS.ColourSelect(this.panel, wx.ID_ANY, colour=col)) this.panel.Bind(wxLibCS.EVT_COLOURSELECT, this.onColSel) selColSizerRow.Add(this.selColGuis[-1], 0, wx.EXPAND) this.nrOfCols = nrOfCols # replace invalid index of colour alternative with the last possible if this.colAlternative[1] >= len(this.colIsoms): this.colAlternative[1] = len(this.colIsoms) - 1 this.updatShapeColours() this.panel.Layout()