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.

Another feature script ID error...

darren_13darren_13 Member, Developers Posts: 117 PRO
@opPlane: Parent Id FIZxwPCJn00T9Nq_1.0 used at two non-contiguous points in operation history (Cannot have FIZxwPCJn00T9Nq_1.deleteBodies2.3 between FIZxwPCJn00T9Nq_1.0.SparPlanes and FIZxwPCJn00T9Nq_1.0.0)

I don't know what is wrong with this clearly the ID'd are different because they are unique strings... the ID + i + string should be seen as unique if ALL of those are the same then there should be an issue, otherwise, it should be fine?

Thanks in advance,
Darren


Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 946
    From the message, it looks like you forgot the "+ i" portion of the opDeleteBodies id, but it's a bit hard to tell without a link to your document.
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • darren_13darren_13 Member, Developers Posts: 117 PRO
    Hi @ilya_baran, sorry here it is: https://cad.onshape.com/documents/95877be3b17f49277e87a2c3/w/b503830fd20472014beb1221/e/4c4431103f44e823aca947dd

    the document is located in folder 'wing structure creator' and the script is the second one 'wing structure parametric'

    I changed it a little here is the input:

    //create the planes for cutting the spars
                        halfPlanes[i] = opPlane(context, id + "IBeamPlanes" + i, {
                                "plane" : plane(halfBasePoints[i], halfNorm[i], xhalfVector[i]),
                                "width" : wingLen,
                                "height" : circRadius.distance
                        });

    and here is the new error:
    @opPlane: Parent Id FIZxwPCJn00T9Nq_1.IBeamPlanes used at two non-contiguous points in operation history (Cannot have FIZxwPCJn00T9Nq_1.halfSplit.0 between FIZxwPCJn00T9Nq_1.IBeamPlanes.0 and FIZxwPCJn00T9Nq_1.IBeamPlanes.1)

    the problem I believe is on line 391



    Cheers,
    Darren
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 946
    Ok, you have a slightly complicated flow structure, so assigning operation ids needs to be done carefully.
    The first problem is actually in line 321, where the id should be id + "SparPlanes" + i rather than id + i + "SparPlanes" -- this is backwards from the usual advice of id + index + operation, but in your case, you have multiple for loops in your feature, so you need a unique string id to distinguish them that must come before the iterator variable.  Your other loops do this.

    The second issue I can see is where you suspect: the ids in lines 391 and 399. Change
    id + "IBeamPlanes" + i   to   id + "loopId" + i + "IBeamPlanes"
    and
    id + "halfSplit" + i   to   id + "loopId" + i + "halfSplit"
    (where "loopId" is whatever you want to call that entire loop) and I think the ids at least should work.
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • darren_13darren_13 Member, Developers Posts: 117 PRO
    Cheers @ilya_baran, worked like a charm.

    Darren
Sign In or Register to comment.