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.
Query Part from Part Studio to Use as Input for Custom Feature
Kyler_Walker Member Posts: 175 PRO
I have written a custom feature that takes a part as an input and performs operations using that part. I am writing new a feature that uses the first feature. When using the new, top level feature, the part that is used as an input for the referenced feature should be predetermined, not chosen by the user. I can have this part exist in the same document as my top level feature. The user has no reason for this part to exist in their part studio. Is there a way I can query the part so I can use it as an input to the referenced feature without bringing the part into the user's part studio?
Without instantiating, you cannot query in a context for geometry that does not exist in that context. It's possible there may be a workflow to only, say, evaluate some data in the other Part Studio's context, store that data, and use that data instead of a query in your downstream workflow. But if you need geometry in an operation (like say, a boolean) that geometry needs to be present in the Part Studio. You will need to instantiate the bodies from the other Part Studio into the current one (and possibly delete them at the end).
Performance-wise, it should not be as expensive to copy that geometry into the current context as it was to build it originally (since that data is cached in versions).
To mark which bodies are needed between the features, one option is something like in the first feature, and something like in the second feature.