def letter_o(): outer = curve2d.full_circle(radius=10.0) operations.translate(outer, (2, 0), inplace=True) inner = curve2d.full_circle(radius=8.0) operations.translate(inner, (2, 0), inplace=True) letter = Multi.MultiCurve() letter.add([outer, inner]) return letter
def letter_i(): base = NURBS.Curve() base.degree = 3 base.ctrlptsw = [[1, 20, 1], [0, 10, 0.5], [0, 19, 1], [0, 10, 1], [0, 1, 1], [0, 0, 0.5], [1, 0, 1], [1, 0, 0.5], [2, 1, 1], [2, 10, 1], [2, 19, 1], [1, 10, 0.5], [1, 20, 1]] base.knotvector = utilities.generate_knot_vector(base.degree, len(base.ctrlpts)) hat = curve2d.full_circle(radius=1) operations.translate(hat, (1, 22), inplace=True) letter = Multi.MultiCurve() letter.add([base, hat]) return letter
# Set control points curve.ctrlpts = [[1.1, 1.1], [0.24, 1.1], [0.24, 1.1], [0.24, 0.49], [0.24, 0.49], [1.1, 0.49], [1.1, 0.49], [1.1, 1.1]] # Auto-generate knot vector curve.knotvector = knotvector.generate(curve.degree, curve.ctrlpts_size) # Translate original curve to generate 1st trim curve trim_curve1 = operations.translate(curve, (0.25, 0.25)) # Translate original curve to generate 2nd trim curve trim_curve2 = operations.translate(curve, (-0.75, -0.75)) # Generate a NURBS full circle from 9 control points circle = curve2d.full_circle(radius=0.15) # Translate circle operations.translate(circle, (0.5, 0.5), inplace=True) # Set evaluation deltas trim_curve1.delta = 0.01 trim_curve2.delta = 0.01 circle.delta = 0.01 # List of trim curves trim_curves = [trim_curve1, trim_curve2, circle] #################### # GENERATE SURFACE # ####################
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Examples for the NURBS-Python Package Released under MIT License Developed by Onur Rauf Bingol (c) 2018 """ from geomdl.shapes import curve2d from geomdl.visualization import VisMPL # Generate a NURBS full circle from 9 control points circle = curve2d.full_circle(radius=5.0) circle.sample_size = 50 # Render the circle and the control points polygon vis_config = VisMPL.VisConfig(ctrlpts=True, figure_size=[8, 8]) vis_comp = VisMPL.VisCurve2D(config=vis_config) circle.vis = vis_comp circle.render() # Good to have something here to put a breakpoint pass