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.

Cannot get linearPattern to work??

bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 109 PRO
I cannot get this to work for PatternType.FACE or PatternType.FEATURE. It works for PatternType.PART. It be something with how I pass my 'id +cbore1'. It does work if I allow the user to choose a instanceFunction and they choose another cbore outside of the featurescript. I have not tried to pass faces this way.

doc: https://cad.onshape.com/documents/649c5e76e2529519607ea91a/w/519e26b278912c150b334c95/e/b281c3657905275369e36d87

Here is code:

 //////Face
         linearPattern(context, id + "linearPattern1", {
                     "patternType" : PatternType.FACE,
                     "faces" : qCreatedBy(id + "cbore1", EntityType.FACE),
                     "directionOne" : qCreatedBy(newId() + "Right", EntityType.FACE),
                     "distance" : .5 * inch,
                     "instanceCount" : 3
                 });


        /////Feature
         linearPattern(context, id + "linearPattern1", {
                     "patternType" : PatternType.FEATURE,
                     "instanceFunction" : [id + "cbore1"],
                     "directionOne" : qCreatedBy(newId() + "Right", EntityType.FACE),
                     "distance" : 1.0 * inch,
                     "instanceCount" : 2
                 });

Any suggestions?

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    Inside a custom feature, you generally don't want to do a feature pattern -- a for loop is simpler and faster.
    As for face pattern, do:
    debug(context, qCreatedBy(id + "cbore1", EntityType.FACE))
    
    to see what your query is actually evaluating to.  I suspect the issue is there.
    When sharing for forum help, ideally, you'd make your document public and make a version -- otherwise we can't see the feature definitions and we can only see the doc with changes you've made since posting.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 109 PRO
    FYI: Here is the best I can get them to evaluate out (from a different doc). featureList throws an Typecheck error. The linearPattern works with definition.instantFunction. This, however, is from another feature.




    I am going to give up on this route and try a for loop. 

    Thanks

Sign In or Register to comment.