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 - Creating cylinder in context
Hugh_Goodbody
Member Posts: 40 PRO
I am writing a featurescript to create a cylinder between two points (usually the centres of two circles). Currently I can create the cylinder between two vertices or mate connectors in a part studio, and this is all good.
I would also like this to work in context but doing it this way, I can only select the edges of circles. I have added the circle selection to the UI:
annotation { "Name" : "Start Point", "Filter" : EntityType.VERTEX || BodyType.MATE_CONNECTOR || (GeometryType.CIRCLE), "MaxNumberOfPicks" : 1 }
definition.startVertex is Query;
definition.startVertex is Query;
So the result of the above is that I either have a vertext point, or a circle.
So my question is: Is the best way to resolve this by incorporating an IF statement, ie IF the user selects a circle, then evaluate the centre point and use this as the vertex? or is there a better way?
The second part to the question, is how do I test if the circle has been selected?
Thanks in advance!
0
Comments
Some info on all this try and try silent stuff:
https://cad.onshape.com/FsDoc/exceptions.html
Another tip for this: once you find the two positions that you care about, `fCylinder` is going to be your best friend. It does exactly what you want (take two points and a radius and make a cylinder between them):
https://cad.onshape.com/FsDoc/library.html#fCylinder-Context-Id-map