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.

Sweep failed

tonvistonvis Member Posts: 31
Please can someone help me out.

I constructed  in mine opinion a good path and a good profile to sweep.
but this has not been accepted by  opSweep. I am trying everything for days without succes.
There must be a simple solution for it, but Ican't  find it.
Many thanks for any help.


Best Answer

  • tonvistonvis Posts: 31
    Accepted Answer

    Hi Owen,
    Thanks for your comments, I have the modifications done :smile:

    /** ************************************       @OwenSparks ; comments *********************************************
     *
     * */


                var spring_eyes = qUnion([
                        qCreatedBy(id + "sweep5", EntityType.BODY),
                        qCreatedBy(id + "sweep6", EntityType.BODY),
                        qCreatedBy(id + "sweep7", EntityType.BODY)
                    ]);
                // debug(context, spring_eyes); // Query resolves to 3 bodies


                opBoolean(context, id + "boolean1", {
                            "tools" : spring_eyes,
                            "operationType" : BooleanOperationType.UNION
                        });
                       
                /**  result:    assembly still has 3 individual parts -> need to group !
                 *             using   "operationType" : NewBodyOperationType.ADD, in opSweep is not doing as expected
                 *             making one part
                */

                /*
                   opDeleteBodies(context, id + "deleteBodies3", {
                   // "entities" : sketchEntityQuery(id + "sketch5", EntityType.EDGE, "cylinder1")
                   "entities" : qCreatedBy(id + "sketch5", EntityType.BODY)
                   });
                 */
                
                /**                opDeleteBodies 3  - why giving failure : @opDeleteBodies: DELETE_SELECT_PARTS ?
                 *           better not to  make sketch5  at line 266 ,  because it seems unnecessay for the helix.
                 *                                   this part will not anylonger been created
                 */

    Regards
    tonvis


