Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
working with FeatureList objects
adamohern
Member, OS Professional Posts: 216 PRO
I want to allow my user to select a previously created feature, then build something using that feature as an input. I assume I need to use a query for FeatureList objects, but I'm not sure how to handle them once I have them.
Let's say I have a feature called "VertexGenerator", and another called "LineGenerator" that accepts VertexGenerator features as inputs. How would I get the vertices generated by the selected VertexGenerator features for use in drawing the lines?
Let's say I have a feature called "VertexGenerator", and another called "LineGenerator" that accepts VertexGenerator features as inputs. How would I get the vertices generated by the selected VertexGenerator features for use in drawing the lines?
0
Comments
-
The feature list is a map from feature id to function. You can pass the feature id(s) to qCreatedBy.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc1
-
I imagined something along those lines. But how do I convert, say, "definition.instanceFunction" to a query or set of queries? Sorry, I get the concept, but I'm not clear on the mechanics.0
-
annotation { "Feature Type Name" : "Point out points" } export const show = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { 'Name' : 'Feature' } definition.f is FeatureList; } { var queries = []; for (var f in definition.f) queries = append(queries, qCreatedBy(f.key, EntityType.VERTEX)); const q = qUnion(queries); debug(context, q); });1 -
Ah, ok. So it's just a simple array of feature id's. Makes sense. Thanks!0
-
Not an array, it's a map: notice the "f.key" in the loop body.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0
-
Ah, right. Sorry, still getting used to this data model.0
-
Oh, come now. opPlanes return vertices at their corners!? This pseudo-bounded nature of planes is really bothersome. A plane is just an infinite plane. It does not have edges or corners. Sheesh.0


