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.
The TransientId for a newly created plane. (Onshape API)
max_borsh
Member, Developers Posts: 14 ✭
Hi Everybody.
I want to create an extrude feature by using Onshape Api.
So, there is a great example at Depeloper portal (Feature list API -> Example 3).
But there is a way that describes how to create sketch on the pre-defined front plane. What about creating the custom one?
As far as I understand, I have to get the transientId by evaluating FeatureScript request and then use it while creating new sketch feature by passing this Id as parameter:
I want to create an extrude feature by using Onshape Api.
So, there is a great example at Depeloper portal (Feature list API -> Example 3).
But there is a way that describes how to create sketch on the pre-defined front plane. What about creating the custom one?
As far as I understand, I have to get the transientId by evaluating FeatureScript request and then use it while creating new sketch feature by passing this Id as parameter:
{ "feature" : { "type": 151, "typeName": "BTMSketch", "message": { "entities": [...], "constraints": [...], "parameters": [ { "type": 148, "typeName": "BTMParameterQueryList", "message": { "queries": [ { "type": 138, "typeName": "BTMIndividualQuery", "message": { "geometryIds": [ "JCC" // here it is ]... }So I tried to create a new plane through invoking evaluate FeatureScript request (sending a script) like this:
script = "function(context is Context, queries is map){ // I couldn't get Id as parameter. opPlane(context, id + "plane1", { "plane" : plane(vector(0, 0, 0) * inch, vector(0, 0, 1)), "width" : 10 * inch, "height" : 10 * inch }); return transientQueriesToStrings(evaluateQuery(context, qCreatedBy(id + "plane1", EntityType.FACE))); }",
But I couldn't get Id for this function. Is the way how can I get transientId for a newly created custom pane?
Same question about Determining Origin GeometryId for custom vector..
Thank you in advice!
Same question about Determining Origin GeometryId for custom vector..
Thank you in advice!
0
Comments
Hope this helps.
And last question:
What is the best practice to get the needed face of already created extrude feature(created via onshape api) and than create a new plane on this face?
For example, can I do something like thing described below?
-create extrude (like "Example 3" in "feature list" section)
-get upper face of this extrude;
-create sketch and extrude it.
Is there a way to get exactly upper face of all extrude features I created and to add new plane on it?
Maybe, I can use featureId or some info that onshape returns in response to the extrude feature creating?
Or have I to get an array of faces of the feature and to use specific one? (But how can I determine whith one I need?)
Thank you in advice!
If I understand your question correctly I think you are looking for qCapEntity(<featrueId>, false). This will give you all the faces at the end of an extrude feature. You can use true instead of false for the starting faces instead of the ending faces.
Good luck!
qEntityFilter(qCapEntity(<featrueId>, false), EntityType.FACE) to get faces only
But I hadn't done it yet..
Let me describe my algorithm:
- I've created extrude feature (going throw "Example 3") via onshape api.
- I got featureId from response (feature -> message -> featureId). As far as I understand this Id I have to use for qCapEntity. (let it be "FjEqUFlhNuPViCq_0")
- I sent evaluating FeatureScript request like this:
function(context is Context, queries){{ return transientQueriesToStrings(evaluateQuery(context, qEntityFilter(qCapEntity(newId() +
"FjEqUFlhNuPViCq_0", false), EntityType.FACE))); }or like this: but have "BTFSValueUndefined" or "array index 0 out of bounds" in response respectively. What am I doing wrong?
By the way, I tried the same functions in FeatureScript editor and they are working great! But I have one more question:
As far as I know, I have to determine the geometryId for the plane and the origin for new api request (for new sketch creating).
I can get upper face and its vertices:
But is there any way to get the center of this plane? (or to create the point with coordinates and get its transientId)
{ "console": "", "notices": [], "result": { "type": 1499, "typeName": "BTFSValueArray", "message": { "value": [], "typeTag": "" } }, "serializationVersion": "1.1.10", "sourceMicroversion": "03b2c38e6fe708899137ce87", "rejectMicroversionSkew": false, "microversionSkew": false, "libraryVersion": 483 }