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.

Options

Boolean_Bad_Input error

daniel_cravensdaniel_cravens Member Posts: 29
This feature is intended to extrude pin snap connectors along a line between a 3d printed part and then use opboolean to join the pins to the male half and to subtract the pins from the female half. The first steps of creating the sketchplane, skline, skcircles, and extruding the pins works as expected. However, the opBoolean call is generating the following error. 

If I comment out the opboolean call, I can perform a boolean manually by selecting the extruded bodies and the malepart.  I'd appreciate any tips as to what I'm doing wrong. The full code follows. Thank you in advance for your help.

***

export const opPinSketches = defineFeature(function(context is Context, id is Id, definition is map)
    {
          
        var cutLines is array = evGetCutPoints(context, definition.edges, definition.pinCount);
        var sketchPlane0 = evOwnerSketchPlane(context, {
                "entity" : definition.edges
        });
        
        var extrudeDirection =  sketchPlane0.normal; 
        if (definition.flipped == true)
        {
            extrudeDirection *= -1;
        }
        debug(context, extrudeDirection);
        
        var i = 0;
        for (var pt in cutLines)
        { 
            
            opCreatePinSketch(context, id + "pins" + i, {   
                "sketchPlane" : sketchPlane0,
                "depth" : definition.depth,
                "tOriginPoint" : pt ,
                "pinDiameter" : definition.pinDiameter
                });
                        
            debug(context, qCreatedBy(id + "pins" + i, EntityType.FACE));          
           i += 1;       
        }  
        
        for (var i = 0; i < definition.pinCount; i += 1)
        {
            opExtrude(context, id + "extrude" + i, {
                    "entities" : qCreatedBy(id + "pins" + i, EntityType.FACE),
                    "direction" : extrudeDirection,
                    "endBound" : BoundingType.BLIND,
                    "endDepth" : definition.pinLength
            });           
        }
        
        for (var i = 0; i < definition.pinCount; i += 1)
        {      
            opBoolean(context, id + "addMale" + i, {
                "tools" : qUnion(qCreatedBy(id + "extrude" + i, EntityType.BODY), definition.maleBody),
                "operationType" : BooleanOperationType.UNION
            });
        }                           
    });  


Comments

  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,531
    Boolean Union is order specific and the first body is the parent. In your code you are adding the male body to the first pin so on the second loop the male body no longer exists. Swap the order of your qUnion. 
    Senior Director, Technical Services, EMEAI
  • Options
    daniel_cravensdaniel_cravens Member Posts: 29
    Ah, that makes sense and works! Thank you!!
Sign In or Register to comment.