Answers

  • jakeramsleyjakeramsley Member, Moderator, Onshape Employees, Developers Posts: 595
    Hi tonvis,



    I believe the issue you are running into is that there is a large discontinuity of curvature between the helix and the eye bends.  While you are using a circle as the profile and orientation shouldn't matter, circles are periodic with an internal beginning/end.  Sweep will try to make the circular surface continuous and at that point will twist nearly 90 degrees (most likely) causing self-intersections in the surface.  If you were to use something less symmetric, like a rectangle, you'd see how the profile twists as it goes along the curve.


    If you segment the spring into three separate sections, using the end-caps of the previous sweep, the orientation will restart with each sweep and be able to be stitched up with a boolean.  I've highlighted the 2nd sweep I used to help differentiate the three parts.

    Jake Ramsley

    Director of Quality Engineering              onshape.com
  • tonvistonvis Member Posts: 31
    Hi Jake,

    Thanks for your solution and quick reaction.
     My idea of sweep was: it always follows a given path and I was'nt aware off any such problems. My path was looking right ??
    Your comment is very helpfull I will try it out in featurescript.
    I could not findout this problem in the discussions on the forum, which is giving  me most information how to handle.

    Many thanks
    tonvis

    Also I thanks all members of the support team, who had assist me on various  problems.
  • tonvistonvis Member Posts: 31
    ttps://cad.onshape.com/documents/e962c03684a97b9568b92c37/w/dd893095a99b64b5e8c7e121/e/60291153b286f85b5f04debd

    Hi Jake,
    Your solution is workng OK in PartStudio, but I can't get it working in Featurescript where I need it.
     I get all kind of Failure messages.How to play with the definitions ?
    Can you please give a example how to use compositeCurve in Featurescript. All I can find is in PartStudio.
    Thanks for your time
    tonvisch

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,413
    @tonvis

    The composite curve doesn't actually do anything except group individual edges into a wire body.  It will not change the geometry, or the outcome of the operation.  It just makes the selection of the path easier, but in Jake's example, you would have the same result in the part studio if no composite curve was made, and you just selected all the edges in order.  In FeatureScript, you just need to pass all the edges you want to sweep over as the `path`.  As long as you make the geometric change that Jake mentions, it should work.
    Jake Rosenfeld - Modeling Team
  • tonvistonvis Member Posts: 31



    Hi Jake,
    If I selected all the edges in order.  In FeatureScript, I get a failure because of crossing wires from offset1 and offset2. Therefore looking at  compositeCurve giving me a solution.

    Trying following:

                // ----------------------------- trying compostite curve ----  @Jake Ramsly----------------------------------


                // ---------------- remove crossing wires --------------------------------------------------
                opDeleteBodies(context, id + "deleteBodies1", {
                            "entities" : sketchEntityQuery(id + "sketch7", EntityType.EDGE, "offset2")
                        });

                opDeleteBodies(context, id + "deleteBodies2", {
                            "entities" : sketchEntityQuery(id + "sketch7", EntityType.EDGE, "offset1")
                        });


                //----------------- get all edges from flat spiral with fillets -----------------------------------
                var flatPath = qLoopEdges(path2);
                //debug(context, flatPath); //Query resolves to 16 edges

                // ------------ obtain edges for curve1 -------------------------------------------------------------
                var edgeQuery_1 = sketchEntityQuery(id + "sketch7", EntityType.EDGE, "arc2"); //Query resolves to 1 edges --- arc2
                var edgeQuery_2 = qUnion([qNthElement(flatPath, 10)]); //Query resolves to 1 edges----- offset2 part
                var edgeQuery_3 = qUnion([qNthElement(flatPath, 14)]); //Query resolves to 1 edges----- fillet

                // --------------------------------- get curve1 for body of spring ---------------------------------
                var curve1 = compositeCurve(context, id + "curve1", {
                        "edges" : qUnion([
                                    edgeQuery_1,
                                    edgeQuery_2,
                                    edgeQuery_3
                                ])
                    });
                debug(context, curve1); // debug: undefined


                // ---------------------------------- get the face for sweep -------------------------------------------
                const sketch8 = newSketchOnPlane(context, id + "sketch8", {
                            "sketchPlane" : plane(vector(0 * mm, 0 * mm, offset_top), vector(0, 0, 1) * mm, vector(1, 0, 0) * mm)
                        });

                const cirkel5 = skCircle(sketch8, "circle5", {
                            "center" : vector(-radi, 0 * mm),
                            "radius" : d / 2
                        });

                skSolve(sketch8);

                //  ---------------------------------------- sweep for curve1 ------------------------------------------------
                opSweep(context, id + "sweep5", { // @opSweep: SWEEP_SELECT_PATH
                            "bodytype" : ToolBodyType.SOLID,
                            "operationType" : NewBodyOperationType.NEW,
                            "profiles" : qCreatedBy(id + "sketch8", EntityType.FACE),
                            "path" : curve1
                        });

    Here is still one more bug.
    Can you please have a look what is going wrong ?

    FeatureScript is really a great tool !
    Many thanks for your time. 
    tonvis

  • tonvistonvis Member Posts: 31


    Hi Jake,
    I got it all working in featurescript.
    Many thanks for the help from the support team

    tonvis

  • owen_sparksowen_sparks Member, Developers Posts: 2,455 PRO
    Great script :+1: and thanks for commenting the code, that extra time spent is great for folks gathering inspiration from your work.
    Looks like you still need to boolean the parts together and delete the initial cylinder?
    Cheers, Owen S.
    Production Engineer
    HWM-Water Ltd
  • tonvistonvis Member Posts: 31
    Accepted Answer

    Hi Owen,
    Thanks for your comments, I have the modifications done :smile:

    /** ************************************       @OwenSparks ; comments *********************************************
     *
     * */


                var spring_eyes = qUnion([
                        qCreatedBy(id + "sweep5", EntityType.BODY),
                        qCreatedBy(id + "sweep6", EntityType.BODY),
                        qCreatedBy(id + "sweep7", EntityType.BODY)
                    ]);
                // debug(context, spring_eyes); // Query resolves to 3 bodies


                opBoolean(context, id + "boolean1", {
                            "tools" : spring_eyes,
                            "operationType" : BooleanOperationType.UNION
                        });
                       
                /**  result:    assembly still has 3 individual parts -> need to group !
                 *             using   "operationType" : NewBodyOperationType.ADD, in opSweep is not doing as expected
                 *             making one part
                */

                /*
                   opDeleteBodies(context, id + "deleteBodies3", {
                   // "entities" : sketchEntityQuery(id + "sketch5", EntityType.EDGE, "cylinder1")
                   "entities" : qCreatedBy(id + "sketch5", EntityType.BODY)
                   });
                 */
                
                /**                opDeleteBodies 3  - why giving failure : @opDeleteBodies: DELETE_SELECT_PARTS ?
                 *           better not to  make sketch5  at line 266 ,  because it seems unnecessay for the helix.
                 *                                   this part will not anylonger been created
                 */

    Regards
    tonvis


Sign In or Register to comment.