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.

SkSolve error

hervé_piponhervé_pipon Member Posts: 60 ✭✭
Hello,
I don't speak chinese..
Can somebody translate this error message 
@skSolve: Parent Id FovTflfcvumxF3Q_0.sketch_ used at two non-contiguous points in operation history (Cannot have FovTflfcvumxF3Q_0.1.1 between FovTflfcvumxF3Q_0.sketch_.1 and FovTflfcvumxF3Q_0.sketch_.2)

Comments

  • MichaelPascoeMichaelPascoe Member Posts: 1,993 PRO

    @hervé_pipon this means that you have an operation in your code with a duplicate id. Each id must be unique. For example if you have opExtrude with an id of: id + "extrude1" 
    your next extrude would need a different id, something like: id + "mySecondExtrude"

    If you have an operation within a for loop, you can name the operation like this:
    id + i + "extrude"

    Also, if you share a link to your document, we can help troubleshoot specific issues you may have.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited November 2023
    An example of this error and how to fix it can be seen in the documentation for the Id type:
    The full id hierarchy must reflect creation history. That is, each Id (including parents) must refer to a contiguous region of operations on the context.
    Thus, the following code will fail because id + "extrude" alone refers to two non-contiguous regions of history:
    for (var i in [1, 2])
    {
        opExtrude(context, id + "extrude" + i, {...}); // Fails on second iteration.
        opChamfer(context, id + "chamfer" + i, {...});
    }

    For the above code, a pattern like id + i + "extrude" or id + ("loop" ~ i) + "extrude" would work as expected, as would the unnested id + ("extrude" ~ i).
  • hervé_piponhervé_pipon Member Posts: 60 ✭✭
    @MichaelPascoe @kevin_o_toole_1
    Except for the plane name, all my Ids are unique and based on the for loop index. That's why I'm wondering.
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Hi Hervé,

    If you take a careful look, that's also true of the of the failing example provided.

    This issue isn't duplicate ids. The issue is that the "+" operator is not a simple string concatenation, it is creating a parent id with children, and that FeatureScript requires each parent id to only be used in one contiguous region of history. This breaks because your code is starting one parent id ("sketch_"), then starting another ("1") and then reopening the original ("sketch_"). Take a look at the example above for several suggestions of different patterns of ids that will work without error.
  • hervé_piponhervé_pipon Member Posts: 60 ✭✭
    @kevin_o_toole_1very interesting indeed .
    But not very intuitive. I would love to find some video on FeatureScript explaining the philosophy and architecture of objects and tools.
    I think the documentation is not really user friendly.
    Fortunately there is the forum and people like you, who can put one's finger on the important detail.
    Thanks a lot.
Sign In or Register to comment.