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.

unique ids for topological entities

AdrianaAdriana Member, Developers Posts: 9 EDU
Hi,

I'm writing a program using Onshape's API where I can vary some parameters of a model and then evaluate the vertices of the model and retrieve their position and an id. I use these ids as a way to establish correspondences between the vertices across parameter changes.

I've been using transientQueriesToStrings to get the ids and this worked well for a while but for some of my recent examples these ids are not consistent across the parameter variations. I tried writing a simple feature on my problematic model that takes in a vertex query and prints the transient id. As I change one of the variables this feature does not break (so the query is still fine) but the transient id it displays changes. Is this because context changes are making the transient ids inconsistent? Is there a way to make unique ids?

Alternatively, is there a way to maybe write a feature that creates queries to all the vertices in a default parameter setting assigned them all ids and then evaluates the vertex positions at a new parameter setting? 

Thanks!

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,216
    Hi Adriana,

    You are right in that the transient ids are unstable (hence the name) even sometimes to purely geometric, rather than topological changes.  I think the solution you propose at the end makes sense: write a custom feature that takes a query for vertices and assigns an array of, say, their vertex positions to a variable (using setVariable) that you can then access via the API (using the evaluate FS call).  You would then create this feature either manually at the end of the feature list (by box-selecting all vertices in the model) or via the API (the transient ids you pass to the API call to set a feature's parameters will automatically get converted into the more-stable queries.)

    Hope this helps!
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • AdrianaAdriana Member, Developers Posts: 9 EDU
    Thanks, Ilya! That helps a lot!


Sign In or Register to comment.