public override void DrawViewportWires(IGH_PreviewArgs args) { if (m_display_enabled && m_cloud != null) { args.Display.DrawPointCloud(m_cloud, 1, m_color); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { //Scale只能在0~10之间 this.Scale = this.Scale <= 0 ? 1 : this.Scale > 10?10:this.Scale; Color Red = Color.Red, Green = Color.Green, Blue = Color.Blue; if (this.Hidden || this.Locked) { return; } if (this.Attributes.Selected) { for (int i = 0; i < ViewPlanes.Count; i++) { Plane _Plane = ViewPlanes[i]; this.DrawPlaneArrow(args, _Plane, Scale, true); } } else { for (int i = 0; i < ViewPlanes.Count; i++) { Plane _Plane = ViewPlanes[i]; this.DrawPlaneArrow(args, _Plane, Scale, false); } } }
public override void DrawViewportWires(IGH_PreviewArgs args) { args.Viewport.GetFrustumFarPlane(out Plane plane); RhinoViewport viewport = args.Viewport; for (int i = 0; i < _pt.Count; i++) { if (bar_No == 1) { var size = VisualizeModel.VisualizeModel.fontsize; Point3d point = _pt[i]; plane.Origin = point; viewport.GetWorldToScreenScale(point, out double pixPerUnit); size /= pixPerUnit; args.Display.Draw3dText(_bar[i], _c[i], plane, size, "", false, false, Rhino.DocObjects.TextHorizontalAlignment.Center, Rhino.DocObjects.TextVerticalAlignment.Bottom); } if (bar_name == 1) { var size = VisualizeModel.VisualizeModel.fontsize; Point3d point = _pt[i]; plane.Origin = point; viewport.GetWorldToScreenScale(point, out double pixPerUnit); size /= pixPerUnit; args.Display.Draw3dText(_name[i], _c[i], plane, size, "", false, false, Rhino.DocObjects.TextHorizontalAlignment.Center, Rhino.DocObjects.TextVerticalAlignment.Top); } if (bar_list == 1) { var size = VisualizeModel.VisualizeModel.fontsize; Point3d point = _pt[i]; plane.Origin = point; viewport.GetWorldToScreenScale(point, out double pixPerUnit); size /= pixPerUnit; args.Display.Draw3dText(_list[i], _c[i], plane, size, "", false, false, Rhino.DocObjects.TextHorizontalAlignment.Center, Rhino.DocObjects.TextVerticalAlignment.Top); } } }
public void DrawViewportWires(IGH_PreviewArgs args) { try { EnsureLineCache(); GH_PreviewWireArgs e; if (Attributes.GetTopLevel.Selected) { e = new GH_PreviewWireArgs(args.Viewport, args.Display, args.WireColour_Selected, args.DefaultCurveThickness); } else { e = new GH_PreviewWireArgs(args.Viewport, args.Display, args.WireColour, args.DefaultCurveThickness); } args.Display.DrawLines(_lineCache, e.Color); foreach (var l in _dottedLineCache) { args.Display.DrawDottedLine(l, e.Color); } foreach (var m in _meshCache) { args.Display.DrawMeshFalseColors(m); } } catch { // ignore preview errors.. } }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { foreach (var m in _faces) { try { var face = m.Face; var size = m.Size; var planes = m.OrientationPlanes; var normals = m.Normals; for (int i = 0; i < planes.Count; i++) { var plane = planes[i]; var normal = normals[i]; normal.Unitize(); args.Display.DrawDirectionArrow(plane.Origin, normal * size, face.OrientationIsReversed ? Color.Blue : Color.White); args.Display.DrawDirectionArrow(plane.Origin, plane.XAxis * size, face.OrientationIsReversed ? Color.Green : Color.Red); args.Display.DrawDirectionArrow(plane.Origin, plane.YAxis * size, face.OrientationIsReversed ? Color.Red : Color.Green); } } catch { } } }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { if (model == null) { return; } var errorMaterial = new Rhino.Display.DisplayMaterial(System.Drawing.Color.Red, 0.3); var rodMaterial = new Rhino.Display.DisplayMaterial(System.Drawing.Color.BurlyWood, 0.3); var jointMaterial = new Rhino.Display.DisplayMaterial(System.Drawing.Color.Black, 0.3); foreach (var i in traversedEdges) { var conn = model.Edges[i]; args.Display.DrawMeshShaded(model.RodMeshes[conn], model.ClashedRods.Contains(conn) ? errorMaterial : rodMaterial); } foreach (var i in traversedVertices) { var jointMeshes = model.JointMeshes[i]; foreach (var b in jointMeshes) { args.Display.DrawMeshShaded(b, model.ClashedJoints.Contains(i) ? errorMaterial : jointMaterial); } } }
public override void DrawViewportWires(IGH_PreviewArgs args) { if (_sModel == null || _sModel.StbNodes.Length < 1) { return; } foreach (StbColumn column in _sModel.StbMembers.StbColumns) { Point3d ptFrom = _sModel.StbNodes.First(node => node.id == column.id_node_bottom).ToRhino(); Point3d ptTo = _sModel.StbNodes.First(node => node.id == column.id_node_top).ToRhino(); args.Display.Draw2dText("Column", Color.Brown, (ptFrom + ptTo) / 2, true, 12); } foreach (StbGirder girder in _sModel.StbMembers.StbGirders) { Point3d ptFrom = _sModel.StbNodes.First(node => node.id == girder.id_node_start).ToRhino(); Point3d ptTo = _sModel.StbNodes.First(node => node.id == girder.id_node_end).ToRhino(); args.Display.Draw2dText("Girder", Color.DarkGreen, (ptFrom + ptTo) / 2, true, 12); } foreach (StbBrace brace in _sModel.StbMembers.StbBraces) { Point3d ptFrom = _sModel.StbNodes.First(node => node.id == brace.id_node_start).ToRhino(); Point3d ptTo = _sModel.StbNodes.First(node => node.id == brace.id_node_end).ToRhino(); args.Display.Draw2dText("Brace", Color.Purple, (ptFrom + ptTo) / 2, true, 12); } }
//Preview meshes in Rhino public override void DrawViewportMeshes(IGH_PreviewArgs args) { if (Hidden) { return; } //if the component is hidden if (Locked) { return; } //if the component is locked base.DrawViewportMeshes(args); base.DrawViewportWires(args); Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial(color, 0); if (meshes != null) { foreach (Mesh mesh in meshes) { if (mesh != null && mesh.IsValid) { args.Display.DrawMeshShaded(mesh, mat); args.Display.DrawMeshWires(mesh, Color.White); } } } }
public override void DrawViewportWires(IGH_PreviewArgs args) { for (int i = 0; i < m_lines.Count; ++i) { switch (m_types[i + 1]) { case (0): args.Display.DrawLine(m_lines[i], System.Drawing.Color.Red); break; case (1): args.Display.DrawLine(m_lines[i], System.Drawing.Color.LightBlue); break; case (2): args.Display.DrawLine(m_lines[i], System.Drawing.Color.LimeGreen); break; case (-1): args.Display.DrawLine(m_lines[i], System.Drawing.Color.Purple); break; default: break; } } }
public override void DrawViewportWires(IGH_PreviewArgs args) { if (_text.Count == 0) { return; } //Plane plane; //args.Viewport.GetFrustumFarPlane(out plane); for (int i = 0; i < _text.Count; i++) { string text = _text[i]; Point3d point = _point[i]; double size = _size[i]; Polyline tile = _tile[i]; Plane plane; args.Viewport.GetFrustumFarPlane(out plane); plane.Origin = point; Rhino.Display.Text3d drawText = new Rhino.Display.Text3d(text, plane, size); args.Display.Draw3dText(text, Color.Black, plane, size, null, false, false, Rhino.DocObjects.TextHorizontalAlignment.Center, Rhino.DocObjects.TextVerticalAlignment.Middle); args.Display.DrawPolyline(tile, Color.Black, 2); drawText.Dispose(); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { if (model == null) { return; } if (AnnotateRods) { foreach (var r in model.RodCentrelines.Values) { var midPoint = r.PointAtNormalizedLength(0.5); var lengthString = String.Format("{0:F2}", r.GetLength()); args.Display.Draw2dText(lengthString, System.Drawing.Color.Blue, midPoint, false, 20, "Lucida Console"); } } if (AnnotateJoints) { int counter = 0; foreach (var v in model.Vertices) { args.Display.Draw2dText((counter++).ToString(), System.Drawing.Color.Orange, v, false, 20, "Lucida Console"); } } if (AnnotateJointArms) { foreach (var kvp in model.JointArmLabel) { args.Display.Draw2dText(kvp.Key, System.Drawing.Color.Green, kvp.Value, false, 20, "Lucida Console"); } } }
public override void DrawViewportWires(IGH_PreviewArgs argments) { argments.Viewport.GetFrustumFarPlane(out Plane pln); RhinoViewport viewp = argments.Viewport; for (int i = 0; i < _s.Count; i++) { var material = new DisplayMaterial(_c[i], 0.5); argments.Display.DrawBrepShaded(_s[i], material); } for (int i = 0; i < _pt.Count; i++) { double size = fontsize; Point3d point = _pt[i]; pln.Origin = point; viewp.GetWorldToScreenScale(point, out double pixPerUnit); size /= pixPerUnit; var tt = _text[i]; var H = TextHorizontalAlignment.Right; var V = TextVerticalAlignment.Top; if (_c2[i] == Color.Black) { V = TextVerticalAlignment.Bottom; } if (_c2[i] == Color.Blue) { H = TextHorizontalAlignment.Left; V = TextVerticalAlignment.Bottom; } if (_c2[i] == Color.Purple) { H = TextHorizontalAlignment.Left; } argments.Display.Draw3dText(tt, _c2[i], pln, size, "", false, false, H, V); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { IGH_Param igh_Param = Params.Output[1]; //可见点 IGH_PreviewObject igh_PreviewObject = (IGH_PreviewObject)igh_Param; if (igh_PreviewObject.Hidden || !igh_PreviewObject.IsPreviewCapable) { return; //电池隐藏或不可预览时跳过 } GH_Structure <GH_Integer> pk = (GH_Structure <GH_Integer>)Params.Input[3].VolatileData; int k = (pk).get_FirstItem(false).Value;//获取精度 List <GH_Point> Pt = ((GH_Structure <GH_Point>)Params.Output[0].VolatileData).FlattenData(); List <GH_Point> Grid = ((GH_Structure <GH_Point>)Params.Output[1].VolatileData).FlattenData(); List <Point3d> Ptl = new List <Point3d>(Pt.Count); foreach (GH_Point V in Pt) { Ptl.Add(V.Value); } List <Point3d> Gridl = new List <Point3d>(Pt.Count); foreach (GH_Point V in Grid) { Gridl.Add(V.Value); } args.Display.DrawPoints(Gridl, CentralSettings.PreviewPointStyle, (int)(k * 0.4), Attributes.GetTopLevel.Selected ? args.WireColour_Selected : Color.Aquamarine); //igh_PreviewObject.DrawViewportWires(args);//可见点 args.Display.DrawPoints(Ptl, CentralSettings.PreviewPointStyle, k, Attributes.GetTopLevel.Selected ? args.WireColour_Selected : Color.Red); //观察点 }
public void DrawViewportWires(IGH_PreviewArgs args) { //Use a standard method to draw gunk, you don't have to specifically implement this. Preview_DrawWires(args); }
private void DrawCurves(IGH_PreviewArgs args, List <Curve> crvs, System.Drawing.Color color) { for (int i = 0; i < crvs.Count; i++) { args.Display.DrawCurve(crvs[i], color); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { GH_Colour CurrentCrvColor; base.DrawViewportMeshes(args); int Thickness = CrvThickness.Value < 0 ? Math.Abs(CrvThickness.Value) : CrvThickness.Value == 0 ? 2 : CrvThickness.Value; if (this.Hidden || this.Locked) { return; } if (this.Attributes.Selected) { CurrentCrvColor = new GH_Colour(Color.Green); } else { CurrentCrvColor = CrvColor; } for (int Index = 0; Index < CrvList.Count; Index++) { GH_Curve Crv = CrvList[Index]; args.Display.DrawCurve(Crv.Value, CurrentCrvColor.Value, Thickness); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { foreach (var point in _points) { args.Display.DrawPoint(point); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { for (var i = 0; i < _axisLines.Count; i++) { args.Display.Draw2dText(_axisStr[i], Color.Black, _axisPts[i], true, _size); args.Display.DrawPatternedLine(_axisLines[i], Color.Black, 0x0000AFAF, 1); } double xMin = _axisPts.Min(pt => pt.X); double yMin = _axisPts.Min(pt => pt.Y); var vec = new Vector3d(xMin, yMin, 0); double length = _axisLines.Max(line => line.Length); for (var i = 1; i < _storyPts.Count; i++) { args.Display.DrawLine(new Line(_storyPts[i - 1] + vec, _storyPts[i] + vec), Color.Black); } for (var i = 0; i < _storyPts.Count; i++) { args.Display.Draw2dText(_storyStr[i], Color.Black, _storyPts[i] + vec, true, _size); args.Display.DrawLine(new Line(_storyPts[i] + vec, _storyPts[i] + vec + length * Vector3d.XAxis), Color.Black); args.Display.DrawLine(new Line(_storyPts[i] + vec, _storyPts[i] + vec + length * Vector3d.YAxis), Color.Black); } }
public void DrawViewportMeshes(IGH_PreviewArgs args) { if ((args.Document.PreviewMode == GH_PreviewMode.Shaded) && args.Display.SupportsShading) { base.Preview_DrawMeshes(args); } }
//Draw all wires and points in this method. public override void DrawViewportWires(IGH_PreviewArgs args) { //Rhino.Display.PointStyle.Square; args.Display.DrawPoints(_points, Rhino.Display.PointStyle.Square, _width, _color); //args.Display.DrawMeshVertices(_mesh, _color); //DrawMeshWires(_mesh, _color, _width); }
public override void DrawViewportWires(IGH_PreviewArgs args) { if (autoColor) { gradientList = new System.Drawing.Color[_plan.getCells().Count]; for (int i = 0; i < gradientList.Length; i++) { var multiplier = sunAccess[i]; var gColor = new ColorHSL(multiplier, multiplier, 0, multiplier); var rgb = gColor.ToArgbColor(); gradientList[i] = (rgb); } for (int i = 0; i < rectangles.Count; i++) { Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial(gradientList[i]); mat.Shine = 0.25; { var curve = rectangles[i].ToNurbsCurve(); var pts = rectangles[i].ToPolyline(); args.Display.DrawPolyline(pts, gradientList[i], 1); var mesh = Mesh.CreateFromPlanarBoundary(curve, Rhino.Geometry.MeshingParameters.FastRenderMesh, 0.01); args.Display.DrawMeshShaded(mesh, mat); } } } }
public override void DrawViewportWires(IGH_PreviewArgs args) { if (this.displayMode == 0) { if (this.useTexture) { if (this.particleTexture == string.Empty) { this.particleTexture = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + @"\Grasshopper\Libraries\Culebra_GH\textures\texture.png"; } viz.DrawSprites(args, particleTexture, particleList); } if (this.trail) { if (this.graphicType == "Gradient") { viz.DrawGradientTrails(args, particleSet, (float)this.redValues[0], (float)this.redValues[1], (float)this.greenValues[0], (float)this.greenValues[1], (float)this.blueValues[0], (float)this.blueValues[1], this.minthick, this.maxthick); } else if (this.graphicType == "GraphicPolyline") { viz.DrawPolylineTrails(args, particleSet, this.dotted, this.maxthick, this.polylineColor); } else if (this.graphicType == "Disco") { this.randomGen = new Random(); viz.DrawDiscoTrails(args, particleSet, randomGen, this.minthick, this.maxthick); } else if (this.graphicType == "Base") { viz.DrawGradientTrails(args, particleSet, 0, this.minthick, this.maxthick); } } } }
public override void DrawViewportWires(IGH_PreviewArgs args) { base.DrawViewportWires(args); foreach (var geometry in GeometryRuntimeErrors) { switch (geometry) { case Rhino.Geometry.Point point: args.Display.DrawPoint(point.Location, Rhino.Display.PointStyle.Asterisk, args.Display.DisplayPipelineAttributes.PointRadius * 2.0f, Color.Orange); break; case Rhino.Geometry.Curve curve: args.Display.DrawCurve(curve, Color.Orange, args.DefaultCurveThickness * 5); if (curve.IsShort(Revit.ShortCurveTolerance * Revit.ModelUnits)) { args.Display.DrawPoint(curve.PointAtStart, Rhino.Display.PointStyle.RoundControlPoint, args.Display.DisplayPipelineAttributes.PointRadius * 2.0f, Color.Orange); args.Display.DrawPoint(curve.PointAtEnd, Rhino.Display.PointStyle.RoundControlPoint, args.Display.DisplayPipelineAttributes.PointRadius * 2.0f, Color.Orange); } break; case Rhino.Geometry.Surface surface: args.Display.DrawSurface(surface, Color.Orange, args.DefaultCurveThickness * 5); args.Display.DrawPoint(surface.PointAt(surface.Domain(0).Mid, surface.Domain(1).Mid), Rhino.Display.PointStyle.Square, args.Display.DisplayPipelineAttributes.PointRadius * 3.5f, Color.Orange); break; case Rhino.Geometry.Brep brep: args.Display.DrawBrepWires(brep, Color.Orange, args.DefaultCurveThickness * 5); break; } } }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { foreach (GH_Mesh m in msh) { args.Display.DrawMeshShaded(m.Value, mat); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { if (Locked || args.Document.PreviewMode == GH_PreviewMode.Disabled) { return; //跳过锁定或非线框模式 } List <GH_Colour> cu = ((GH_Structure <GH_Colour>)Params.Input[3].VolatileData).FlattenData(); List <GH_Curve> lu = ((GH_Structure <GH_Curve>)Params.Output[0].VolatileData).FlattenData(); List <GH_Colour> cd = ((GH_Structure <GH_Colour>)Params.Input[4].VolatileData).FlattenData(); List <GH_Curve> ld = ((GH_Structure <GH_Curve>)Params.Output[1].VolatileData).FlattenData(); if (lu.Count != 0 && cu.Count != 0) { foreach (GH_Curve l in lu) { bool set = Attributes.GetTopLevel.Selected; if (l.IsValid) { args.Display.DrawCurve(l.Value, set ? args.WireColour_Selected : cu[0].Value); } } } if (ld.Count == 0 || cd.Count == 0) { return; } foreach (GH_Curve l in ld) { bool set = Attributes.GetTopLevel.Selected; if (l.IsValid) { args.Display.DrawCurve(l.Value, set ? args.WireColour_Selected : cd[0].Value); } } }
public override void DrawViewportWires(IGH_PreviewArgs args) { if ((this.m_items != null)) { if (this.Attributes.Selected) { GH_PreviewWireArgs args2 = new GH_PreviewWireArgs(args.Viewport, args.Display, args.WireColour_Selected, args.DefaultCurveThickness); foreach (GH_CustomPreviewItem item in this.m_items) { if (!(item.m_obj is GH_Mesh) || CentralSettings.PreviewMeshEdges) { item.m_obj.DrawViewportWires(args2); } } } else { foreach (GH_CustomPreviewItem item2 in this.m_items) { if (!(item2.m_obj is GH_Mesh) || CentralSettings.PreviewMeshEdges) { GH_PreviewWireArgs args3 = new GH_PreviewWireArgs(args.Viewport, args.Display, item2.m_col, args.DefaultCurveThickness); item2.m_obj.DrawViewportWires(args3); } } } } }
/// <summary> /// Draw the preview meshes, draws fake shadow /// </summary> /// <param name="args">Display data used during preview drawing.</param> public override void DrawViewportMeshes(IGH_PreviewArgs args) { try { /* * GH_PreviewWireArgs e; * if (Attributes.GetTopLevel.Selected) * { * e = new GH_PreviewWireArgs(args.Viewport, args.Display, args.WireColour_Selected, args.DefaultCurveThickness); * } * else * { * e = new GH_PreviewWireArgs(args.Viewport, args.Display, args.WireColour, args.DefaultCurveThickness); * }*/ GenerateBoxMeshes(); foreach (var m in RenderMesh) { args.Display.DrawMeshFalseColors(m); } } catch (Exception e) { RhinoApp.WriteLine("Error in voxeltools rendering {0}", e.Message); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { base.DrawViewportWires(args); if (texts.Count == 0) { return; } Plane plane; args.Viewport.GetFrustumFarPlane(out plane); for (int i = 0; i < texts.Count; i++) { string text = texts[i]; double size = sizes[i]; Point3d location = locations[i]; plane.Origin = location; // Figure out the size. This means measuring the visible size in the viewport AT the current location. double pixPerUnit; Rhino.Display.RhinoViewport viewport = args.Viewport; viewport.GetWorldToScreenScale(location, out pixPerUnit); size = size / pixPerUnit; Rhino.Display.Text3d drawText = new Rhino.Display.Text3d(text, plane, size); args.Display.Draw3dText(drawText, args.WireColour); drawText.Dispose(); } }
private void DrawBreps(IGH_PreviewArgs args, List <Brep> breps, System.Drawing.Color color) { for (int i = 0; i < breps.Count; i++) { args.Display.DrawBrepWires(breps[i], color); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { for (var i = 0; i < _plateName.PathCount; i++) { args.Display.Draw2dText(_plateName.Branches[i][0].Value, Color.Black, _platePos[i], true, _size); } }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { // Dont do this, results are strange. Instead output the breps and curves //DrawBreps(args, _breps, System.Drawing.Color.DarkBlue); //DrawCurves(args, _secCrvs, System.Drawing.Color.DarkBlue); base.DrawViewportMeshes(args); }
public override void DrawViewportWires(IGH_PreviewArgs args) { DrawCurves(args, _dispCrvN, System.Drawing.Color.Blue); DrawCurves(args, _dispCrvVy, System.Drawing.Color.OldLace); DrawCurves(args, _dispCrvVz, System.Drawing.Color.Black); DrawCurves(args, _dispCrvT, System.Drawing.Color.Brown); DrawCurves(args, _dispCrvMyy, System.Drawing.Color.DarkOrange); DrawCurves(args, _dispCrvMzz, System.Drawing.Color.Purple); base.DrawViewportWires(args); }
public override void DrawViewportWires(IGH_PreviewArgs args) { if (Locked) return; if (_vectors == null) return; for (int i = 0; i < _vectors.Count; i++) { } }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { try { if (m_shapes == null) return; for (Int32 i = 0; i <= m_shapes.Count - 1; i++) { args.Display.DrawMeshShaded(m_shapes[i], m_materials[i]); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { try { if (m_shapes == null) return; for (Int32 i = 0; i <= m_shapes.Count - 1; i++) { args.Display.DrawMeshShaded(m_shapes[i], m_materials[i]); } } catch (Exception ex) { MessageBox.Show(@"An error occured during creating the image file.Please Check C:\maps" + "\r\n" + ex.ToString()); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { base.DrawViewportWires(args); time++; Rhino.DocObjects.RhinoObject obj = RhinoDoc.ActiveDoc.Objects.Find(ID); TextObject T = (TextObject)obj; TextEntity t = T.TextGeometry; m_tags = new Rhino.Display.Text3d(t.Text + " " + time.ToString() , t.Plane, t.TextHeight + 1); if (this.m_tags != null) { Color defaultColour = Color.Blue; args.Display.Draw3dText(this.m_tags, defaultColour); } }
public override void DrawViewportWires(IGH_PreviewArgs args) { base.DrawViewportWires(args); if (this.m_tags != null) { Color defaultColour=Color.Blue; //= args.WireColour; // defaultColour = args.WireColour_Selected; int Count = this.m_tags.Count - 1; for (int i = 0; i <= Count; i++) { Color col = defaultColour; args.Display.Draw3dText(this.m_tags[i], col); } } }
//Custom preview of lines with colours and thickness public override void DrawViewportWires(IGH_PreviewArgs args) { base.DrawViewportWires(args); if (Hidden) { return; } //if the component is hidden if (Locked) { return; } //if the component is locked if (lines != null) { for (int i = 0; i < lines.Count; i++) { if (lines[i] != null && lines[i].IsValid) { args.Display.DrawLine(lines[i], c, 2); } } } }
/// <summary> /// Override default preview behaviour (mesh and wire colors) /// </summary> public override void DrawViewportMeshes(IGH_PreviewArgs args) { Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial(Color.FromArgb(255, 255, 255), 0); base.DrawViewportMeshes(args); base.DrawViewportWires(args); if (m_mesh != null) { foreach (Mesh mesh in m_mesh) { if (mesh != null && mesh.IsValid) { args.Display.DrawMeshShaded(mesh, mat); args.Display.DrawMeshWires(mesh, Color.Black); } } } }
private void DrawBreps(IGH_PreviewArgs args, List<Brep> breps, System.Drawing.Color color) { for (int i = 0; i < breps.Count; i++) args.Display.DrawBrepWires(breps[i], color); }
/// <summary> /// Display naked edges /// </summary> public override void DrawViewportWires(IGH_PreviewArgs args) { base.DrawViewportWires(args); if (m_nakedEdges != null) { foreach (Polyline nakedEdge in m_nakedEdges) { if (nakedEdge.IsValid) { args.Display.DrawPolyline(nakedEdge, Color.DarkRed); } } } }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { base.DrawViewportMeshes(args); //Draw Clearance if (displayPrinter) { if (extclearance.IsValid) { args.Display.DrawMeshShaded(extclearance, vizmaterial); } if (xcarriage.Count > 0) { foreach (Mesh rod in xcarriage) { if (rod.IsValid) { args.Display.DrawMeshShaded(rod, vizmaterial); } } } } }
public override void DrawViewportWires(IGH_PreviewArgs args) { //This is the method that draws the preview of the Silkworm Model base.DrawViewportWires(args); //Draw Start and End Pts for Logistics view if (startPoints != null) { foreach (Line line in startPoints) { if (line != null) { args.Display.DrawLine(line, Color.Red, 10); } } } if (endPoints != null) { foreach (Line line in endPoints) { if (line != null) { args.Display.DrawLine(line, Color.Blue, 10); } } } //Draw Movement Lines if (Movements != null) { for (int i = 0; i < Movements.Count; i++) { if (displayValues) { if (Colors[i] != null) { args.Display.DrawLine(Movements[i], Colors[i], (int)Math.Round(lineThicknesses[i], 0)); } } else { if (Colors[i] != null) { args.Display.DrawLine(Movements[i], Colors[i], 1); } } } } //Draw Movement Values if (displayLogistics) { //Draw Delimiting Vector Arrows if (DelimitMarkers != null) { for (int i = 0; i < DelimitMarkers.Count; i++) { Vector3d delimitVec = new Vector3d(DelimitMarkers[i].FromX - DelimitMarkers[i].ToX, DelimitMarkers[i].FromY - DelimitMarkers[i].ToY, DelimitMarkers[i].FromZ - DelimitMarkers[i].ToZ); args.Display.DrawMarker(DelimitMarkers[i].To, delimitVec, Color.Blue, 1); args.Display.DrawLine(DelimitMarkers[i], Color.Gray, 1); } } } if (blobPts != null) { //Draw Point Blobs for (int i = 0; i < blobPts.Count; i++) { //args.Display.DrawPoint(blobPts[i], PointStyle.ControlPoint, blobRadius[i], Color.Yellow); if (displayValues) { if (blobPts[i] != null) { args.Display.DrawSphere(new Sphere(blobPts[i], (blobDiameter[i] / 2)), Color.Yellow); } } else { if (blobPts[i] != null) { args.Display.DrawSphere(new Sphere(blobPts[i], 1), Color.Yellow); } } } } //Draw Print Area if (displayPrinter) { if (printArea != null) { args.Display.DrawPolygon(printArea, Color.Yellow, false); } } }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { foreach (Rhino.Geometry.Brep brep in Preview) args.Display.DrawBrepShaded(brep, args.ShadeMaterial); }
public override void DrawViewportWires(IGH_PreviewArgs args) { //base.DrawViewportWires(args); int defaultPointRadius = 2; for (int n = 0; n < m_obj.Count; n++) { object obj = m_obj[n]; Rhino.DocObjects.ObjectAttributes att = m_att[n].Value; if (obj == null) continue; Type objectType = obj.GetType(); if (objectType == typeof(Grasshopper.Kernel.Types.GH_Vector)) { Rhino.Geometry.Vector3d rh_vec = ((Grasshopper.Kernel.Types.GH_Vector)obj).Value; args.Display.DrawArrow(new Rhino.Geometry.Line(new Rhino.Geometry.Point3d(0, 0, 0), new Rhino.Geometry.Point3d(rh_vec)), att.ObjectColor); continue; } if (objectType == typeof(Grasshopper.Kernel.Types.GH_Point)) { Rhino.Geometry.Point3d rh_point = ((Grasshopper.Kernel.Types.GH_Point)obj).Value; if (att.PlotWeight == 0) args.Display.DrawPoint(rh_point, Rhino.Display.PointStyle.Simple, defaultPointRadius, att.ObjectColor); else args.Display.DrawPoint(rh_point, Rhino.Display.PointStyle.Simple, (int)att.PlotWeight, att.ObjectColor); continue; } if (objectType == typeof(Grasshopper.Kernel.Types.GH_Line)) { Rhino.Geometry.Line rh_line = ((Grasshopper.Kernel.Types.GH_Line)obj).Value; if (att.PlotWeight == 0) args.Display.DrawLine(rh_line, att.ObjectColor); else args.Display.DrawLine(rh_line, att.ObjectColor, (int)att.PlotWeight); continue; } if (objectType == typeof(Grasshopper.Kernel.Types.GH_Mesh)) { Rhino.Geometry.Mesh rh_mesh = ((Grasshopper.Kernel.Types.GH_Mesh)obj).Value; Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial(att.ObjectColor, 0.5); args.Display.DrawMeshShaded(rh_mesh, mat); continue; } if (objectType == typeof(Grasshopper.Kernel.Types.GH_Curve)) { //TODO: deal with open polylines, curves, non-planar polycurves, etc Rhino.Geometry.Curve rh_curve = ((Grasshopper.Kernel.Types.GH_Curve)obj).Value; Rhino.Geometry.Polyline rh_pline = new Rhino.Geometry.Polyline(); if ((rh_curve.IsClosed) && (rh_curve.IsPlanar()) && (rh_curve.TryGetPolyline(out rh_pline))) { bool fill = true; Rhino.Geometry.Intersect.CurveIntersections iev = Rhino.Geometry.Intersect.Intersection.CurveSelf(rh_curve, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance); if (iev.Count > 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Found a self-intersecting polygon. Fills will not be applied."); fill = false; } args.Display.DrawPolygon(rh_pline, att.ObjectColor, false); if (fill) { Rhino.Geometry.Mesh m = Rhino.Geometry.Mesh.CreateFromPlanarBoundary(rh_curve, Rhino.Geometry.MeshingParameters.Smooth); args.Display.DrawMeshShaded(m, new Rhino.Display.DisplayMaterial(att.ObjectColor, 0.5)); } continue; } } AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "The component does not know how to handle this type of gh_geometry: " + objectType.FullName); } }
private void DrawCurves(IGH_PreviewArgs args, List<Curve> crvs, System.Drawing.Color color) { for (int i = 0; i < crvs.Count; i++) args.Display.DrawCurve(crvs[i], color); }
public override void DrawViewportMeshes(IGH_PreviewArgs args) { }