def build_vis(obj, **kwargs): """ Prepares visualization module for the input spline geometry. :param obj: input spline geometry object :return: spline geometry object updated with a visualization module """ vis_config = VisMPL.VisConfig(**kwargs) if isinstance(obj, (NURBS.Curve, multi.CurveContainer)): if obj.dimension == 2: obj.vis = VisMPL.VisCurve2D(vis_config) elif obj.dimension == 3: obj.vis = VisMPL.VisCurve3D(vis_config) else: raise RuntimeError("Can only plot 2- or 3-dimensional curves") if isinstance(obj, (NURBS.Surface, multi.SurfaceContainer)): obj.vis = VisMPL.VisSurface(vis_config) if isinstance(obj, (NURBS.Volume, multi.VolumeContainer)): obj.vis = VisMPL.VisVolume(vis_config) return obj
# Get the control points from the generated grid surf04.ctrlpts2d = sg04.grid # Set knot vectors surf04.knotvector_u = utilities.generate_knot_vector(surf04.degree_u, surf04.ctrlpts_size_u) surf04.knotvector_v = utilities.generate_knot_vector(surf04.degree_v, surf04.ctrlpts_size_v) # Construct the parametric volume with a uniform knot vector pvolume = construct.construct_volume('w', surf01, surf02, surf03, surf04, degree=2) # Visualize volume pvolume.vis = vis.VisVolume(vis.VisConfig(ctrlpts=True, evalpts=False)) pvolume.render() # Knot vector refinement operations.refine_knotvector(pvolume, [1, 1, 1]) # Visualize volume after knot insertions pvolume.render() # Good to have something here to put a breakpoint pass