-
Notifications
You must be signed in to change notification settings - Fork 2
/
featureList.fs
54 lines (46 loc) · 1.48 KB
/
featureList.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FeatureScript ✨; /* Automatically generated version */
// This module is part of the FeatureScript Standard Library and is distributed under the MIT License.
// See the LICENSE tab for the license text.
// Copyright (c) 2013-Present PTC Inc.
/** Support functions for feature lists (as used for featurePattern) */
import(path : "onshape/std/context.fs", version : "✨");
/**
* Parameter type for inputting a list of features, stored as a map from
* feature `Id` to feature function. For an example, see the `circularPattern`
* module.
*/
export type FeatureList typecheck canBeFeatureList;
/** Typecheck for [FeatureList] */
export predicate canBeFeatureList(value)
{
value is map;
for (var key, currentValue in value)
{
key is Id;
currentValue is function;
}
}
/**
* Takes a map from id to lambda to return it as type FeatureList
*/
export function featureList(features is map) returns FeatureList
{
return features as FeatureList;
}
/**
* Takes a context and a map whose keys are subfeature ids from that context.
* Returns the values from that map sorted in the order that the subfeatures
* were started.
*/
export function valuesSortedById(context is Context, idToValue is map) returns array
{
return @valuesSortedById(context, idToValue);
}
/**
* @internal
* Returns true if any features listed in idToValue is a sketch.
*/
export function containsSketch(context is Context, idToValue is map)
{
return @containsSketch(context, idToValue);
}