algorithmic modeling for Rhino
Hello everybody,
I was trying to draw a dotted line and found the DisplayPipeline.DrawDottedLine method but the DisplayPipeline does not seem so easy to use. I found this in the help file:
The display pipeline calls events during specific phases of drawing During the drawing of a single frame the events are called in the following order.
[Begin Drawing of a Frame]
(...)
[End of Drawing of a Frame]
Could anybody make a little introduction about how this work? Any help would be much appreciated.
Thanks in advance!
Tags:
Hi Miguel,
where do you want to draw dotted lines from? From within a parameter or a component? From within a VB/C# script component? From elsewhere?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hello David,
Thanks for your reply.
I would like to draw the dotted line from within a c# script component.
It's always difficult using a DisplayPipeline, mostly because it's so hard to figure out when to draw and when not to draw your extra geometry. I attached a file that shows how to draw dotted lines, but there's many things that ought to be added to it.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
The first would be how to clear the visualization when the GH file is gone but I suppose it is not as easy as it seems!
I just changed the way scripts work in 0.9. Now the scripts actually derive from a class that has display logic build in, so it's much easier to draw your own geometry just when you need it. The new code (which won't work yet in your version) looks like this:
Dim m_lines As New List(Of Line)
Dim m_bounds As BoundingBoxPublic Overrides ReadOnly Property ClippingBox As BoundingBox
Get
Return m_bounds
End Get
End Property
Public Overrides Sub DrawViewportWires(ByVal args As IGH_PreviewArgs)
If (m_lines Is Nothing) Then Return
If (m_lines.Count = 0) Then Return
For Each line As Line In m_lines
args.Display.DrawDottedLine(line, Color.Black)
Next
End Sub
and it absolutely positively work all the time when the document is loaded and never when the document isn't, or when the Script component preview is off, or when the preview mode only does selected objects, or when the script component has been deleted from the document, etc. etc.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
All right, David.
That sounds great! Being able of using the display modes of GH easily is definetely very useful and a good way of improving GH.
I´ll try the code with the new version when it´s avalaible.
Thanks again for your help!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by