Пример #1
0
def commandCutOff(lastCoordinate=0):
	gfFigure=gf.figureGet()
	if gfFigure:
		gfFigure[0]=[gf.posRotate(p) for p in gfFigure[0]]
	figures=objFigure.fromGfFigure(gfFigure)
	if not figures:
		raise RuntimeError("Nothing opened")
	dim=figures[0].spaceDim
	hyperplane=algebra.Hyperplane((0,)*(dim-1)+(1,), lastCoordinate)
	newFigures=[]
	for f in figures:
		newFigures.extend(cutFigure(f, hyperplane)[0])
	gfFigure=objFigure.toGfFigure(newFigures)
	if gfFigure:
		gfFigure[0]=[gf.posRotateBack(p) for p in gfFigure[0]]
	if figureInfo:
		name, desc=figureInfo.getNameDesc()
	gf.figureOpen(gfFigure, True)
	if figureInfo:
		figureInfo.setNameDescPath("Truncated "+name, None)
Пример #2
0
def commandCutFigure(lastCoordinate=0):
	gfFigure=gf.figureGet()
	gfFigure[0]=[gf.posRotate(p) for p in gfFigure[0]]
	figures=objFigure.fromGfFigure(gfFigure)
	if not figures:
		raise RuntimeError("Nothing opened")
	dim=figures[0].spaceDim
	if dim<=0:
		raise RuntimeError("The figure cannot be cut")
	hyperplane=algebra.Hyperplane((0,)*(dim-1)+(1,), lastCoordinate)
	newFigures=[]
	for f in figures:
		newFigures.extend(cutFigure(f, hyperplane)[1])
	gfFigure=objFigure.toGfFigure(newFigures)
	if gfFigure:
		gfFigure[0]=[p[:-1] for p in gfFigure[0]]
		del gfFigure[dim]
	if figureInfo:
		name, desc=figureInfo.getNameDesc()
	gf.figureOpen(gfFigure)
	if figureInfo:
		figureInfo.setNameDescPath("Cross-section of "+name, None)