예제 #1
0
surf.degree_u = 3
surf.degree_v = 3

# Set control points
surf.set_ctrlpts(
    *exchange.import_txt("../ex_surface01.cpt", two_dimensional=True))

# Set knot vectors
surf.knotvector_u = [0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 3.0, 3.0, 3.0]
surf.knotvector_v = [0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 3.0, 3.0, 3.0]

# Set sample size
surf.sample_size = 35

# Set surface tessellation component
surf.tessellator = tessellate.TrimTessellate()

# Set visualization component
visconf = vis.VisConfig(ctrlpts=False, legend=False)
surf.vis = vis.VisSurface(config=visconf)

# Generate a circular trim curve
tcrv = analytic.Circle(origin=(0.5, 0.5), radius=0.25)
tcrv.opt = ['reversed', 1]
trim_curves = [tcrv]

# Set trim curves (as a list)
surf.trims = trim_curves

# Visualize surface
# surf.render()
예제 #2
0
trim1.ctrlpts = ((1, 0), (0.95, 0.5), (1, 1), (0, 1), (0.05, 0.5), (0, 0), (1,
                                                                            0))
trim1.knotvector = knotvector.generate(trim1.degree, trim1.ctrlpts_size)
trim1.delta = 0.001
trim1.opt = ['reversed', 1]
# operations.scale(trim1, 0.5, inplace=True)

trim2 = deepcopy(trim1)
trim2.opt = ['reversed', 0]

# Add trim to surface 1
surf1.trims = [trim1]

# Add trim to surface 3
surf3.trims = [trim2]

# Visualize all surfaces
mult = multi.SurfaceContainer(surf1, surf2, surf3)
mult.sample_size = 30
mult.tessellator = tessellate.TrimTessellate()

# Show trim curves but don't show control points
vis_conf = vis.VisConfig(trims=True, ctrlpts=False)
mult.vis = vis.VisSurface(vis_conf)

# Render with colors
# mult.render(evalcolor=["steelblue", "red", "green"])

from geomdl import exchange
exchange.export_json(mult, "mult.json")