opExtrude opposite direction

john_mcclary
john_mcclary Member, Developers Posts: 4,117 PRO
edited April 2019 in FeatureScript
How can you set the opposite direction of opExtrude for a blind cut?

opExtrude(context, id + "extrude", {
                        "entities" : qCreatedBy(id + "slotSketch", EntityType.FACE),
                        "direction" : slotPointPlane.normal,
                        "endBound" : BoundingType.BLIND,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endDepth" : distance<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });

i see there is an opposite direction in extrude() but that just fails completely when i change opExtrude to extrude

Best Answers

  • john_mcclary
    john_mcclary Member, Developers Posts: 4,117 PRO
    Answer ✓
    @MBartlett21 jumped into my script and fixed it up, Thanks

    Now that it is complete: anyone who wants to use it, here you go
    https://cad.onshape.com/documents/5afccd5ef566ebe0825bd897/w/395df9e1dbce13694707fcc6/e/6d242fc93553ab288e2447ae

    It lets you create a slot similar to SW's hole wizard
    You select points (or mate implicit mate connectors)
    Then set the diameter
    Then the length (center to center)
    Then a direction (in this case they are following the diagonal line)

    I've been using it for a long time now, works great. Now that it is complete I've made it public.


Answers

  • john_mcclary
    john_mcclary Member, Developers Posts: 4,117 PRO
    edited April 2019
    Thanks @kevin_o_toole_1 that worked

    yea, that was the first thing I tried, and I must have had a typo, because it would just turn fail and turn the feature red... so i've been chasing my tail looking for an alternative way....

    I get the same problem when I tried to use isStartBoundOpposite..

    That's one end bound down... now i need to get symmetric, up to face, up to vertex, through all (in only one direction, not both directions)... 
  • john_mcclary
    john_mcclary Member, Developers Posts: 4,117 PRO
    edited April 2019
    That got me heading down the right track, now all that remains to  be fixed is symmetric and up to vertex.

    What am I doing wrong?
    <br><div><strike>else if (definition.endType == EndType.UP_TO_VERTEX)</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; {</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opExtrude(context, id + "extrude", {</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "entities" : qCreatedBy(id + "slotSketch", EntityType.FACE),</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "direction" : slotPointPlane.normal,</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endBoundEntity" : qNthElement(definition.upToVertex, 0)</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; }<br><br></strike><div><strike>else if (definition.endType == EndType.SYMMETRIC)</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; {</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opExtrude(context, id + "extrude", {</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "entities" : qCreatedBy(id + "slotSketch", EntityType.FACE),</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "direction" : slotPointPlane.normal,</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endBound" : BoundingType.BLIND,</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "startBound" : BoundingType.BLIND,</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endDepth" : distance</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</strike></div><div><strike>&nbsp; &nbsp; &nbsp; &nbsp; }</strike></div></div>
    Edit:
    That didn't format correctly, here is an image of what It looks like in the post editor:

  • john_mcclary
    john_mcclary Member, Developers Posts: 4,117 PRO
    Oh I see I was missing "startDepth" for Symmetric... that's working now

    All I need is up to vertex and I'm good
  • MBartlett21
    MBartlett21 Member, OS Professional, Developers Posts: 2,064 ✭✭✭✭✭
    @john_mcclary
    What are you making?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • john_mcclary
    john_mcclary Member, Developers Posts: 4,117 PRO
    @MBartlett21 I'm finishing up an older script. Bolt Slot

    I'll share it with you if you want to look at it.
    All thats left is up to vertex end condition
  • john_mcclary
    john_mcclary Member, Developers Posts: 4,117 PRO
    Answer ✓
    @MBartlett21 jumped into my script and fixed it up, Thanks

    Now that it is complete: anyone who wants to use it, here you go
    https://cad.onshape.com/documents/5afccd5ef566ebe0825bd897/w/395df9e1dbce13694707fcc6/e/6d242fc93553ab288e2447ae

    It lets you create a slot similar to SW's hole wizard
    You select points (or mate implicit mate connectors)
    Then set the diameter
    Then the length (center to center)
    Then a direction (in this case they are following the diagonal line)

    I've been using it for a long time now, works great. Now that it is complete I've made it public.