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.
Getting sketches 3 characters geometryIds through API
guillauem_d
Member Posts: 16 ✭
Hello !
I'm trying to create circular holes on my part using the API.
To do this, i first created the sketch then the extrusion manually and analyzed extrusion .json using feature list :
I'm guessing "geometryIds": ["JRC"] is the id of the sketch that is being extruded.
Now i'd like to do this programmatically but i don't know how to find the sketch geometryIds, the only thing I find when creating a circular sketch through the API is '"entityId" : "jpUy8ZpUH4Uy", I tried using this as a geometryIds but it doesn't work.
How am I suppoed to find this the sketches 3 characters geometryIds ?
Thank you in advance !
I'm trying to create circular holes on my part using the API.
To do this, i first created the sketch then the extrusion manually and analyzed extrusion .json using feature list :
{
"type": 148,
"typeName": "BTMParameterQueryList",
"message": {
"queries": [
{
"type": 138,
"typeName": "BTMIndividualQuery",
"message": {
"geometryIds": ["JRC"],
"hasUserCode": false,
"nodeId": "F5vRpYBhnhF3bwB"
}
}
],
"parameterId": "entities",
"hasUserCode": false,
"nodeId": "e/OW31rYeHDO6RYo"
}
},
I'm guessing "geometryIds": ["JRC"] is the id of the sketch that is being extruded.
Now i'd like to do this programmatically but i don't know how to find the sketch geometryIds, the only thing I find when creating a circular sketch through the API is '"entityId" : "jpUy8ZpUH4Uy", I tried using this as a geometryIds but it doesn't work.
How am I suppoed to find this the sketches 3 characters geometryIds ?
Thank you in advance !
0
Answers
You could do it differently and just make a query for your sketch and pass that into the extrude feature without needing to know the geometry IDs. It's not super well documented on how to do that.
Or you could get the geometry IDs and mimic how Onshape does it.
You'll need to use the evaluateFeaturescript endpoint to run some featurescript in order to get the query and then the transient Id of the faces and edge.
But the more important question, why are you using the API to put holes in a part. That sounds like something better suited for featurescript. Featurescript is great at modifying geometry.
Custom FeatureScript and Onshape Integrated Applications
I could learn featurescript, but I need to execute the command remotely trough API calls, and if i'm not mistaken, I can't execute featurescript through API calls ?
For instance, I learned how to make a simple extruded square :
FeatureScript 1821;
This works fine, but it's not possible to execute thise through an API call right ? I tried pasting the code through a POST /partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/featurescript but that doesn't work
Its only used for getting information out of a part studio.
To modify a part studio with the api you need to add a feature to the feature tree.
https://cad.onshape.com/glassworks/explorer/#/PartStudio/addPartStudioFeature
This can either be a custom feature or an onshape built in feature.
But in this case the feature needs to exist in a feature studio in Onshape.
Custom FeatureScript and Onshape Integrated Applications