@OPPATTERN: INVALID_INPUT

nir_naron
nir_naron Member Posts: 26 EDU

Trying to duplicate a user-selected line. No idea why these two Featurescripts attached below aren't working.

@NeilCooke HELP!


Also, side questions:

1) What's the best way to have the pattern be perpendicular to the line? Currently they're in the same direction. I was hoping to be able to go <evvLine.direction.normal> though it seems like that's not the way it works.

2) How do I get <selctedLine>'s start-point and end-point? The start-point is <evvLine.origin> but I'm not sure about the end-point.

Thanks!

FeatureScript 2345; import(path : "onshape/std/common.fs", version : "2345.0"); annotation { "Feature Type Name" : "Pattern Line"} export const patternLine = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Select Line:", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 1 } definition.selectedLine is Query; } { const selectedLine = definition.selectedLine; debug(context, selectedLine); const evvLine = evEdgeTangentLine(context, { "edge" : selectedLine, "parameter" : 0 }); debug(context, evvLine); opPattern(context, id + "pattern1", { "entities" : selectedLine, "transforms" : [transform(evvLine.direction*inch)], "instanceNames" : ["Copy1"] }); }); // annotation { "Feature Type Name" : "Pattern Line Wierdly" } // export const patternLineWierdly = defineFeature(function(context is Context, id is Id, definition is map) // precondition // { // annotation { "Name" : "Select Line:", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 1 } // definition.selectedLine is Query; // } // { // const selectedLine = definition.selectedLine; // debug(context, selectedLine); // const evvLine = evEdgeTangentLine(context, { // "edge" : selectedLine, // "parameter" : 0 // }); // opExtractWires(context, id + "opExtractWires1", { // "edges" : selectedLine // }); // debug(context, qCreatedBy(id + "opExtractWires1", EntityType.EDGE)); // opPattern(context, id + "pattern1", { // "entities" : qCreatedBy(id + "opExtractWires1", EntityType.EDGE), // "transforms" : [transform(evvLine.direction*inch)], // "instanceNames" : ["Copy1"] // }); // });

Comments