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.

Evaluate FeatureScript(Onshape Api). The TransientId for a newly created plane.

max_borshmax_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:
<pre class="CodeBlock"><code>{
  "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!

Answers

  • mbattistellombattistello Member, Developers Posts: 51 ✭✭
    I dont think you can use the FeatureScript API to create. Its only there to aid in querying existing features. I had tried something similar originally and API support said its not meant to create. You should use the Feature API directly and pass in json for that. Then you can query the existing features to get the Id and then use that to create your extrude.
Sign In or Register to comment.