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.

Error using booleanBodies with API

Chris_TiltonChris_Tilton Member Posts: 10
Hi All, I am trying to use the API to create a boolean, right now I am using a simple model of three spheres and I am trying to combine them. Below is my API call, using the booleanBodies function (the namespace I am using is my own copy of the standard library), and the API explorer keeps returning an error. I have included my API call and the corresponding error below.
<pre><code><pre><code>{"feature": {"type": 134, "typeName": "BTMFeature", "message": {"featureType": "booleanBodies", "name": "SnowmanBooleanUnion", "namespace": "d2af92bf969176a0558f5f9c7::vfa91e58a301e3c528465aa9e::ef2a8e8694c7f33ac3780bbe7::mf5049db7fc147c343877597", "parameters": [{"type": 145, "typeName": "BTMParameterEnum", "namespace": "d2af92bf969176a0558f5f9c7::vfa91e58a301e3c528465aa9e::ef2a8e8694c7f33ac3780bbe7::mf5049db7fc147c343877597", "message": {"value": "UNION", "enumName": "BooleanOperationType", "parameterId": "operationType"}}, {"type": 148, "typeName": "BTMParameterQueryList", "message": {"queries": [{"type": 138, "typeName": "BTMIndividualQuery", "queryString": "query=qCompressed(1.0,\"%B5$QueryM5S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA2C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6.6$FlLA0lyFq1sAHQg_0sketchwireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdS5$line1C0M5R4R5R6R7R8RaRbRcRdS4$arc1R4C6S4$BODYR6R7R8CbA1S-c.7.9$revolveopRevolveRbSa$SWEPT_BODY\",id);"}, {"type": 138, "typeName": "BTMIndividualQuery", "queryString": "query=qCompressed(1.0,\"%B5$QueryM5S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA2C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6.6$F2lgu5fXwtM3s6e_1sketchwireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdS5$line1C0M5R4R5R6R7R8RaRbRcRdS4$arc1R4C6S4$BODYR6R7R8CbA1S-c.7.9$revolveopRevolveRbSa$SWEPT_BODY\",id);"}, {"type": 138, "typeName": "BTMIndividualQuery", "queryString": "query=qCompressed(1.0,\"%B5$QueryM5S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA2C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6.6$FPFH3QRyfzxSr9o_2sketchwireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdS5$line1C0M5R4R5R6R7R8RaRbRcRdS4$arc1R4C6S4$BODYR6R7R8CbA1S-c.7.9$revolveopRevolveRbSa$SWEPT_BODY\",id);"}], "parameterId": "tools"}}]}}}API CALL BODY

ERROR FROM RESPONSE

<pre class="CodeBlock"><code>{ "moreInfoUrl": "", "message": "Feature has invalid type", "code": 9999, "status": 400 }

Comments

  • Paul_J_PremakumarPaul_J_Premakumar Member, Onshape Employees Posts: 214
    Hi Chris,

     You may want to check the "type" value, it should be "BTMFeature-134" , I see you are passing 134. We have some examples here https://onshape-public.github.io/docs/api-adv/featureaccess/#create-a-cube-feature

    Hope that helps,
    Paul
  • Chris_TiltonChris_Tilton Member Posts: 10
    Hi Paul,
    Thank you for the help, although the syntax I’m using here works perfectly for a cube or sphere feature in my experience, even with passing the type and typeName separately. I’ll check out the examples though and see if I can find anything.
  • Caden_ArmstrongCaden_Armstrong Member Posts: 177 PRO
    Is there a reason you are copying the entire standard code and referencing that?
    All of the imports in your copy are still pointing towards the actual Onshape standard code, its going to be a real mess for namespaces.

    Does the API call work with all of the namespaces removed (ie pointing at the actual standard code).

    Another thing that seems different is that you are missing some parameters in the POST /features endpoint:
    If you look at the request in glassworks, vs what you've posted.
    {
      "btType": "string", -> required
      "feature": {...feature code...}
      "libraryVersion": 0,
      "microversionSkew": true,
      "rejectMicroversionSkew": true,
      "serializationVersion": "string", -> required
      "sourceMicroversion": "string" -> required
    }
    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • Chris_TiltonChris_Tilton Member Posts: 10
    Hey Caden,

    The API call doesn’t seem to work when I use it without a namespace, no idea why but it doesn’t seem to know where to look for features like fSphere etc when I don’t have a namespace. I’ll definitely try including some of the other required fields, thanks so much for your help!
  • Chris_TiltonChris_Tilton Member Posts: 10
    Still not working even with the other fields, it must be something wrong with another part of the structure of the call. If anyone has any more ideas feel free to let me know.
Sign In or Register to comment.