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.

Updated custom feature: Fill pattern

NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,806
By popular request, I have reworked Fill pattern to allow closer packing of instances and borders, plus better performance and error handling.
https://cad.onshape.com/documents/57361ad4e4b00e5012c3857c

Caution:
When updating existing models to this latest version, the improved border detection will modify the number of instances. Either increase the value of "border" until the number of instances match, or better still, don't update the feature. You can always use the Compare tool to check for differences.
Senior Director, Technical Services, EMEA

Comments

  • Cary_BettenhausenCary_Bettenhausen Member Posts: 45 PRO
    You, sir, are a Wizard. Perfect, thanks.
  • EvanReeseEvanReese Member, Mentor Posts: 2,281 ✭✭✭✭✭
    woohoo!
    Evan Reese
  • AngleCAngleC Member, pcbaevp Posts: 10 PRO
    Does one have access to the # of instances created to assign to a variable or otherwise use in a calculation for total hole cross-sectional area?
  • Derek_Van_Allen_BDDerek_Van_Allen_BD Member Posts: 11 PRO

    Out of curiosity I was wondering what purpose this block of script is doing for error handling. I ran into a case where I had a hole pattern in a sheet metal part bounded by a sketch where edgesInFace was correctly evaluating before this snippet, but this bit of code turned edgesInFace into an empty query breaking the tool. Commenting this whole thing out fixes my case but I don't know if that opens me up to other bug cases.

    if (isQueryEmpty(context, qSketchFilter(definition.target, SketchObject.NO)))

         {
    
             edgesInFace = startTracking(context, {
    
                         "subquery" : edgesInFace,
    
                         "lastOperationId" : lastModifyingOperationId(context, edgesInFace) });
    
                        
    
             const sketchId = lastModifyingOperationId(context, last(evaluateQuery(context, edgesInFace)));
    
             edgesInFace = qIntersection(edgesInFace, qCreatedBy(sketchId));
    
         }
    
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,806

    There are 3 prerequisites for the pattern to work:

    • the seed faces must be within the target face or sketch
    • the sketch for the target face must come after the seed
    • the sketch for the target face must have imprinting turned on so that a face is created and the seed leaves an imprint

    That code is there to differentiate between the edges of the seed of the pattern and the edges of the target sketch face - otherwise any border offset would apply to the seed pattern edges as well and the result would be incorrect. The sketch used to bound the pattern must have imprinting enabled to create a face for the pattern and also create an imprint of the seed hole. If you have "disable imprinting" turned on then it won't work. This could be better with fewer prerequisites and better user feedback.

    Senior Director, Technical Services, EMEA
  • Derek_Van_Allen_BDDerek_Van_Allen_BD Member Posts: 11 PRO

    Ah that explains the issues we ran into with our original setup. We had imprinting disabled and the hole was generated after the sketch. Yeah that's a little unclear to the end user that there's an order of operations and imprinting requirement there. Interestingly by disabling imprinting and commenting out that block of code I am able to rearrange the hole to be generated before or after the sketch and it rebuilds identically between to the official version *provided you do have imprinting disabled*

    Is there a featurescript way to query whether a sketch was generated with imprinting enabled or not?

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,806
    edited 10:25AM

    To be honest, I probably never tested it with imprinting disabled (because at the time of first writing, it wasn't possible to disable imprinting). I guess the only way to test imprinting is the number of faces belonging to the sketch. I'll look into it.

    Senior Director, Technical Services, EMEA
Sign In or Register to comment.