public static Imprint GetImprintDataFromGrammar(string grammarId) { Imprint res = new Imprint(); using (OleDbConnection connection = new OleDbConnection(connectionString)) { connection.Open(); OleDbCommand query = new OleDbCommand("SELECT Grammars.*, City as city_name, County as county_name, Country as country_name FROM Grammars, Cities c, Counties co, Country cr WHERE Grammar = ? and Grammars.city_id = c.City_id and Grammars.county_id = co.County_Id and Grammars.country_id = cr.Country_Id", connection); var queryParam = query.CreateParameter(); queryParam.Value = grammarId.ToString(); query.Parameters.Add(queryParam); OleDbDataReader reader = query.ExecuteReader(); if (reader.Read()) { res.Grammar_id = Convert.ToInt32(grammarId); res.City_name = reader["city_name"].ToString(); res.County_name = reader["county_name"].ToString(); res.Country_name = reader["country_name"].ToString(); res.City_id = Convert.ToInt32(reader["city_id"]); res.County_id = Convert.ToInt32(reader["county_id"]); res.Country_id = Convert.ToInt32(reader["country_id"]); res.Printers = reader["Printers"].ToString(); res.Booksellers = reader["Booksellers"].ToString(); res.Price = reader["Price"].ToString(); res.Description = reader["Physical_Description"].ToString(); } } return(res); }
public void CreateImprint() { ExampleObj = new ExampleObject(); ExampleImprint = new Imprint <ExampleObject>(this.ExampleObj); this.Output1 = ExampleImprint.Value.P1; this.Output2 = ExampleObj.P1; }
public void ReversedFace() { var baseShape = new Box { DimensionX = 20, DimensionY = 20, DimensionZ = 20, }; var body = TestGeomGenerator.CreateBody(baseShape, new Pnt(-10, -10, 0)); var imprint = Imprint.Create(body, baseShape.GetSubshapeReference(SubshapeType.Face, 0)); var sketch = imprint.Operands[1] as Sketch; Assert.IsNotNull(sketch); sketch.Points.Add(0, new Pnt2d(0, 0)); sketch.Points.Add(1, new Pnt2d(0, 11)); sketch.Segments.Add(0, new SketchSegmentCircle(0, 1)); Assert.IsNotNull(imprint); imprint.Depth = 2.5; imprint.Mode = Imprint.ImprintMode.Raise; Assert.IsTrue(imprint.Make(Shape.MakeFlags.None)); Assert.IsTrue(ModelCompare.CompareShape(imprint, Path.Combine(_BasePath, "ReversedFace"))); }
//-------------------------------------------------------------------------------------------------- /// <summary> /// Reselect target face of an imprint shape. /// </summary> public CreateImprintTool(Imprint imprintToChange) { _ImprintToChange = imprintToChange; Debug.Assert(_ImprintToChange != null); _TargetBody = _ImprintToChange.Body; Debug.Assert(_TargetBody != null); _TargetShape = _ImprintToChange.Operands[0] as Shape; Debug.Assert(_TargetShape != null); _Mode = ToolMode.ReselectFace; }
public void ChamferFaces(int edgeToChamfer, int faceToImprint, Imprint.ImprintMode mode) { var body = TestGeomGenerator.CreateBox().Body; var chamfer = Chamfer.Create(body, new[] { body.Shape.GetSubshapeReference(SubshapeType.Edge, edgeToChamfer) }); chamfer.Distance = 5.0; var imprint = Imprint.Create(body, body.Shape.GetSubshapeReference(SubshapeType.Face, faceToImprint)); var center = imprint.Sketch.AddPoint(new Pnt2d(0, 0)); var rim = imprint.Sketch.AddPoint(new Pnt2d(0, 2)); imprint.Sketch.AddSegment(new SketchSegmentCircle(center, rim)); imprint.Mode = mode; Assert.IsTrue(imprint.Make(Shape.MakeFlags.None)); Assert.IsTrue(ModelCompare.CompareShape(body.Shape, Path.Combine(_BasePath, $"ChamferFaces_{edgeToChamfer}_{mode}"))); }
public async Task <IActionResult> SaveImprintData(Imprint imprint) { var imprints = new Imprint { ContriutorId = imprint.ContriutorId, EditorId = imprint.EditorId, // ImprintId = 3, ISBN = _authRepository.GenerateIsbn(imprint.ISBN), Type = imprint.Type }; await _context.Imprint.AddAsync(imprints); await _context.SaveChangesAsync(); var response = await _context.Imprint.ToListAsync(); return(Ok(response)); }
//-------------------------------------------------------------------------------------------------- public static Imprint CreateImprint(SketchType sketchType = SketchType.Circle) { var baseShape = new Box { DimensionX = 20, DimensionY = 20, DimensionZ = 5, }; var body = CreateBody(baseShape, new Pnt(-10, -10, 0)); var imprint = Imprint.Create(body, baseShape.GetSubshapeReference(SubshapeType.Face, 5)); var sketch = imprint.Operands[1] as Sketch; Assert.IsNotNull(sketch); FillSketch(sketch, sketchType); return(imprint); }
public static Grammar[] GetAllGrammars_v2() { ArrayList grammars = new ArrayList(); using (OleDbConnection connection = new OleDbConnection(connectionString)) { connection.Open(); OleDbCommand storedProcedure = new OleDbCommand("GetAllGrammars_incomplete", connection); storedProcedure.CommandType = CommandType.StoredProcedure; OleDbDataReader reader = storedProcedure.ExecuteReader(); while (reader.Read()) { //Tengo que crear un autor y un libro de gramatica para irlos rellenando poco a poco. Author grammarAuthor = new Author(); /** * En el caso del autor rellenamos todos los campos menos: * - city_name -> Se puede rellenar luego teniendo la lista con las ciudades * - county_name -> Se puede rellenar luego teniendo la lista con las provincias * - country_name -> Se puede rellenar luego teniendo la lista con los paises * * - occupations -> Se puede rellenar luego teniendo una lista con todos los oficios de los autores * */ grammarAuthor.Author_id = Convert.ToInt32(reader["authors.Author_Id"]); grammarAuthor.Name = reader["author_name"].ToString(); grammarAuthor.Gender = reader["authors.gender_info"].ToString(); grammarAuthor.Country_id = Convert.ToInt32(reader["authors.country_id"]); grammarAuthor.County_id = Convert.ToInt32(reader["authors.county_id"]); grammarAuthor.City_id = Convert.ToInt32(reader["authors.city_id"]); grammarAuthor.Biographical_details = reader["bio"].ToString(); Grammar grammar = new Grammar(); /** * En el caso del libro de gramática rellenamos todos los campos menos: * # GrammarImprint * - city_name -> Se puede rellenar luego teniendo la lista con las ciudades * - county_name -> Se puede rellenar luego teniendo la lista con las provincias * - country_name -> Se puede rellenar luego teniendo la lista con los paises * * - GrammarReferences -> Se puede rellenar luego teniendo una lista con todas las referencias de los libros * - GrammarLibraries -> Se puede rellenar luego teniendo una lista con las bibliotecas que tienen los libros * - GrammarSubsidiaryContents -> Se puede rellenar luego teniendo una lista con los contenidos que tienen los libros * * */ grammar.GrammarId = Convert.ToInt32(reader["Grammar"]); grammar.GrammarPublicationYear = reader["YearP"].ToString(); grammar.GrammarTitle = reader["Title"].ToString(); grammar.GrammarAuthor = grammarAuthor; grammar.GrammarFirstEdition = Convert.ToInt32(reader["Edition"]); Imprint grammarImprint = new Imprint(); grammarImprint.Grammar_id = grammar.GrammarId; grammarImprint.Country_id = Convert.ToInt32(reader["Grammars.country_id"]); grammarImprint.County_id = Convert.ToInt32(reader["Grammars.county_id"]); grammarImprint.City_id = Convert.ToInt32(reader["Grammars.city_id"]); grammarImprint.Printers = reader["Printers"].ToString(); grammarImprint.Booksellers = reader["BookSellers"].ToString(); grammarImprint.Price = reader["Price"].ToString(); grammarImprint.Description = reader["Physical_Description"].ToString(); grammar.GrammarImprint = grammarImprint; TypeOfWork grammarToW = new TypeOfWork(); grammarToW.Code = reader["Grammars.Type_Work"].ToString(); grammarToW.Type_description = reader["Description"].ToString(); grammar.GrammarTypeOfWork = grammarToW; GrammarDivision grammarDivision = new GrammarDivision(); grammarDivision.Category_id = Convert.ToInt32(reader["Group"]); grammarDivision.Category_name = reader["Division"].ToString(); grammar.GrammarDivision = grammarDivision; TargetAudience grammarAgeAudience = new TargetAudience(); grammarAgeAudience.AudienceCriteria = Convert.ToInt32(reader["age_id"]); grammarAgeAudience.AudienceName = reader["age_info"].ToString(); TargetAudience grammarGenderAudience = new TargetAudience(); grammarGenderAudience.AudienceCriteria = Convert.ToInt32(reader["gender_id"]); grammarGenderAudience.AudienceName = reader["audience_genders.gender_info"].ToString(); TargetAudience grammarInstructionAudience = new TargetAudience(); grammarInstructionAudience.AudienceCriteria = Convert.ToInt32(reader["instruction_id"]); grammarInstructionAudience.AudienceName = reader["instruction_info"].ToString(); TargetAudience grammarPurposeAudience = new TargetAudience(); grammarPurposeAudience.AudienceCriteria = Convert.ToInt32(reader["purpose_id"]); grammarPurposeAudience.AudienceName = reader["purpose_info"].ToString(); grammar.GrammarTargetAge = grammarAgeAudience; grammar.GrammarTargetGender = grammarGenderAudience; grammar.GrammarTargetInstruction = grammarInstructionAudience; grammar.GrammarTargetSP = grammarPurposeAudience; grammar.GrammarCommments = reader["Comments"].ToString(); grammars.Add(grammar); } } return((Grammar[])grammars.ToArray(typeof(Grammar))); }
//-------------------------------------------------------------------------------------------------- void _OnActionFinished(ToolAction toolAction) { bool finished = false; var selectAction = toolAction as SelectSubshapeAction; Debug.Assert(selectAction != null); if (selectAction.SelectedSubshapeType == SubshapeTypes.Face) { var face = TopoDS.Face(selectAction.SelectedSubshape); var brepAdaptor = new BRepAdaptor_Surface(face, true); if (brepAdaptor.GetGeomType() != GeomAbs_SurfaceType.GeomAbs_Plane) { StatusText = "Selected face is not a plane type surface."; } else { selectAction.Stop(); Stop(); finished = true; var faceRef = _TargetShape.GetSubshapeReference(_TargetBrep, face); if (faceRef == null) { Messages.Error("A subshape reference could not be produced for this face."); return; } if (_Mode == ToolMode.CreateNew) { // Create new var sketch = new Sketch { Body = _TargetBody, }; var imprint = Imprint.Create(_TargetBody, faceRef, sketch); if (imprint != null) { imprint.Mode = _ImprintMode; InteractiveContext.Current.UndoHandler.Commit(); InteractiveContext.Current.WorkspaceController.Selection.SelectEntity(_TargetBody); WorkspaceController.StartTool(new SketchEditorTool(sketch)); } } else if (_Mode == ToolMode.ReselectFace) { // Reselected face _ImprintToChange.Face = faceRef; _ImprintToChange.Invalidate(); InteractiveContext.Current.UndoHandler.Commit(); } } } if (!finished) { selectAction.Reset(); } WorkspaceController.Invalidate(); }