@@ -423,7 +423,7 @@ def previewPoints(self, rpc_params: RpcParams) -> None:
423423 for i , pt in enumerate (points_data ):
424424 self ._preview_points .InsertNextPoint (pt .x , pt .y , pt .z )
425425 self ._preview_verts .InsertNextCell (1 , [i ])
426- if style_name == "curve" and i == 0 :
426+ if style_name in [ "curve" , "surface" ] and i == 0 :
427427 colors .InsertNextTuple3 (60 , 153 , 131 )
428428 else :
429429 colors .InsertNextTuple3 (102 , 102 , 102 )
@@ -432,11 +432,20 @@ def previewPoints(self, rpc_params: RpcParams) -> None:
432432 self ._preview_polydata .GetPointData ().SetActiveScalars ("Colors" )
433433
434434 lines = vtkCellArray ()
435+ polys = vtkCellArray ()
435436 if style_name == "curve" :
436437 for i in range (len (points_data ) - 1 ):
437438 lines .InsertNextCell (2 , [i , i + 1 ])
438439 if params .closed and len (points_data ) >= 2 :
439440 lines .InsertNextCell (2 , [len (points_data ) - 1 , 0 ])
441+ elif style_name == "surface" :
442+ for i in range (len (points_data ) - 1 ):
443+ lines .InsertNextCell (2 , [i , i + 1 ])
444+ if len (points_data ) >= 3 :
445+ lines .InsertNextCell (2 , [len (points_data ) - 1 , 0 ])
446+ polys .InsertNextCell (len (points_data ), list (range (len (points_data ))))
447+
440448 self ._preview_polydata .SetLines (lines )
449+ self ._preview_polydata .SetPolys (polys )
441450 self ._preview_polydata .Modified ()
442451 self .render (- 1 )
0 commit comments