Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

how to use `queryString` in feature data?

jiahao_lee103jiahao_lee103 Member Posts: 3 EDU

I want to parse a CAD parameter data, including sketch, extrude, and chamfer, etc. I first got the feature data, and it seems that the queryString in it can help me get further information. But now I don’t know how to use queryString, can anyone help me? Thank you

  "featureType": "newSketch", 
"btType": "BTMSketch-151",
"name": "sketch 1",
"parameters": [
{
"parameterId": "sketchPlane",
"btType": "BTMParameterQueryList-148",
"nodeId": "a7bB5R7tCP5eJY5k",
"queries": [
{
"queryString": "query=qCompressed(1.0,\"%B5$QueryM4Sa$entityTypeBa$EntityTypeS4$FACESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S5.7$FrontplaneOpS9$queryTypeS5$DUMMY\",id);",
"deterministicIds": [],
"btType": "BTMIndividualQuery-138",
"queryStatement": null,
"nodeId": "Fda2kzMXm7a2y1P"
}
] …

I tried to use queryString in the following way, but failed:

body = {
"script":
"function(context is Context, queries) { "
" var q = qCompressed(1.0,\"%B5$QueryM4Sa$entityTypeBa$EntityTypeS4$FACESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S5.7$FrontplaneOpS9$queryTypeS5$DUMMY\",id);"
" var res = evaluateQuery(context, q);"
" return res;"
"}"
}
res = self._api.request('post', '/api/v10/partstudios/d/' + did + '/w/' + wid + '/e/' + eid + '/featurescript',
body=body)
json_data = res.json()['result']

Sign In or Register to comment.