Exemplo n.º 1
0
        private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
        {
            if (DrawUtil.DrawInfo)
            {
                if (_infoPanel == null)
                {
                    _infoPanel = new InfoPanel();
                    _infoPanel.Positions.Add(Value.Location);

                    _infoPanel.Content.Add("LC: " + LoadCase);
                    if (!Forces.IsTiny())
                    {
                        _infoPanel.Content.Add("Force: " + Forces.Length);
                    }
                    if (!Moments.IsTiny())
                    {
                        _infoPanel.Content.Add("Moment: " + Moments.Length);
                    }
                    if (!Displacement.IsTiny())
                    {
                        _infoPanel.Content.Add("Displacement: " + Displacement.Length);
                    }
                    if (!DisplacementRotational.IsTiny())
                    {
                        _infoPanel.Content.Add("Rot.Displacement: " + DisplacementRotational.Length);
                    }
                }
                _infoPanel.Draw(pipeline, viewport);
            }
        }
Exemplo n.º 2
0
        public void Draw(Rhino.Display.DisplayPipeline pipeline)
        {
            foreach (Transform t in Transforms)
            {
                Line xLine = new Line(new Point3d(0.1, 0, 0), new Point3d(1, 0, 0));
                Line yLine = new Line(new Point3d(0, 0.1, 0), new Point3d(0, 1, 0));
                Line zLine = new Line(new Point3d(0, 0, 0.1), new Point3d(0, 0, 1));

                Line xLine2 = new Line(new Point3d(0.1, 0, 0), new Point3d(0.8, 0, 0));
                Line yLine2 = new Line(new Point3d(0, 0.1, 0), new Point3d(0, 0.8, 0));
                Line zLine2 = new Line(new Point3d(0, 0, 0.1), new Point3d(0, 0, 0.8));


                xLine.Transform(t);
                yLine.Transform(t);
                zLine.Transform(t);

                xLine2.Transform(t);
                yLine2.Transform(t);
                zLine2.Transform(t);


                pipeline.DrawLine(xLine2, System.Drawing.Color.Red, 2);
                pipeline.DrawLine(yLine2, System.Drawing.Color.Green, 2);
                pipeline.DrawLine(zLine2, System.Drawing.Color.Blue, 2);


                pipeline.DrawArrow(xLine, System.Drawing.Color.Red, 0.0, 0.382);
                pipeline.DrawArrow(yLine, System.Drawing.Color.Green, 0.0, 0.382);
                pipeline.DrawArrow(zLine, System.Drawing.Color.Blue, 0.0, 0.382);
            }
        }
Exemplo n.º 3
0
        /***************************************************/

        public static void RenderWires(BHG.Plane plane, Rhino.Display.DisplayPipeline pipeline, Color bhColour)
        {
            pipeline.DrawConstructionPlane(new Rhino.DocObjects.ConstructionPlane()
            {
                Plane = (plane.ToRhino()), ThickLineColor = bhColour, ThinLineColor = Color.Black, GridLineCount = 10
            });
        }
Exemplo n.º 4
0
        public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col)
        {
            List <Point3d> _endPoints_F = new List <Point3d>();
            List <Point3d> _endPoints_M = new List <Point3d>();

            foreach (Transform t in Transforms)
            {
                if (!(_symbolF is null))
                {
                    SymbolF _temp = new SymbolF(_symbolF);
                    _temp.Transform(t);
                    _temp.Draw(pipeline, col);
                    _endPoints_F.Add(_temp.ALine.From);
                }
                if (!(_symbolM is null))
                {
                    SymbolM _temp = new SymbolM(_symbolM);
                    _temp.Transform(t);
                    _temp.Draw(pipeline, col);
                    _endPoints_M.Add(_temp.APoint);
                }
            }

            pipeline.DrawDottedPolyline(_endPoints_F, col, false);
            pipeline.DrawDottedPolyline(_endPoints_M, col, false);
        }
