public void DrawCylinder(Cylinder cyl) { System.Drawing.Graphics g = Graphics; // get points Point[] pt = TransformPoint(cyl.TopPoints); // bottom (draw only path) Brush brushSolid = new SolidBrush(cyl.ColorTop); g.FillPolygon(brushSolid, pt); Brush brushPath = new SolidBrush(cyl.ColorPath); Pen penPath = new Pen(brushPath); g.DrawPolygon(penPath, pt); }
public Pack(uint pickId, PackProperties packProperties, BoxPosition position) : base(pickId, packProperties, position) { _packProperties = packProperties; _arrangement = _packProperties.Arrangement; if (packProperties.Content is PackableBrick boxProperties) { _innerBox = new Box(0, boxProperties); } else if (packProperties.Content is CylinderProperties cylProp) { _innerBox = new Cylinder(0, cylProp); } else if (packProperties.Content is BottleProperties bottleProp) { _innerBox = new Bottle(0, bottleProp); } ForceTransparency = false; }
public override void Draw(Graphics3D graphics, Transform3D transform) { // clear list of picking box ClearPickingBoxes(); if (null == Solution) { return; } AnalysisHCyl analysis = Solution.AnalysisHCyl; if (analysis is AnalysisHCylPallet analysisHCylPallet) { Pallet pallet = new Pallet(analysisHCylPallet.PalletProperties); pallet.Draw(graphics, transform); } else if (analysis is AnalysisHCylTruck analysisHCylTruck) { Truck truck = new Truck(analysisHCylTruck.TruckProperties); truck.DrawBegin(graphics); } uint pickId = 0; // ### draw solution foreach (var cp in Solution.Layout.Positions) { //var cylPos = cp.Transform(Transform3D.Translation(analysis.Offset)); Cylinder c = new Cylinder( pickId++ , analysis.Content as CylinderProperties , cp.Transform(transform)); graphics.AddCylinder(c); } // ### dimensions if (graphics.ShowDimensions) { graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol1), Color.Black, false)); graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol2), Color.Red, true)); } // ### }
public void DrawCylinder(Cylinder cyl) { System.Drawing.Graphics g = Graphics; // get points Point[] ptOuter = TransformPoint(cyl.TopPoints); Point[] ptInner = TransformPoint(cyl.TopPointsInner); // top color Brush brushSolid = new SolidBrush(cyl.ColorTop); g.FillPolygon(brushSolid, ptOuter); // hole -> drawing polygon with background color Brush brushBackground = new SolidBrush(ColorBackground); g.FillPolygon(brushBackground, ptInner); // bottom (draw only path) Brush brushPath = new SolidBrush(cyl.ColorPath); Pen penPath = new Pen(brushPath); g.DrawPolygon(penPath, ptOuter); }
public void Draw(Graphics3D graphics, Packable packable, double height, bool selected, bool annotate) { graphics.BackgroundColor = selected ? Color.LightBlue : Color.White; graphics.CameraPosition = Graphics3D.Corner_0; // draw layer (brick) if (_layer is Layer2D) { Layer2D layer2D = _layer as Layer2D; uint pickId = 0; foreach (LayerPosition bPosition in layer2D) { if (packable is PackProperties) { graphics.AddBox(new Pack(pickId++, packable as PackProperties, bPosition)); } else if (packable is PackableBrick) { graphics.AddBox(new Box(pickId++, packable as PackableBrick, bPosition)); } } } // draw layer (cylinder) else if (_layer is Layer2DCyl) { Layer2DCyl layer2DCyl = _layer as Layer2DCyl; uint pickId = 0; foreach (Vector2D pos in layer2DCyl) { Cylinder c = new Cylinder(pickId++, packable as CylinderProperties, new CylPosition(new Vector3D(pos.X, pos.Y, 0.0), HalfAxis.HAxis.AXIS_Z_P)); graphics.AddCylinder(c); } } graphics.Flush(); // annotate thumbnail if (annotate) { Annotate(graphics.Graphics, graphics.Size, height); } }
/// <summary> /// Draw all entities stored in buffer /// </summary> public void Flush() { // initialize Vector3D vLight = CameraPosition - Target; vLight.Normalize(); _boxDrawingCounter = 0; CurrentTransf = null; System.Drawing.Graphics g = Graphics; g.Clear(BackgroundColor); if (EnableFaceSorting) { // sort face list FaceComparison faceComparer = new FaceComparison(GetWorldToEyeTransformation()); Faces.Sort(faceComparer); } // draw background segments foreach (Segment s in SegmentsBackground) { Draw(s); } // draw background faces foreach (Face face in _facesBackground) { Draw(face, FaceDir.FRONT); } // draw all faces using solid / transparency foreach (Face face in Faces) { Draw(face, FaceDir.BACK); } // draw triangles foreach (Triangle tr in Triangles) { Draw(tr, FaceDir.FRONT); } // sort box list if (UseBoxelOrderer) { BoxelOrderer boxelOrderer = new BoxelOrderer(Boxes) { Direction = Target - CameraPosition }; Boxes = boxelOrderer.GetSortedList(); } else { Boxes.Sort(new BoxComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); } // sort cylinder list Cylinders.Sort(new CylinderComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); if (Cylinders.Count > 0) { // sort by Z List <Drawable> drawableList = new List <Drawable>(); drawableList.AddRange(Boxes); drawableList.AddRange(Cylinders); drawableList.Sort(new DrawableComparerSimplifiedPainterAlgo()); List <Box> boxes = new List <Box>(); List <Cylinder> cylinders = new List <Cylinder>(); bool processingBox = drawableList[0] is Box; foreach (Drawable drawable in drawableList) { Box b = drawable as Box; Cylinder c = drawable as Cylinder; if ((null != b) && processingBox) { boxes.Add(b); } else if ((null == b) && !processingBox) { cylinders.Add(c); } else { if (boxes.Count > 0) { BoxelOrderer boxelOrderer = new BoxelOrderer(boxes) { Direction = Target - CameraPosition }; boxes = boxelOrderer.GetSortedList(); // draw boxes foreach (Box bb in boxes) { Draw(bb); } // clear boxes.Clear(); } if (cylinders.Count > 0) { cylinders.Sort(new CylinderComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); // draw cylinders foreach (Cylinder cc in cylinders) { Draw(cc); } // clear cylinders.Clear(); } if (null != b) { boxes.Add(b); processingBox = true; } else { cylinders.Add(c); processingBox = false; } } } // remaining boxes BoxelOrderer boxelOrdererRem = new BoxelOrderer(boxes) { Direction = Target - CameraPosition }; boxes = boxelOrdererRem.GetSortedList(); // draw boxes foreach (Box bb in boxes) { Draw(bb); } // remaining cylinders cylinders.Sort(new CylinderComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); // draw cylinders foreach (Cylinder cc in cylinders) { Draw(cc); } // clear boxes.Clear(); } else { // draw all boxes foreach (Box box in Boxes) { Draw(box); } // draw all triangles foreach (Triangle tr in Triangles) { Draw(tr, FaceDir.FRONT); } } // images inst if (_listImageInst.Count > 0) { // --- sort image inst AnalysisHomo analysis = _listImageInst[0].Analysis; BBox3D bbox = analysis.Solution.BBoxGlobal; List <Box> boxesImage = new List <Box>(); foreach (ImageInst imageInst in _listImageInst) { boxesImage.Add(imageInst.ToBox()); } if (UseBoxelOrderer && false) // NOT WORKING ? { BoxelOrderer boxelOrderer = new BoxelOrderer(boxesImage) { TuneParam = 10.0, Direction = Target - CameraPosition }; boxesImage = boxelOrderer.GetSortedList(); } else { boxesImage.Sort(new BoxComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); } // --- List <ImageInst> listImageInstSorted = new List <ImageInst>(); foreach (Box b in boxesImage) { listImageInstSorted.Add(new ImageInst(analysis, new Vector3D(b.Length, b.Width, b.Height), b.BPosition)); } // draw image inst foreach (ImageInst im in listImageInstSorted) { Draw(im); } } // draw faces : end foreach (Face face in Faces) { Draw(face, FaceDir.FRONT); } // draw segment list (e.g. hatching) foreach (Segment seg in Segments) { Draw(seg); } // draw cotation cubes if (ShowDimensions) { foreach (DimensionCube qc in _dimensions) { qc.Draw(this); } } }
public void AddCylinder(Cylinder cylinder) { Cylinders.Add(cylinder); }
internal void Draw(Cylinder cyl) { System.Drawing.Graphics g = Graphics; // build pen path Brush brushPath = new SolidBrush(cyl.ColorPath); Pen penPathThick = new Pen(brushPath, 1.7f); Pen penPathThin = new Pen(brushPath, 1.5f); // bottom (draw only path) Point[] ptsBottom = TransformPoint(GetCurrentTransformation(), cyl.BottomPoints); g.DrawPolygon(penPathThick, ptsBottom); // top Point[] ptsTop = TransformPoint(GetCurrentTransformation(), cyl.TopPoints); g.DrawPolygon(penPathThick, ptsTop); // outer wall Face[] facesWalls = cyl.FacesWalls; foreach (Face face in facesWalls) { try { Vector3D normal = face.Normal; // visible ? if (!face.IsVisible(Target - CameraPosition)) { continue; } // color double cosA = System.Math.Abs(Vector3D.DotProduct(face.Normal, VLight)); if (cosA < 0 || cosA > 1) { cosA = 1.0; } Color color = Color.FromArgb((int)(face.ColorFill.R * cosA), (int)(face.ColorFill.G * cosA), (int)(face.ColorFill.B * cosA)); // brush Brush brush = new SolidBrush(color); // draw polygon Point[] ptsFace = TransformPoint(GetCurrentTransformation(), face.Points); g.FillPolygon(brush, ptsFace); } catch (Exception ex) { _log.Error(ex.ToString()); } } // top double cosTop = System.Math.Abs(Vector3D.DotProduct(HalfAxis.ToVector3D(cyl.Position.Direction), VLight)); Color colorTop = Color.FromArgb((int)(cyl.ColorTop.R * cosTop), (int)(cyl.ColorTop.G * cosTop), (int)(cyl.ColorTop.B * cosTop)); Brush brushTop = new SolidBrush(colorTop); bool topVisible = Vector3D.DotProduct(HalfAxis.ToVector3D(cyl.Position.Direction), Target - CameraPosition) < 0; if (cyl.DiameterInner > 0) { Face[] facesTop = cyl.FacesTop; foreach (Face face in facesTop) { try { Vector3D normal = face.Normal; // visible ? if (!face.IsVisible(Target - CameraPosition)) { continue; } // color // draw polygon Point[] ptsFace = TransformPoint(GetCurrentTransformation(), face.Points); g.FillPolygon(brushTop, ptsFace); } catch (Exception ex) { _log.Error(ex.ToString()); } } } else { if (topVisible) { g.FillPolygon(brushTop, ptsTop); } else { g.FillPolygon(brushTop, ptsBottom); } } if (topVisible) { g.DrawPolygon(penPathThin, ptsTop); } else { g.DrawPolygon(penPathThin, ptsBottom); } ++_boxDrawingCounter; }
public override void Draw(Graphics3D graphics, Transform3D transform) { // clear list of picking box ClearPickingBoxes(); if (null == _solution) { return; } AnalysisHomo analysis = _solution.Analysis; if (analysis is AnalysisPackablePallet analysisPackablePallet) { // ### draw pallet Pallet pallet = new Pallet(analysisPackablePallet.PalletProperties); pallet.Draw(graphics, transform); } else if (analysis is AnalysisPackableCase analysisPackableCase) { // ### draw case (inside) Case case_ = new Case(analysisPackableCase.CaseProperties); case_.DrawInside(graphics, transform); } else if (analysis is AnalysisPackableTruck analysisPackableTruck) { // ### draw truck Truck truck = new Truck(analysisPackableTruck.TruckProperties); truck.DrawBegin(graphics); } else if (analysis is AnalysisPalletTruck analysisPalletTruck) { // ### draw truck Truck truck = new Truck(analysisPalletTruck.TruckProperties); truck.DrawBegin(graphics); } // ### draw solution uint layerId = 0, pickId = 0; List <ILayer> layers = _solution.Layers; foreach (ILayer layer in layers) { BBox3D bbox = new BBox3D(); // ### layer of boxes Layer3DBox layerBox = layer as Layer3DBox; if (null != layerBox) { if (analysis.Content is LoadedPallet) { LoadedPallet loadedPallet = analysis.Content as LoadedPallet; BBox3D solBBox = loadedPallet.ParentAnalysis.Solution.BBoxGlobal; foreach (BoxPosition bPosition in layerBox) { bool simplified = false; if (simplified) { BoxProperties bProperties = new BoxProperties(null, solBBox.Dimensions); bProperties.SetColor(Color.Chocolate); Box b = new Box(pickId++, bProperties, bPosition.Transform(transform)); graphics.AddBox(b); bbox.Extend(b.BBox); } else { graphics.AddImage(loadedPallet.ParentAnalysis, solBBox.DimensionsVec, bPosition.Transform(transform)); } } } else { bool aboveSelectedLayer = (_solution.SelectedLayerIndex != -1) && (layerId > _solution.SelectedLayerIndex); Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, aboveSelectedLayer ? DistanceAboveSelectedLayer : 0.0)); foreach (BoxPosition bPosition in layerBox) { BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation); Box b = null; if (analysis.Content is PackProperties) { b = new Pack(pickId++, analysis.Content as PackProperties, boxPositionModified); } else { b = new Box(pickId++, analysis.Content as PackableBrick, boxPositionModified); } graphics.AddBox(b); bbox.Extend(b.BBox); } } } Layer3DCyl layerCyl = layer as Layer3DCyl; if (null != layerCyl) { foreach (Vector3D vPos in layerCyl) { Cylinder c = new Cylinder(pickId++, analysis.Content as CylinderProperties, new CylPosition(transform.transform(vPos), HalfAxis.HAxis.AXIS_Z_P)); graphics.AddCylinder(c); bbox.Extend(c.BBox); } } if (null != layerBox || null != layerCyl) { // add layer BBox AddPickingBox(bbox, layerId); // draw bounding box around selected layer if (layerId == _solution.SelectedLayerIndex) { DrawLayerBoundingBox(graphics, bbox); } ++layerId; } // ### interlayer if (layer is InterlayerPos interlayerPos) { InterlayerProperties interlayerProp = _solution.Interlayers[interlayerPos.TypeId]; if (null != interlayerProp) { bool aboveSelectedLayer = (_solution.SelectedLayerIndex != -1) && (layerId > _solution.SelectedLayerIndex); Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, aboveSelectedLayer ? DistanceAboveSelectedLayer : 0.0)); BoxPosition bPosition = new BoxPosition( new Vector3D( analysis.Offset.X + 0.5 * (analysis.ContainerDimensions.X - interlayerProp.Length) , analysis.Offset.Y + 0.5 * (analysis.ContainerDimensions.Y - interlayerProp.Width) , interlayerPos.ZLow ), HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P); Box box = new Box(pickId++, interlayerProp, bPosition.Transform(transform * upTranslation)); graphics.AddBox(box); bbox.Extend(box.BBox); } } } BBox3D loadBBox = _solution.BBoxLoad; BBox3D loadBBoxWDeco = _solution.BBoxLoadWDeco; if (analysis is AnalysisCasePallet analysisCasePallet) { #region Pallet corners // ### pallet corners : Begin Corner[] corners = new Corner[4]; if (analysisCasePallet.HasPalletCorners) { // positions Vector3D[] cornerPositions = { loadBBox.PtMin , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z) , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z) , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z) }; // length axes HalfAxis.HAxis[] lAxes = { HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N }; // width axes HalfAxis.HAxis[] wAxes = { HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_X_P }; // corners if (analysisCasePallet.HasPalletCorners) { for (int i = 0; i < 4; ++i) { corners[i] = new Corner(0, analysisCasePallet.PalletCornerProperties) { Height = Math.Min(analysisCasePallet.PalletCornerProperties.Length, loadBBox.Height) }; corners[i].SetPosition( transform.transform(cornerPositions[i]) , HalfAxis.Transform(lAxes[i], transform), HalfAxis.Transform(wAxes[i], transform) ); corners[i].DrawBegin(graphics); } } } #endregion #region Pallet film // ### pallet film Film film = null; if (analysisCasePallet.HasPalletFilm && -1 == _solution.SelectedLayerIndex) { // instantiate film PalletFilmProperties palletFilmProperties = analysisCasePallet.PalletFilmProperties; film = new Film( palletFilmProperties.Color, palletFilmProperties.UseTransparency, palletFilmProperties.UseHatching, palletFilmProperties.HatchSpacing, palletFilmProperties.HatchAngle); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform) , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0)); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform) , new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0)); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_N, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform) , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0)); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_N, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform) , new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0)); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform) , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width) , UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1))); film.DrawBegin(graphics); } #endregion #region Pallet corners // pallet corners : End if (analysisCasePallet.HasPalletCorners) { for (int i = 0; i < 4; ++i) { corners[i].DrawEnd(graphics); } } #endregion #region Pallet Cap // ### pallet cap if (analysisCasePallet.HasPalletCap) { PalletCapProperties capProperties = analysisCasePallet.PalletCapProperties; BoxPosition bPosition = new BoxPosition(new Vector3D( 0.5 * (analysisCasePallet.PalletProperties.Length - capProperties.Length), 0.5 * (analysisCasePallet.PalletProperties.Width - capProperties.Width), loadBBox.PtMax.Z - capProperties.InsideHeight) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform) ); Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, -1 != _solution.SelectedLayerIndex ? DistanceAboveSelectedLayer : 0.0)); PalletCap cap = new PalletCap(0, capProperties, bPosition.Transform(upTranslation)); cap.DrawEnd(graphics); } #endregion #region Pallet film // pallet film : End if (analysisCasePallet.HasPalletFilm && null != film) { film.DrawEnd(graphics); } #endregion } else if (analysis is AnalysisPackableTruck analysisPackableTruck2) { Truck truck = new Truck(analysisPackableTruck2.TruckProperties); truck.DrawEnd(graphics); } else if (analysis is AnalysisPalletTruck analysisPalletTruck) { Truck truck = new Truck(analysisPalletTruck.TruckProperties); truck.DrawEnd(graphics); } // ### dimensions // dimensions should only be shown when no layer is selected if (graphics.ShowDimensions && (-1 == _solution.SelectedLayerIndex)) { graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol1), Color.Black, false)); graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol2), Color.Red, true)); } // ### }
/// <summary> /// Draw all entities stored in buffer /// </summary> public void Flush() { // initialize Vector3D vLight = _vCameraPos - _vTarget; vLight.Normalize(); _boxDrawingCounter = 0; _currentTransf = null; System.Drawing.Graphics g = Graphics; g.Clear(_backgroundColor); if (EnableFaceSorting) { // sort face list FaceComparison faceComparer = new FaceComparison(GetWorldToEyeTransformation()); _faces.Sort(faceComparer); } // draw background segments foreach (Segment s in _segmentsBackground) { Draw(s); } // draw background faces foreach (Face face in _facesBackground) { Draw(face, FaceDir.FRONT); } // draw all faces using solid / transparency depending on foreach (Face face in _faces) { Draw(face, FaceDir.BACK); } // sort box list if (_useBoxelOrderer) { BoxelOrderer boxelOrderer = new BoxelOrderer(_boxes); boxelOrderer.Direction = _vTarget - _vCameraPos; _boxes = boxelOrderer.GetSortedList(); } else { _boxes.Sort(new BoxComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); } // sort cylinder list _cylinders.Sort(new CylinderComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); if (_cylinders.Count > 0) { // sort by Z List <Drawable> drawableList = new List <Drawable>(); drawableList.AddRange(_boxes); drawableList.AddRange(_cylinders); drawableList.Sort(new DrawableComparerSimplifiedPainterAlgo()); List <Box> boxes = new List <Box>(); List <Cylinder> cylinders = new List <Cylinder>(); bool processingBox = drawableList[0] is Box; foreach (Drawable drawable in drawableList) { Box b = drawable as Box; Cylinder c = drawable as Cylinder; if ((null != b) && processingBox) { boxes.Add(b); } else if ((null == b) && !processingBox) { cylinders.Add(c); } else { if (boxes.Count > 0) { BoxelOrderer boxelOrderer = new BoxelOrderer(boxes); boxelOrderer.Direction = _vTarget - _vCameraPos; boxes = boxelOrderer.GetSortedList(); // draw boxes foreach (Box bb in boxes) { Draw(bb); } // clear boxes.Clear(); } if (cylinders.Count > 0) { cylinders.Sort(new CylinderComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); // draw cylinders foreach (Cylinder cc in cylinders) { Draw(cc); } // clear cylinders.Clear(); } if (null != b) { boxes.Add(b); processingBox = true; } else { cylinders.Add(c); processingBox = false; } } } // remaining boxes BoxelOrderer boxelOrdererRem = new BoxelOrderer(boxes); boxelOrdererRem.Direction = _vTarget - _vCameraPos; boxes = boxelOrdererRem.GetSortedList(); // draw boxes foreach (Box bb in boxes) { Draw(bb); } // remaining cylinders cylinders.Sort(new CylinderComparerSimplifiedPainterAlgo(GetWorldToEyeTransformation())); // draw cylinders foreach (Cylinder cc in cylinders) { Draw(cc); } // clear boxes.Clear(); } else { // draw all boxes foreach (Box box in _boxes) { Draw(box); } } // images inst if (_listImageInst.Count > 0) { // sort image inst _listImageInst.Sort(new ImageInstComparerSimplifierPainterAlgo(GetWorldToEyeTransformation())); // draw image inst foreach (ImageInst im in _listImageInst) { Draw(im); } } // draw faces : end foreach (Face face in _faces) { Draw(face, FaceDir.FRONT); } // draw segment list (e.g. hatching) foreach (Segment seg in _segments) { Draw(seg); } // draw cotation cubes foreach (DimensionCube qc in _dimensions) { qc.Draw(this); } }
public override void Draw(Graphics3D graphics, Transform3D transform) { // clear list of picking box ClearPickingBoxes(); if (null == Solution) { return; } AnalysisHomo analysis = Solution.Analysis; if (analysis is AnalysisPackablePallet analysisPackablePallet) { // ### draw pallet Pallet pallet = new Pallet(analysisPackablePallet.PalletProperties); pallet.Draw(graphics, transform); if (analysis is AnalysisCasePallet && -1 == Solution.SelectedLayerIndex) { // ### strappers SolutionLayered sol = Solution; foreach (var sd in sol.Strappers) { if (null != sd.Points && sd.Points.Count > 0) { Strapper s = new Strapper( transform.transform(IntToAxis(sd.Strapper.Axis)), sd.Strapper.Width, sd.Strapper.Color, sd.Points.ConvertAll(p => transform.transform(p)).ToList()); s.DrawBegin(graphics); } } } } else if (analysis is AnalysisPackableCase analysisPackableCase) { // ### draw case (inside) Case case_ = new Case(analysisPackableCase.CaseProperties); case_.DrawInside(graphics, transform); } else if (analysis is AnalysisPackableTruck analysisPackableTruck) { // ### draw truck Truck truck = new Truck(analysisPackableTruck.TruckProperties); truck.DrawBegin(graphics); } else if (analysis is AnalysisPalletTruck analysisPalletTruck) { // ### draw truck Truck truck = new Truck(analysisPalletTruck.TruckProperties); truck.DrawBegin(graphics); } // ### draw solution uint layerId = 0, pickId = 0; List <ILayer> layers = Solution.Layers; foreach (ILayer layer in layers) { bool aboveSelectedLayer = (Solution.SelectedLayerIndex != -1) && (layerId > Solution.SelectedLayerIndex); Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, aboveSelectedLayer ? DistanceAboveSelectedLayer : 0.0)); BBox3D bbox = new BBox3D(); // ### layer of boxes if (layer is Layer3DBox layerBox) { if (analysis.Content is LoadedPallet) { LoadedPallet loadedPallet = analysis.Content as LoadedPallet; BBox3D solBBox = loadedPallet.ParentAnalysis.Solution.BBoxGlobal; foreach (BoxPosition bPosition in layerBox) { var dim = solBBox.DimensionsVec; graphics.AddImage(++pickId, new SubContent(loadedPallet.ParentAnalysis as AnalysisHomo), solBBox.DimensionsVec, bPosition.Transform(transform)); // bbox used for picking bbox.Extend(new BBox3D(bPosition.Transform(transform), solBBox.DimensionsVec)); } } else if (analysis.Content is PackProperties packProperties) { foreach (BoxPosition bPosition in layerBox) { BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation); graphics.AddImage(++pickId, new SubContent(packProperties), packProperties.OuterDimensions, boxPositionModified); // bbox used for picking bbox.Extend(new BBox3D(boxPositionModified, packProperties.OuterDimensions)); } } else if (analysis.Content is BagProperties bagProperties) { foreach (BoxPosition bPosition in layerBox) { BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation); graphics.AddImage(++pickId, new SubContent(bagProperties), bagProperties.OuterDimensions, boxPositionModified); // bbox used for picking bbox.Extend(new BBox3D(boxPositionModified, bagProperties.OuterDimensions)); } } else { foreach (BoxPosition bPosition in layerBox) { BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation); BoxGeneric b; if (analysis.Content is BagProperties bagProp) { b = new BoxRounded(pickId++, bagProp.Length, bagProp.Width, bagProp.Height, bagProp.Radius, boxPositionModified) { ColorFill = bagProp.ColorFill } } ; else { b = new Box(pickId++, analysis.Content as PackableBrick, boxPositionModified); } graphics.AddBox(b); bbox.Extend(b.BBox); } } } else if (layer is Layer3DBoxIndexed layerBoxIndexed) { foreach (var bpi in layerBoxIndexed) { BoxPosition boxPositionModified = bpi.BPos.Transform(transform * upTranslation); var bProperties = analysis.Content as PackableBrick; BoxGeneric b = new Box(pickId++, analysis.Content as PackableBrick, boxPositionModified); graphics.AddBox(b); // bbox used for picking bbox.Extend(new BBox3D(boxPositionModified, bProperties.OuterDimensions)); } } else if (layer is Layer3DCyl layerCyl) { foreach (Vector3D vPos in layerCyl) { CylPosition cylPosition = new CylPosition(transform.transform(vPos), HalfAxis.HAxis.AXIS_Z_P); CylPosition cylPositionModified = cylPosition.Transform(transform * upTranslation); Cyl cyl = null; if (analysis.Content is CylinderProperties cylProp) { cyl = new Cylinder(pickId++, cylProp, cylPositionModified); } else if (analysis.Content is BottleProperties bottleProperties) { cyl = new Bottle(pickId++, bottleProperties, cylPositionModified); } graphics.AddCylinder(cyl); bbox.Extend(cyl.BBox); } } // ### interlayer else if (layer is InterlayerPos interlayerPos) { InterlayerProperties interlayerProp = Solution.Interlayers[interlayerPos.TypeId]; if (null != interlayerProp) { BoxPosition bPosition = new BoxPosition( new Vector3D( analysis.Offset.X + 0.5 * (analysis.ContainerDimensions.X - interlayerProp.Length) , analysis.Offset.Y + 0.5 * (analysis.ContainerDimensions.Y - interlayerProp.Width) , interlayerPos.ZLow ), HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P); BoxPosition boxPositionModified = bPosition.Transform(transform * upTranslation); Box box = new Box(pickId++, interlayerProp, boxPositionModified); if (analysis.Content is PackProperties) { graphics.AddImage(pickId, new SubContent(interlayerProp), interlayerProp.Dimensions, boxPositionModified); } else { graphics.AddBox(box); } bbox.Extend(box.BBox); } } if (layer is Layer3DBox || layer is Layer3DCyl) { // add layer BBox AddPickingBox(bbox, layerId); // draw bounding box around selected layer if (layerId == Solution.SelectedLayerIndex) { DrawLayerBoundingBox(graphics, bbox); } ++layerId; } } BBox3D loadBBox = Solution.BBoxLoad; BBox3D loadBBoxWDeco = Solution.BBoxLoadWDeco; if (analysis is AnalysisCasePallet analysisCasePallet) { #region Pallet corners // ### pallet corners : Begin Corner[] corners = new Corner[4]; if (analysisCasePallet.HasPalletCorners) { // positions Vector3D[] cornerPositions = { loadBBox.PtMin , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z) , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z) , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z) }; // length axes HalfAxis.HAxis[] lAxes = { HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N }; // width axes HalfAxis.HAxis[] wAxes = { HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_X_P }; for (int i = 0; i < 4; ++i) { corners[i] = new Corner(0, analysisCasePallet.PalletCornerProperties) { Height = Math.Min(analysisCasePallet.PalletCornerProperties.Length, loadBBox.Height) }; corners[i].SetPosition( transform.transform(cornerPositions[i]) , HalfAxis.Transform(lAxes[i], transform), HalfAxis.Transform(wAxes[i], transform) ); corners[i].DrawBegin(graphics); } } #endregion #region Top corners Corner[] cornersTop = new Corner[4]; if (analysisCasePallet.HasPalletCornersTopX || analysisCasePallet.HasPalletCornersTopY) { double cornerWidth = analysisCasePallet.PalletCornerTopProperties.Width; double lengthInLDir = Math.Min(analysisCasePallet.PalletCornerTopProperties.Length, loadBBox.Length - 2.0 * cornerWidth); double widthInWDir = Math.Min(analysisCasePallet.PalletCornerTopProperties.Length, loadBBox.Width - 2.0 * cornerWidth); double offsetInLDir = 0.5 * (loadBBox.Length - lengthInLDir); double offsetInWdir = 0.5 * (loadBBox.Width - widthInWDir); Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, -1 != Solution.SelectedLayerIndex ? DistanceAboveSelectedLayer : 0.0)); // positions Vector3D[] cornerPositions = { new Vector3D(loadBBox.PtMin.X + offsetInLDir, loadBBox.PtMin.Y, loadBBox.PtMax.Z) , new Vector3D(loadBBox.PtMax.X - offsetInLDir, loadBBox.PtMax.Y, loadBBox.PtMax.Z) , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y + offsetInWdir, loadBBox.PtMax.Z) , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y - offsetInWdir, loadBBox.PtMax.Z) }; // length axes HalfAxis.HAxis[] lAxes = { HalfAxis.HAxis.AXIS_Z_N, HalfAxis.HAxis.AXIS_Z_N, HalfAxis.HAxis.AXIS_Z_N, HalfAxis.HAxis.AXIS_Z_N, }; // width axes HalfAxis.HAxis[] wAxes = { HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_X_P }; for (int i = 0; i < 4; ++i) { cornersTop[i] = new Corner(0, analysisCasePallet.PalletCornerTopProperties) { Height = Math.Min(analysisCasePallet.PalletCornerTopProperties.Length, (i < 2 ? loadBBox.Length : loadBBox.Width) - 2.0 * cornerWidth) }; cornersTop[i].SetPosition( transform.transform(upTranslation.transform(cornerPositions[i])) , HalfAxis.Transform(lAxes[i], transform), HalfAxis.Transform(wAxes[i], transform) ); } // drawing if (analysisCasePallet.HasPalletCornersTopX) { for (int i = 0; i < 2; ++i) { cornersTop[i].DrawBegin(graphics); } } if (analysisCasePallet.HasPalletCornersTopY) { for (int i = 2; i < 4; ++i) { cornersTop[i].DrawBegin(graphics); } } } #endregion #region Pallet film // ### pallet film Film film = null; if (analysisCasePallet.HasPalletFilm && -1 == Solution.SelectedLayerIndex) { // instantiate film PalletFilmProperties palletFilmProperties = analysisCasePallet.PalletFilmProperties; film = new Film( palletFilmProperties.Color, palletFilmProperties.UseTransparency, palletFilmProperties.UseHatching, palletFilmProperties.HatchSpacing, palletFilmProperties.HatchAngle); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform) , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), -1.0)); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform) , new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), -1.0)); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_N, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform) , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), -1.0)); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_N, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Z_P, transform) , new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), -1.0)); film.AddRectangle(new FilmRectangle(transform.transform(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform), HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform) , new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width) , analysisCasePallet.PalletFilmTopCovering)); film.DrawBegin(graphics); } #endregion #region Pallet corners // pallet corners : End if (analysisCasePallet.HasPalletCorners) { for (int i = 0; i < 4; ++i) { corners[i].DrawEnd(graphics); } } if (analysisCasePallet.HasPalletCornersTopX) { for (int i = 0; i < 2; ++i) { cornersTop[i].DrawEnd(graphics); } } if (analysisCasePallet.HasPalletCornersTopY) { for (int i = 2; i < 4; ++i) { cornersTop[i].DrawEnd(graphics); } } #endregion #region Pallet sleeves // ### pallet sleeve if (analysisCasePallet.HasPalletSleeve) { var ps = new PalletSleeve(0, loadBBox, analysisCasePallet.PalletSleeveColor); ps.DrawEnd(graphics); } #endregion #region Pallet Cap // ### pallet cap if (analysisCasePallet.HasPalletCap) { PalletCapProperties capProperties = analysisCasePallet.PalletCapProperties; BoxPosition bPosition = new BoxPosition(new Vector3D( 0.5 * (analysisCasePallet.PalletProperties.Length - capProperties.Length), 0.5 * (analysisCasePallet.PalletProperties.Width - capProperties.Width), loadBBox.PtMax.Z - capProperties.InsideHeight) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_X_P, transform) , HalfAxis.Transform(HalfAxis.HAxis.AXIS_Y_P, transform) ); Transform3D upTranslation = Transform3D.Translation(new Vector3D(0.0, 0.0, -1 != Solution.SelectedLayerIndex ? DistanceAboveSelectedLayer : 0.0)); PalletCap cap = new PalletCap(0, capProperties, bPosition.Transform(upTranslation)); cap.DrawEnd(graphics); } #endregion #region Pallet labels // ### pallet labels if (null != analysisCasePallet) { foreach (var pli in analysisCasePallet.PalletLabels) { var pl = new PalletLabel(++pickId, pli.PalletLabelProperties, pli.ToBoxPosition(loadBBox)); pl.DrawEnd(graphics); } } #endregion #region Strappers // ### strappers if (-1 == Solution.SelectedLayerIndex) { foreach (var sd in Solution.Strappers) { if (null == sd.Points && sd.Points.Count > 0) { var strapper = new Strapper( transform.transform(IntToAxis(sd.Strapper.Axis)), sd.Strapper.Width, sd.Strapper.Color, sd.Points.Select(p => transform.transform(p)).ToList()); strapper.DrawEnd(graphics); } } } #endregion #region Pallet film // pallet film : End if (analysisCasePallet.HasPalletFilm && null != film) { film.DrawEnd(graphics); } #endregion } else if (analysis is AnalysisPackableTruck analysisPackableTruck2) { Truck truck = new Truck(analysisPackableTruck2.TruckProperties); truck.DrawEnd(graphics); } else if (analysis is AnalysisPalletTruck analysisPalletTruck) { Truck truck = new Truck(analysisPalletTruck.TruckProperties); truck.DrawEnd(graphics); } // ### dimensions // dimensions should only be shown when no layer is selected if (graphics.ShowDimensions && (-1 == Solution.SelectedLayerIndex)) { graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol1), Color.Black, false)); graphics.AddDimensions(new DimensionCube(BoundingBoxDim(DimCasePalletSol2), Color.Red, true)); } // ### }
public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { if (null == _dt) return; DataCase dtCase = _dt as DataCase; if (null != dtCase) { Box b = new Box(0, ToCase(dtCase)); graphics.AddBox(b); graphics.AddDimensions(new DimensionCube(dtCase.OuterDimensions)); } DataBox dtBox = _dt as DataBox; if (null != dtBox) { Box b = new Box(0, ToBox(dtBox)); graphics.AddBox(b); graphics.AddDimensions(new DimensionCube(dtBox.Dimensions)); } DataPallet dtPallet = _dt as DataPallet; if (null != dtPallet) { Pallet pallet = new Pallet(ToPallet(dtPallet)); pallet.Draw(graphics, Sharp3D.Math.Core.Transform3D.Identity); graphics.AddDimensions(new DimensionCube(dtPallet.Dimensions)); } DataInterlayer dtInterlayer = _dt as DataInterlayer; if (null != dtInterlayer) { graphics.AddBox(new Box(0, ToInterlayer(dtInterlayer))); graphics.AddDimensions(new DimensionCube(dtInterlayer.Dimensions)); } DataPalletCap dtPalletCap = _dt as DataPalletCap; if (null != dtPalletCap) { PalletCap palletCap = new PalletCap(0, ToPalletCap(dtPalletCap), Sharp3D.Math.Core.Vector3D.Zero); palletCap.Draw(graphics); graphics.AddDimensions(new DimensionCube(dtPalletCap.Dimensions)); } DataCylinder dtCylinder = _dt as DataCylinder; if (null != dtCylinder) { Cylinder cyl = new Cylinder(0, ToCylinder(dtCylinder)); graphics.AddCylinder(cyl); } }
internal void Draw(Cylinder cyl) { System.Drawing.Graphics g = Graphics; // build pen path Brush brushPath = new SolidBrush(cyl.ColorPath); Pen penPathThick = new Pen(brushPath, 1.7f); Pen penPathThin = new Pen(brushPath, 1.5f); // bottom (draw only path) Point[] ptsBottom = TransformPoint(GetCurrentTransformation(), cyl.BottomPoints); g.DrawPolygon(penPathThick, ptsBottom); // top Point[] ptsTop = TransformPoint(GetCurrentTransformation(), cyl.TopPoints); g.DrawPolygon(penPathThick, ptsTop); // outer wall Face[] facesWalls = cyl.FacesWalls; foreach (Face face in facesWalls) { Vector3D normal = face.Normal; // visible ? if (!face.IsVisible(_vTarget - _vCameraPos)) continue; // color double cosA = System.Math.Abs(Vector3D.DotProduct(face.Normal, VLight)); if (cosA < 0 || cosA > 1) cosA = 1.0; Color color = Color.FromArgb((int)(face.ColorFill.R * cosA), (int)(face.ColorFill.G * cosA), (int)(face.ColorFill.B * cosA)); // brush Brush brush = new SolidBrush(color); // draw polygon Point[] ptsFace = TransformPoint(GetCurrentTransformation(), face.Points); g.FillPolygon(brush, ptsFace); } // top double cosTop = System.Math.Abs(Vector3D.DotProduct(HalfAxis.ToVector3D(cyl.Position.Direction), VLight)); Color colorTop = Color.FromArgb((int)(cyl.ColorTop.R * cosTop), (int)(cyl.ColorTop.G * cosTop), (int)(cyl.ColorTop.B * cosTop)); Brush brushTop = new SolidBrush(colorTop); bool topVisible = Vector3D.DotProduct(HalfAxis.ToVector3D(cyl.Position.Direction), _vTarget - _vCameraPos) < 0; if (cyl.DiameterInner > 0) { Face[] facesTop = cyl.FacesTop; foreach (Face face in facesTop) { Vector3D normal = face.Normal; // visible ? if (!face.IsVisible(_vTarget - _vCameraPos)) continue; // color // draw polygon Point[] ptsFace = TransformPoint(GetCurrentTransformation(), face.Points); g.FillPolygon(brushTop, ptsFace); } } else { if (topVisible) g.FillPolygon(brushTop, ptsTop); else g.FillPolygon(brushTop, ptsBottom); } if (topVisible) g.DrawPolygon(penPathThin, ptsTop); else g.DrawPolygon(penPathThin, ptsBottom); ++_boxDrawingCounter; }
public void AddCylinder(Cylinder cylinder) { _cylinders.Add(cylinder); }
private void AppendCylinderElement(CylinderProperties cylProperties, XmlElement elemAnalysis, XmlDocument xmlDoc) { string ns = xmlDoc.DocumentElement.NamespaceURI; // get CylinderProperties XmlElement elemCylinder = xmlDoc.CreateElement("cylinder", ns); elemAnalysis.AppendChild(elemCylinder); // name XmlElement elemName = xmlDoc.CreateElement("name", ns); elemName.InnerText = cylProperties.Name; elemCylinder.AppendChild(elemName); // description XmlElement elemDescription = xmlDoc.CreateElement("description", ns); elemDescription.InnerText = cylProperties.Description; elemCylinder.AppendChild(elemDescription); AppendElementValue(xmlDoc, elemCylinder, "radius", UnitsManager.UnitType.UT_LENGTH, cylProperties.RadiusOuter); AppendElementValue(xmlDoc, elemCylinder, "width", UnitsManager.UnitType.UT_LENGTH, cylProperties.Height); AppendElementValue(xmlDoc, elemCylinder, "height", UnitsManager.UnitType.UT_MASS, cylProperties.Weight); // --- build image Graphics3DImage graphics = new Graphics3DImage(new Size(ImageSizeDetail, ImageSizeDetail)); graphics.CameraPosition = Graphics3D.Corner_0; graphics.Target = Vector3D.Zero; Cylinder cyl = new Cylinder(0, cylProperties); graphics.AddCylinder(cyl); DimensionCube dc = new DimensionCube(cyl.DiameterOuter, cyl.DiameterOuter, cyl.Height); dc.FontSize = 6.0f; graphics.AddDimensions(dc); graphics.Flush(); // --- // view_case_iso XmlElement elemImage = xmlDoc.CreateElement("view_cylinder_iso", ns); TypeConverter converter = TypeDescriptor.GetConverter(typeof(Bitmap)); elemImage.InnerText = Convert.ToBase64String((byte[])converter.ConvertTo(graphics.Bitmap, typeof(byte[]))); XmlAttribute styleAttribute = xmlDoc.CreateAttribute("style"); styleAttribute.Value = string.Format("width:{0}pt;height:{1}pt", graphics.Bitmap.Width / 4, graphics.Bitmap.Height / 4); elemImage.Attributes.Append(styleAttribute); elemCylinder.AppendChild(elemImage); // save image SaveImageAs(graphics.Bitmap, "view_cylinder_iso.png"); }
public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { CylinderProperties cylProperties = new CylinderProperties( null, CylinderName, Description , RadiusOuter, RadiusInner, CylinderHeight, Weight , ColorTop, ColorWallOuter, ColorWallInner); Cylinder cyl = new Cylinder(0, cylProperties); graphics.AddCylinder(cyl); }