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.

Pattern & Sweep (New Custom Feature!)

MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
edited February 2021 in FeatureScript

Pattern & Sweep

(New Custom Feature!)





How to add a custom feature to your toolbar:



Learn more about the Gospel of Christ  ( Here )

CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎

Comments

  • bruce_williamsbruce_williams Member, Developers Posts: 842 PRO
    wow!  very clever!!

    www.accuratepattern.com
  • PrachiPrachi Member, OS Professional Posts: 262 ✭✭✭
    dang. That's cool.
  • Marc_MillerMarc_Miller Member Posts: 110 ✭✭✭
    That's pretty cool.  And thank you for making a nice icon too!
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    Thanks guys, enjoy!




    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    Nice one, Michael! It's always great to see people solving their industry-specific challenges with automation like this. Someone over there should give you a raise for the time you're saving everyone.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    Thanks Evan!

    This one will save tons of time for those who do panels and walls. The example room took me about an hour with these tools due to my indecision. Without these tools it probably would have taken 6 hours give or take some.

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • robert_scott_jr_robert_scott_jr_ Member Posts: 300 ✭✭✭
    That could be very useful. I played with a copy for about 15 minutes but couldn't comprehend the relationship between the profile sketch and the faces. I could not predict the outcome of applying the feature. - Scotty
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    @robert_scott_jr_ I have updated example 2 to show what the feature is doing behind the scenes. This should help you visualize it. 

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • robert_scott_jr_robert_scott_jr_ Member Posts: 300 ✭✭✭
    Thanks. Now that I unsupressed the second mate connector in the lower part of the feature tree that you exposed I could then see the relationship between the face and the profile sketch. How was that mate connector chosen/placed since I There is no indication that it even exists other than to unsupress it? - Scotty
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    edited February 2021
    @robert_scott_jr_
    There is a configuration button to show that folder, you shouldn't have to unsuppress anything manually.






    The profile origin mate can be selected from an existing mate, or created on the spot. To create it on the spot, press the mate button over to the right. You can manually adjust the orientation of the mate by pressing the tiny mate icon in the input box, or you can click the quick orientation buttons I placed below the Profile origin mate box. The quick adjuster buttons are very helpful for this feature.





    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @MichaelPascoe
    Could you use opExtractSurface[1] instead of fill, when getting the faces for transforming?

    That means that faces with inner loops will work.

    [1]: Onshape
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    @MBartlett21 Thanks, I was wondering how to do that. That will probably be much more efficient.

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    edited April 2021


    UPDATE!

    Note, when using profiles from a different studio:

    • Profiles from a different studio will require a surface instead of a sketch or face. 
    • Profile will be oriented based on the world origin of the profile's studio.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    cool! Pretty sure I referenced Neil's Beams feature for mine. 
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    edited September 2021
    I was working on 4 story stairs today and kept having to derive profiles and sweep them along a single curve. This update will save time for applications that require derives and standard sweeps. 

    Update!

    • New mode: sweep along curve (like the standard sweep)


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    Cool functionality, Michael! any reason to not just make it as a single query param for all of the curves, and generate the start origins your need at the ends of the curves? I'm not sure if this is the best way or not, but I've had luck with batch sweeping like this by grouping curves into contiguous chains using opExtractWires(), then just finding a plane at the end of the path like so:
            opExtractWires(context, id + "opExtractWires", { "edges" : inputCurves });
    
            var compositeCurves = qCreatedBy(id + "opExtractWires", EntityType.BODY);
            
            forEachEntity(context, id + "makeWires", compositeCurves, function(curve is Query, id is Id)
                {
                    var curves = dissolveWires(curve);
                    var path = constructPath(context, curves);
                    var start = evPathTangentLines(context, path, [0]).tangentLines[0];
                    var startOrigin = start.origin;
                    var startNormal = start.direction;
                    var startPlane = plane(startOrigin, startNormal);
                    var sketch = newSketchOnPlane(context, id + "sketch", { "sketchPlane" : startPlane });
                    skCircle(sketch, "circle", {
                                "center" : vector(0, 0) * inch,
                                "radius" : definition.diameter / 2
                            });
                    skSolve(sketch);
    
                    var profile = qEntityFilter(qCreatedBy(id + "sketch"), EntityType.FACE);
    
                    // sweep the wire body
                    opSweep(context, id + "sweep", {
                                "profiles" : profile,
                                "path" : qUnion(path.edges)
                            });
    
                    var wireBody = qCreatedBy(id + "sweep", EntityType.BODY);
               }

    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    @Evan_Reese
    Thanks for the input! Great idea, it would be a lot faster depending on the situation. I didn't choose the best example, but the reason I have the inputs in an array is so that you can do multiple complex sweeps. Lol, then I went and showed 4 straight simple lines... It would be good to have something like your code inside each sweep input in the array. This way if you want to sweep 4 straight lines, you only have to select the orientation once then click all 4 lines.

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
Sign In or Register to comment.