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.
Confusion over query (list).
jrs_spedley
Member Posts: 71 ✭✭
I only want to do a simple featurescript but I'm getting stuck with Queries.
I find Extrude is annoyingly selective on which edges it will extrude into surfaces. To get around it I want to loop through a 'query' of edges and extrude and thicken them individually, then form a union into a single part. e.g. like a sketch of a spider's web.
The problems is when I try to loop through the query using "for (var edge in edges)" it often fails because 'edge' isn't an EDGE.
I've tried to use qEntityFilter but then I just get the whole previous query wrapped in another qEntityFilter query.
Am I missing something here, is a query just an array of key:value pairs where 'value' can be another list of key:value pairs?
Here is the basic output ...
I find Extrude is annoyingly selective on which edges it will extrude into surfaces. To get around it I want to loop through a 'query' of edges and extrude and thicken them individually, then form a union into a single part. e.g. like a sketch of a spider's web.
The problems is when I try to loop through the query using "for (var edge in edges)" it often fails because 'edge' isn't an EDGE.
I've tried to use qEntityFilter but then I just get the whole previous query wrapped in another qEntityFilter query.
Am I missing something here, is a query just an array of key:value pairs where 'value' can be another list of key:value pairs?
Here is the basic output ...
for (var edge in definition.edges) println(edge); outputs ... { key : queryType , value : UNION } { key : subqueries , value : [ { entityType : EDGE , historyType : CREATION , operationId : [ F3jrPebnT9OxNT9_0.wireOp ] , queryType : SKETCH_ENTITY , sketchEntityId : 2fa71c56-ffcc-4f50-be0c-e0d57dd11eba } , { entityType : EDGE , historyType : CREATION , operationId : [ F3jrPebnT9OxNT9_0.wireOp ] , queryType : SKETCH_ENTITY , sketchEntityId : 8f7c92d3-5654-4301-92fe-92ca18b45d8c } ] } but what I [think I] want is ... { entityType : EDGE , historyType : CREATION , operationId : [ F3jrPebnT9OxNT9_0.wireOp ] , queryType : SKETCH_ENTITY , sketchEntityId : 2fa71c56-ffcc-4f50-be0c-e0d57dd11eba } { entityType : EDGE , historyType : CREATION , operationId : [ F3jrPebnT9OxNT9_0.wireOp ] , queryType : SKETCH_ENTITY , sketchEntityId : 8f7c92d3-5654-4301-92fe-92ca18b45d8c }I'm actually going slightly insane now !!!!
0
Comments
https://cad.onshape.com/FsDoc/library.html#module-query.fs
I've bolded, which I believe is problem in what you are trying to filter as I only have a snippet of your code and summary of what you are trying to do.
If you explain a bit more in detail, we may be able to help more with an approach to writing your FeatureScript
Thanks.
P.S. it also clears up what a query is, it isn't the result you want but the way to get the result you want. Much like database access. I suppose you can create complex queries and then internally onshape can simplify them or buffer calculations to produce more efficient results.