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.


Looping Through Debugs Breaks unstableIdComponent

Alex_KempenAlex_Kempen Member Posts: 244 EDU
It turns out that looping through any debug function (such as addDebugPoint and addDebugArrow) causes any features inside the same loop which rely on unstableIdComponent to break. Notably, the output of features which rely on unstableIdComponent still happen, but the output becomes unusable by other features downstream - attempting to select resulting entities later on fails.

Here's an example of code which triggers this bug:
        var debugs = 0;
        var evaluatedQuery = evaluateQuery(context, definition.vertices);
        for (var i = 0; i < size(evaluatedQuery); i += 1)
            if (definition.debug && debugs != 2)
                addDebugPoint(context, vector(0, 0, i) * inch);
                debugs += 1;
            const location = evVertexPoint(context, { "vertex" : evaluatedQuery[i] });
            // works fine if fCylinder's id is: id + ("loopCylinder" ~ i)
            fCylinder(context, id + "loopCylinder" + unstableIdComponent(i), {
                        "topCenter" : location,
                        "bottomCenter" : location + vector(0, 0, 1) * inch,
                        "radius" : 1 * inch

Notably, this bug does not occur if the ids of features inside the loop don't contain an unstableIdComponent, or if the debug function is called only once inside the for loop. It also doesn't occur if the debug function is called inside a separate loop.

here's a link to the document:

@lougallo, can you get this logged?
CS Student at UT Dallas
Check out my FeatureScripts here:


Sign In or Register to comment.