User Tools

Site Tools


blog:how_to_create_a_driver_sketch

How to create a Driver Sketch

Using Expressions it is possible to create and use a simplified sketch to drive a more complex sketch The idea is to map the blue constraints of the driver to some red constraints in the driven sketch.

The driver is created as a hexagon (red)

The driven sketch is a shoe rib sketch from the Nurbs Workbench project (yellow).

import nurbswb
import nurbswb.createshoerib
nurbswb.createshoerib.run()

The mapping between the constraints is donme by related name lists

inputs=[ 
		'x0','y0',
		'x1','y1',
		'x2','y2',
		'x3','y3',
		'x4','y4',
		'x5','y5'
	]

outputs=[ 
		'p0X', 'p0Y',  
		'p2X', 'p2Y',
		'p4X', 'p4Y',
		'p8X', 'p8Y',
		'p12X', 'p12Y',
		'p14X', 'p14Y',
	]

The expression can be done by script this way

rc=target.setExpression('Constraints.'+outputs[i], source.Name+".Constraints."+inputs[i])

blog/how_to_create_a_driver_sketch.txt · Last modified: 2017/04/18 20:20 by freek