Hi Martin,
> How do I persuade the above script to chamfer just one end?
You'll need to have a sub-object of the brep object to be the input into the chamfer command.
The way chamfer works (you can just use the command to check it out) is that if you have a whole object selected it will chamfer all sharp edges that it can find in the object. If you want to limit the chamfer to only one edge you can select either that edge or a face - selecting a face will target all the edges that belong to the face.
You can access a brep's sub-objects by calling the .getEdges() or .getFaces() methods on the brep object, these return object lists.
Right now with your current script snippet there, it looks like you've got the brep as the current selected object. So you'll need to extract the brep from the "object list" of the selected objects, get the edge or face that you want and then put that edge or face into a new object list and then set that as the input into chamfer.
Then with chamfer being given a face or edge sub-object it will then limit the chamfer to that particular area.
So it would look something like this (untested, may have typos):
// Get the cylinder brep object out of the selected object list.
var sel_list = moi.geometryDatabase.getSelectedObjects();
var cyl = sel_list.item(0);
// Get the first edge of the cylinder.
var cyl_edges = cyl.getEdges();
var first_edge = cyl_edges.item(0);
// Build a new object list with that edge in it.
var chamfer_list = moi.geometryDatabase.createObjectList();
chamfer_list.addObject( first_edge );
// Give the factory the object list with the edge in it as its input.
factory.setInput( 0, chamer_list );
- Michael
|