algorithmic modeling for Rhino
I am drying to produce a custom preview for a component.
Therefor I did change the to Subs DrawViewportWires and DrawViewportMeshes.
When using the component, Rhino will write:
An error occured in the display pipeline @ xx:xx:xx(xxxms)
iThe DrawViewportWires only when loaded!
The DrawViewportMeshes always when the viewport is refreshed!
Any Idea?
Public Overrides Sub DrawViewportWires(ByVal args As Grasshopper.Kernel.IGH_PreviewArgs)
' MyBase.DrawViewportWires(args)-> Disabled because nothing to Display
If (Hidden) Then Return
For Each item As Rhino.Geometry.Circle In Circle
args.Display.DrawCircle(item, GC, 3)
Next
For Each item As Rhino.Display.Text3d In txt
args.Display.Draw3dText(item, GC)
Next
End Sub
Public Overrides Sub DrawViewportMeshes(ByVal args As Grasshopper.Kernel.IGH_PreviewArgs)
' MyBase.DrawViewportMeshes(args) -> Disabled because nothing to Display
If (Hidden) Then Return
Dim Brep As Rhino.Geometry.Brep
Dim M As Rhino.Display.DisplayMaterial
For i As Integer = 0 To Circle.Count
Brep = Rhino.Geometry.Brep.CreatePlanarBreps(Circle.Item(i).ToNurbsCurve())(0)
M = New Rhino.Display.DisplayMaterial(VC.Item(Math.Min(i, VC.Count - 1)))
args.Display.DrawBrepShaded(Brep, M)
Next
End Sub
Tags:
Hi Richard,
have you set up your project so you can debug into it? If so, put a breakpoint on the first lines in DrawViewportMeshes and DrawViewportWires and step through the code until it fails.
Things that might be causing the error are (at first sight):
Also, it's not a good idea to perform heavy computation inside the drawing routines. CreatePlanarBreps, ToNurbsCurve etc. all take a lot of cycles and you should cache or pre-compute the results. This will make it go much faster.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hallo David,
Thx for the replay.
Sometimes one should look over his code before asking... .
Had a for each loop before and then forgot about the -1
Well I could let the "solve instant" compute all the breps upfront and than just display them, but will that not use a lot of memory?
thx Richard
It will use more memory but less cycles.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
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