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.

Query Bodies Created by OpSplitByPart

ben_smith548ben_smith548 Member Posts: 2
I want to query the bodies created by a split. This doesn't work. Documentation doesn't make it clear why.

<div>FeatureScript 1447;</div><div>import(path : "onshape/std/geometry.fs", version : "1447.0");</div><div><br></div><div>annotation { "Feature Type Name" : "My Split" }</div><div>export const mySplit = defineFeature(function(context is Context, id is Id, definition is map)</div><div>&nbsp; &nbsp; precondition</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; annotation { "Name" : "Select body", "Filter" : EntityType.BODY }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; definition.bodyToSplit is Query;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; annotation { "Name" : "Select splitting plane", "Filter" : EntityType.FACE }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; definition.splittingPlane is Query;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; {
</div><div>&nbsp; &nbsp; &nbsp; &nbsp; opSplitPart(context, id + "splitPart", {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "targets" : definition.bodyToSplit,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "tool" : definition.splittingPlane</div><div>&nbsp; &nbsp; &nbsp; &nbsp; });</div><div>&nbsp; &nbsp; &nbsp; &nbsp; debug(context, qCreatedBy(id + "splitPart", EntityType.BODY), DebugColor.RED);</div><div>&nbsp; &nbsp; });</div>
debug: Query resolves to nothing
 Result: Regeneration complete


Comments

  • _anton_anton Member, Onshape Employees Posts: 523 image
    Try qSplitBy.
  • MichaelPascoeMichaelPascoe Member Posts: 2,803 PRO
    edited February 2021
    _anton is right.

    Here is how I use it in one of my features Section:
    var halfDirection = definition.switchDeletedHalf? true : false;
    var half = qSplitBy(id + ("splitPart1"), EntityType.BODY, halfDirection);


    RENDERCAD
    rendercad.ai - Photorealistic product rendering.

    ▚▞▚▞▚▞▚▞▚
    ________________________________________________________________________
Sign In or Register to comment.