Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Featurescript Instantiator - addInstance result not evaluating to any bodies
Jacob_Corder
Member Posts: 137 PRO
I am creating an instantiator featurescript. everything works great, i'm pulling in sketches into another part. I'm building the PartStudioData myself using maps. Everything is working as expected besides the Query returned from addInstance. when a sketch profile is all that is imported (instantiated), it resolves to no entities. these sketch profiles are closed sketches.
however, when i do this
var createdFaces = evaluateQuery(context, qCreatedBy(id + "instantiator1", EntityType.FACE))
size(createdFaces) returns the expected number of faces and i can proceed. however, the order these faces are returned, is not consistent.
i cant exactly share the code as it is for a client.
any help would be much appreciated. Thank you
however, when i do this
var createdFaces = evaluateQuery(context, qCreatedBy(id + "instantiator1", EntityType.FACE))
size(createdFaces) returns the expected number of faces and i can proceed. however, the order these faces are returned, is not consistent.
i cant exactly share the code as it is for a client.
any help would be much appreciated. Thank you
0
Comments
Make sure you use the query returned by addInstance() after you call the instantiate() function. instantiate() is where geometry is actually created, so before it's called, the query returned by addInstance() is just an order form for entities that don't yet exist.
Leaving that out would cause instantiate to fail outright since the instance has no geometry.
i am instantiating first. then execute the query created by addinstance.
qCreatedBy InstantiatorID returns everything created even the wire bodies in each instance as expected
however evaluateQuery (context, addinstanceReturnQuery) returns nothing for each instance. i have shared the featurescript with support if you want to see it.