Exemplo n.º 5
0
        public void Draw2(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col)
        {
            List <Point3d> _endPoints_F = new List <Point3d>();
            List <Point3d> _endPoints_M = new List <Point3d>();

            foreach (Transform t in Transforms)
            {
                pipeline.PushModelTransform(t);

                if (!(_symbolF is null))
                {
                    _symbolF.Draw(pipeline, col);
                    Point3d p = new Point3d(_symbolF.ALine.From);
                    p.Transform(t);
                    _endPoints_F.Add(p);
                }
                if (!(_symbolM is null))
                {
                    _symbolM.Draw(pipeline, col);
                    Point3d p = new Point3d(_symbolM.APoint);
                    p.Transform(t);
                    _endPoints_M.Add(p);
                }

                pipeline.PopModelTransform();
            }

            pipeline.DrawDottedPolyline(_endPoints_F, DrawUtil.DrawColorLoads, false);
            pipeline.DrawDottedPolyline(_endPoints_M, DrawUtil.DrawColorLoads, false);
        }
Exemplo n.º 6
0
 private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
 {
     if (DrawUtil.DrawInfo)
     {
         if (_infoPanel == null)
         {
             _infoPanel = new InfoPanel();
             var lines = Value.GetConnectionLines();
             if (lines.Count == 1)
             {
                 _infoPanel.Positions.Add((lines[0].From + lines[0].To) * 0.5);
             }
             else
             {
                 _infoPanel.Positions.Add((lines[0].From + lines[0].To) * 0.5);
                 _infoPanel.Positions.Add((lines[lines.Count - 1].From + lines[lines.Count - 1].To) * 0.5);
                 _infoPanel.Positions.Add((lines[0].From + lines[lines.Count - 1].From) * 0.5);
                 _infoPanel.Positions.Add((lines[0].To + lines[lines.Count - 1].To) * 0.5);
             }
             if (GroupId != 0)
             {
                 _infoPanel.Content.Add("Grp: " + GroupId);
             }
             _infoPanel.Content.Add("Stf: " + Axial_stiffness + " / " + Rotational_stiffness + " / " + Transversal_stiffness);
         }
         _infoPanel.Draw(pipeline, viewport);
     }
 }
Exemplo n.º 7
0
 public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col)
 {
     foreach (ISymbol s in _symbols)
     {
         s.Draw(pipeline, col);
     }
 }
Exemplo n.º 8
0
 public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col)
 {
     //pipeline.DrawPatternedLine(_line, col, 0x00110101, 3);
     foreach (Curve crv in _crvs)
     {
         pipeline.DrawCurve(crv, col);
     }
 }
Exemplo n.º 9
0
        /***************************************************/

        public static void RenderWires(BHG.NurbsSurface surface, Rhino.Display.DisplayPipeline pipeline, Color bhColour)
        {
            RHG.GeometryBase geometry = surface.ToRhino();
            if (geometry is RHG.Surface)
            {
                geometry = RHG.Brep.CreateFromSurface((RHG.Surface)geometry);
            }

            pipeline.DrawBrepWires((RHG.Brep)geometry, bhColour, 2);
        }
Exemplo n.º 10
0
 private void drawLocalFrame(Rhino.Display.DisplayPipeline pipeline)
 {
     if (DrawUtil.ScaleFactorLocalFrame > 0.0001)
     {
         if (!_localFrame.isValid)
         {
             updateLocalFrameTransforms();
         }
         _localFrame.Draw(pipeline);
     }
 }
Exemplo n.º 11
0
 //Draw this circle using a Pipeline.
 public void Draw(Rhino.Display.DisplayPipeline dp)
 {
     if (InMotion)
     {
         dp.DrawCircle(m_circle, g_motion_color, 2);
     }
     else
     {
         dp.DrawCircle(m_circle, System.Drawing.Color.Black);
     }
 }
Exemplo n.º 12
0
 private void drawSupportLine(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col, bool shaded)
 {
     if (DrawUtil.ScaleFactorSupports > 0.0001 && _supp_condition.HasSupport)
     {
         if (!_supp_condition.isValid)
         {
             updateSupportTransforms();
         }
         _supp_condition.Draw(pipeline, col, shaded);
     }
 }
