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.

opBoolean fails with invalid input

brad_phelanbrad_phelan Member Posts: 80 ✭✭
I'm developing my autoRib feature at


The cylinder is the original part and the rectangular box is a solid generated half way through the script. I wish to opBoolean::Intersect these two. However opBoolean fails with INVALID_INPUT and I am mystified as to why.

I have tried to make the code robust by ensuring only solids go to the opBoolean operation.

    var qr0 = qBodyType(qCreatedBy(id, EntityType.BODY), BodyType.SOLID);
    var qr1 = qBodyType(entities, BodyType.SOLID);
    var qq = qUnion([qr0,qr1]);
    // This outputs 1 Solid and 1 Face (weird)
    opBoolean(context, id + "boolean1", {
            "tools" : qq ,
            "operationType" : BooleanOperationType.INTERSECTION

however debug outputs

Query resolves to 1 bodies, 1 faces

If I do an opDelete on qq then the cylinder and the box are removed.

What could be going wrong.

Source code for opRibFromPlane is at



  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,019 ✭✭✭✭✭
    in line 84 you have: var qr0 = qBodyType(qCreatedBy(id, EntityType.BODY), BodyType.SOLID);
    possibly you need: var qr0 = qBodyType(qCreatedBy(id + "extrude1", EntityType.BODY), BodyType.SOLID);

  • brad_phelanbrad_phelan Member Posts: 80 ✭✭
    My fault.

    I had passed in a face to the function ( as selected in the feature ) instead of a part.

    However why does

       var qr1 = qBodyType(entities, BodyType.SOLID);

    still return a result in the query.
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,019 ✭✭✭✭✭
    by the way I finaly managed to do unfold feature for developable extracted surfaces
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,578
    edited August 2017
    Hi @brad_phelan ,

    qBodyType doesn't do what you're expecting it to do.  qBodyType(query, BodyType.SOLID) will query for all entities of 'query' that are either a) solid bodies or b) belong to solid bodies.  So, as long as your selected face belonged to a solid body it would bass the body type test.

    I think the query you're looking for is:

    qEntityFilter(entities, EntityType.BODY)
    qBodyType(qEntityFilter(entities, EntityType.BODY), BodyType.SOLID)
    if you want to be extra careful about only getting solid bodies.

    Also, just as a FeatureScript note, your utility functions (fPatternPlanes, fBoundingPlanes, opRibFromPlane, etc) don't need to be 'export'ed unless you want to use them in another FeatureScript file, and don't need an 'annotation {}' at all. You can use 'print(...)' or 'println(...)' instead of 'debug(...)' if you want to print strings or see the content of variables that aren't 'Query's.

    Edit: I would also try to avoid using dummyQuery.  It looks like what you're trying to do can be accomplished with 'qCreatedBy(...)'
    Jake Rosenfeld - Modeling Team
  • brad_phelanbrad_phelan Member Posts: 80 ✭✭
    @konstantin_shiriazdanov yay. I'll check that out soon.

    @Jake_Rosenfeld thanks for those tips. I'll fold the advice in.
Sign In or Register to comment.