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.
Correct way to do a "Center Point Arc" in Sketch in FeatureScript
Brad_Goodman
Member Posts: 38 ✭✭
What is the correct way to do a "Center Point Arc" in FeatureScript. I have tried an unbelievable amount of methods, and some seem to work, but when their points are contrained to other points on the sketch, under some angles they fall apart. The noteworthy thing here is that I need to constrain the three points to other geometry features.
The only real method I have found to do so I scraped from looking at sketch code - and I don't understand it at all - it's using several layers of undocumented stuff:
I am basically trying to draw two arcs like below, and connect their left and right lines. It works - but if the inner arc is greater than the outer arc - constraints go crazy and everything seems to disappear. I don't understand why/how the above code really works - or if there is a "better" way to do be doing this.
The other somewhat natural way to do this is to draw circles and trim the areas outside the lines - but again, the trim functions seem to rely on other skConstraints which are again undocumented and even more confusing/unintuitive.
The only real method I have found to do so I scraped from looking at sketch code - and I don't understand it at all - it's using several layers of undocumented stuff:
<div>skConstraint(sketch, "inner_arc1_center", { "constraintType" : ConstraintType.COINCIDENT, "localFirst" : "inner_ellipticalArc1.center",<span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;"> "externalSecond":definition.location}); </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">skConstraint(sketch, "inner_arc1_quadrant", { "constraintType" : ConstraintType.QUADRANT, "localFirst" : "inner_line1.end",</span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">"localSecond" : "inner_ellipticalArc1" }); </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">skConstraint(sketch, "inner_line1_startSnap1", { "constraintType" : ConstraintType.COINCIDENT, "localFirst" : "inner_line2.end",</span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">"localSecond" : "inner_ellipticalArc1.start", "sketchToolType" : SketchToolType.TRIM }); </span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">skConstraint(sketch, "inner_line1_startSnap2", { "constraintType" : ConstraintType.COINCIDENT, "localFirst" : "inner_line1.end",</span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Flama, sans-serif;">"localSecond" : "inner_ellipticalArc1.end", "sketchToolType" : SketchToolType.TRIM });</span></div>
I am basically trying to draw two arcs like below, and connect their left and right lines. It works - but if the inner arc is greater than the outer arc - constraints go crazy and everything seems to disappear. I don't understand why/how the above code really works - or if there is a "better" way to do be doing this.
The other somewhat natural way to do this is to draw circles and trim the areas outside the lines - but again, the trim functions seem to rely on other skConstraints which are again undocumented and even more confusing/unintuitive.
0
Comments
Hopefully one of the pros will jump in and explain best practice.
Cheers, Owen.
HWM-Water Ltd
I don't think you need to use sketch constraints inside your custom feature. If you could share more information on what you are trying to achieve we'd be able to help you with your feature. e.g. here https://cad.onshape.com/documents/0d6f479475672dffd95e2482/w/7467794890fa74040bda1557/e/294ea16a64f1a9616e4c0c3e
HWM-Water Ltd