Exemplo n.º 13
0
        public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col, bool shaded)
        {
            foreach (Transform t in Transforms)
            {
                pipeline.PushModelTransform(t);

                _symbol.Draw(pipeline, col, shaded);

                pipeline.PopModelTransform();
            }
        }
Exemplo n.º 14
0
        public static bool RhTexture2dCapture(Rhino.Display.DisplayPipeline pipeline, IntPtr ptrTexture2d, CaptureFormat captureFormat)
        {
            var    fieldInfo   = pipeline.GetType().GetField("m_ptr", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            IntPtr ptrPipeline = (IntPtr)fieldInfo.GetValue(pipeline);

            if (Rhino.Runtime.HostUtils.RunningOnWindows)
            {
                return(WindowsMethods.RhTexture2dPipelineCapture(ptrPipeline, ptrTexture2d, captureFormat));
            }
            else
            {
                var viewSerialNumber = pipeline.Viewport.ParentView.RuntimeSerialNumber;
                return(MacMethods.RhTexture2dCapture(viewSerialNumber, ptrTexture2d, captureFormat));
            }
        }
Exemplo n.º 15
0
        /***************************************************/

        public static void RenderWires(BHG.CompositeGeometry composite, Rhino.Display.DisplayPipeline pipeline, Color bhColour)
        {
            if (composite.Elements.Count == 0)
            {
                return;
            }
            foreach (BHG.IGeometry geom in composite.Elements)
            {
                try
                {
                    RenderWires(geom as dynamic, pipeline, bhColour);
                }
                catch (Exception) { }
            }
        }
Exemplo n.º 16
0
        public static IDisposable BeginFrame(Rhino.Display.DisplayPipeline display, List <GLShaderComponentBase> components)
        {
            // check to see if any components use _colorBuffer or _depthBuffer
            bool usesInitialColorBuffer = false;
            bool usesInitialDepthBuffer = false;

            foreach (var component in components)
            {
                if (!usesInitialColorBuffer && component._model.TryGetUniformType("_colorBuffer", out string dataType, out int arrayLength))
                {
                    usesInitialColorBuffer = true;
                }
                if (!usesInitialDepthBuffer && component._model.TryGetUniformType("_depthBuffer", out dataType, out arrayLength))
                {
                    usesInitialDepthBuffer = true;
                }
            }
            if (usesInitialColorBuffer)
            {
                IntPtr texture2dPtr = Rhino7NativeMethods.RhTexture2dCreate();
                Rhino7NativeMethods.RhTexture2dCapture(display, texture2dPtr, Rhino7NativeMethods.CaptureFormat.kRGBA);
                InitialColorBuffer = texture2dPtr;
            }
            if (usesInitialDepthBuffer)
            {
                IntPtr texture2dPtr = Rhino7NativeMethods.RhTexture2dCreate();
                Rhino7NativeMethods.RhTexture2dCapture(display, texture2dPtr, Rhino7NativeMethods.CaptureFormat.kDEPTH24);
                InitialDepthBuffer = texture2dPtr;
            }

            foreach (var texture in _componentSamplers.Values)
            {
                GLRecycleBin.AddTextureToDeleteList(texture);
            }
            _componentSamplers.Clear();

            // figure out list of per component depth and color textures that need to be created/retrieved
            foreach (var component in components)
            {
                string[] samplers = component._model.GetUniformsAndAttributes(0).GetComponentSamplers();
                foreach (var sampler in samplers)
                {
                    _componentSamplers[sampler.ToLowerInvariant()] = IntPtr.Zero;
                }
            }

            return(new PerFrameLifetimeObject());
        }
Exemplo n.º 17
0
 private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
 {
     if (DrawUtil.DrawInfo)
     {
         if (_infoPanel == null)
         {
             _infoPanel = new InfoPanel();
             _infoPanel.Positions.Add(Value.Location);
             if (Id != 0)
             {
                 _infoPanel.Content.Add("Id: " + Id);
             }
         }
         _infoPanel.Draw(pipeline, viewport);
     }
 }
Exemplo n.º 18
0
        public void Setup(uint program, Rhino.Display.DisplayPipeline dp)
        {
            string glname     = Name;
            int    arrayIndex = glname.IndexOf('[');

            if (arrayIndex > 0)
            {
                glname = glname.Substring(0, arrayIndex);
            }
            int uniformLocation = OpenGL.glGetUniformLocation(program, glname);

            if (uniformLocation >= 0)
            {
                _setup(uniformLocation, dp);
            }
        }
Exemplo n.º 19
0
 private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
 {
     if (DrawUtil.DrawInfo)
     {
         if (_infoPanel == null)
         {
             _infoPanel = new InfoPanel();
             var amp = AreaMassProperties.Compute(Value);
             _infoPanel.Positions.Add(Value.ClosestPoint(amp.Centroid));
             if (Id != 0)
             {
                 _infoPanel.Content.Add("Id: " + Id);
             }
             if (GroupId != 0)
             {
                 _infoPanel.Content.Add("Grp: " + GroupId);
             }
         }
         _infoPanel.Draw(pipeline, viewport);
     }
 }
Exemplo n.º 20
0
        static Rhino.Geometry.Light[] GetLightsHelper(Rhino.Display.DisplayPipeline pipeline)
        {
            var method = pipeline.GetType().GetMethod("GetLights");

            if (method == null)
            {
                if (_preSR3Lights == null)
                {
                    // just mimic the default light
                    var light = new Rhino.Geometry.Light();
                    light.LightStyle      = Rhino.Geometry.LightStyle.CameraDirectional;
                    light.Direction       = new Rhino.Geometry.Vector3d(1, -1, -3);
                    light.ShadowIntensity = 0.7;
                    _preSR3Lights         = new Rhino.Geometry.Light[] { light };
                }
                return(_preSR3Lights);
            }
            var lights = method.Invoke(pipeline, null) as Rhino.Geometry.Light[];

            return(lights);
        }
Exemplo n.º 21
0
        private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
        {
            if (DrawUtil.DrawInfo)
            {
                if (_infoPanel == null)
                {
                    _infoPanel = new InfoPanel();
                    _infoPanel.Positions.Add(Value.PointAtNormalizedLength(0.5));

                    _infoPanel.Content.Add("LC: " + LoadCase);
                    if (!Forces.IsTiny())
                    {
                        _infoPanel.Content.Add("Force: " + Forces.Length);
                    }
                    if (!Moments.IsTiny())
                    {
                        _infoPanel.Content.Add("Moment: " + Moments.Length);
                    }
                }
                _infoPanel.Draw(pipeline, viewport);
            }
        }
Exemplo n.º 22
0
        private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
        {
            if (DrawUtil.DrawInfo)
            {
                if (_infoPanel == null)
                {
                    _infoPanel = new InfoPanel();
                    var amp = AreaMassProperties.Compute(Value);
                    _infoPanel.Positions.Add(Value.ClosestPoint(amp.Centroid));

                    _infoPanel.Content.Add("LC: " + LoadCase);
                    if (!Forces.IsTiny())
                    {
                        _infoPanel.Content.Add("Force: " + Forces.Length);
                    }
                    if (!Moments.IsTiny())
                    {
                        _infoPanel.Content.Add("Moment: " + Moments.Length);
                    }
                }
                _infoPanel.Draw(pipeline, viewport);
            }
        }
Exemplo n.º 23
0
 private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
 {
     if (DrawUtil.DrawInfo)
     {
         if (_infoPanel == null)
         {
             _infoPanel = new InfoPanel();
             if (Value.IsACurve)
             {
                 _infoPanel.Positions.Add(Value.CurveA.PointAtNormalizedLength(0.5));
             }
             else
             {
                 _infoPanel.Positions.Add(Value.PointA.Location);
             }
             if (GroupId != 0)
             {
                 _infoPanel.Content.Add("Grp: " + GroupId);
             }
             _infoPanel.Content.Add("Stf: " + Axial_stiffness + " / " + Rotational_stiffness + " / " + Transversal_stiffness);
         }
         _infoPanel.Draw(pipeline, viewport);
     }
 }
Exemplo n.º 24
0
 private void drawInfoPanel(Rhino.Display.DisplayPipeline pipeline, Rhino.Display.RhinoViewport viewport)
 {
     if (DrawUtil.DrawInfo)
     {
         if (_infoPanel == null)
         {
             _infoPanel = new InfoPanel();
             _infoPanel.Positions.Add(Value.PointAtNormalizedLength(0.5));
             if (Id != 0)
             {
                 _infoPanel.Content.Add("Id: " + Id);
             }
             if (GroupId != 0)
             {
                 _infoPanel.Content.Add("Grp: " + GroupId);
             }
             if (SectionIdStart != 0)
             {
                 _infoPanel.Content.Add("Sec: " + SectionIdStart + (SectionIdEnd == 0 || SectionIdStart == SectionIdEnd ? "" : "." + SectionIdEnd));
             }
         }
         _infoPanel.Draw(pipeline, viewport);
     }
 }
Exemplo n.º 25
0
 public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col)
 {
     pipeline.DrawCurve(crv, col, 2);
 }
