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.

How to offset faces for parts in a for-loop

Jose_MoralesJose_Morales Member Posts: 15 PRO
I have a list of faces which I'm running through a for-loop to extrude each one as a unique part, attribute part metadata, and offset (inwards) each one. When I add the opFaceOffset feature I get an error message which I can't seem to wrap my head around.


:


Below is the error message:



I have tried shifting the order between "panel_number" and the opOffsetFace feature but ran into other issues there. What am I missing? 

Any help is appreciated, and thanks in advance.


Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,696
    Details are here (if you can decipher it): https://cad.onshape.com/FsDoc/library.html#Id

    If you change how you construct your id's to something like this, it will be OK:
    id + ("panel_extrude" ~ panel_number) 

    Senior Director, Technical Services, EMEAI
  • lanalana Onshape Employees Posts: 711
    Or you can do id + unstableComponent(panel_number) + "panel_extrude", id + unstableComponent (panel_number) + "offset_face", etc.
    Use of unstableComponent will give you downstream reference stability.
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    You would also want to use setExternalDisambiguation(context, id + unstableIdComponent(panel_number), face) so that we have the reference for the feature.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Jose_MoralesJose_Morales Member Posts: 15 PRO
    Thanks a lot guys, I'll let you know how it goes.

    @lana Is this mainly used when performing multiple dependent operations within a loop? 

    @MBartlett21 Is there documentation on when to use that? I've yet to wrap my head around feature ID's, honestly

    @NeilCooke Thanks for the link; *puts on helmet* I'm going in!

  • lanalana Onshape Employees Posts: 711
    Yes, Ids should form tree structure:
    featureId.0.op1
                      .op2
                      .op3
                   .1.op1 
    etc.
    When you create a separate set of operations per entity in a query, you have to expect that when editing feature input, number and order of entities will change. unstableIdComponent(index) tells FS that this component is not important to resulting geometry identity.
    I did not mention external disambiguation in your case because it looks like panels are input to the feature and the first operation in the loop is panel extrude. This means that each iteration will be disambiguated by the panel face identity.  external disambiguation is needed is the set of operations in the loop starts with something like sketch or opPlane, which is defined only by geometry with no dependencies.



  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    lana said:
    [...]
    I did not mention external disambiguation in your case because it looks like panels are input to the feature and the first operation in the loop is panel extrude. This means that each iteration will be disambiguated by the panel face identity.  external disambiguation is needed is the set of operations in the loop starts with something like sketch or opPlane, which is defined only by geometry with no dependencies.
    @lana
    Is it mentioned about this in the documentation anywhere?
    I did not know that I did not need to disambiguate if I was just operating on a face.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • lanalana Onshape Employees Posts: 711
    @MBartlett21
    It sort of says so in the setExternalDisambiguation documentation, but does not make it very clear. 
    Used to set external disambiguation for operations with unstable component in id. The disambiguation will be applied to results of sub-operations which otherwise don't track dependency e.g. [Sketch] , [opPlane], [opPoint]
    However, functionality is smart enough and if no disambiguation is necessary, there'll be no performance penalty for setting external disambiguation.
Sign In or Register to comment.