Exemplo n.º 26
0
 public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col)
 {
     pipeline.DrawPatternedLine(_line, col, 0x00110101, 3);
 }
Exemplo n.º 27
0
 public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col)
 {
     pipeline.DrawArrow(_line, col, 0.0, 0.2);
 }
Exemplo n.º 28
0
            public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col, bool shaded)
            {
                if (_fixationSymbol.Vertices.Count > 0)
                {
                    if (shaded)
                    {
                        pipeline.DrawMeshShaded(_fixationSymbol, _material);
                    }
                    else
                    {
                        pipeline.DrawMeshWires(_fixationSymbol, col);
                    }
                }

                if (_cube.Vertices.Count > 0)
                {
                    if (shaded)
                    {
                        pipeline.DrawMeshShaded(_cube, _material);
                    }
                    else
                    {
                        pipeline.DrawMeshWires(_cube, col);
                    }
                }

                if (_momentSymbol.IsValid)
                {
                    if (shaded)
                    {
                        pipeline.DrawBrepShaded(_momentSymbol, _material);
                    }
                    else
                    {
                        pipeline.DrawBrepWires(_momentSymbol, col, -1);
                    }
                }

                if (_freePositionLines.Count > 0)
                {
                    if (shaded)
                    {
                        foreach (Line l in _freePositionLines)
                        {
                            pipeline.DrawLine(l, col);
                        }
                    }
                    else
                    {
                        foreach (Line l in _freePositionLines)
                        {
                            pipeline.DrawLine(l, col, 3);
                        }
                    }
                }

                if (_momentLines.Count > 0)
                {
                    if (shaded)
                    {
                        foreach (Line l in _momentLines)
                        {
                            pipeline.DrawLine(l, col);
                        }
                    }
                    else
                    {
                        foreach (Line l in _momentLines)
                        {
                            pipeline.DrawLine(l, col, 3);
                        }
                    }
                }
            }
Exemplo n.º 29
0
 public void Draw(Rhino.Display.DisplayPipeline pipeline, System.Drawing.Color col)
 {
     pipeline.DrawArc(_arc, col);
     pipeline.DrawArrowHead(_arrowPoint, _arrowDir, col, 0.0, _arc.Radius * 0.2);
 }
Exemplo n.º 30
0
        /***************************************************/
        /**** Public Methods  - Curves                  ****/
        /***************************************************/

        public static void RenderWires(BHG.Arc arc, Rhino.Display.DisplayPipeline pipeline, Color bhColour)
        {
            pipeline.DrawArc(arc.ToRhino(), bhColour, 2);
        }