Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Break At Point


Recommended Posts

I decided to use BreakAtMidpoint(arc).

The problem I'm currently having with it is that it breaks the arc at the midpoint, which is wonderful, but then one of those halves gets broken again.

I'm not seeing any error in my logic though. Does breaking an Entity store the two new pieces under the same EntityID?

            void breakArcsWithPoints(){
                foreach (var i in tempList3) {
                    var ArcID = Geometry.RetrieveEntity(i);
                    if (ArcID is ArcGeometry arc){
                        var arc1X1 = arc.EndPoint1.x; // Arc x 1
                        var arc1X2 = arc.EndPoint2.x; // Arc x 2
                        var arc1Y1 = arc.EndPoint1.y; // Arc y 1
                        var arc1Y2 = arc.EndPoint2.y; // Arc y 2
                        var arc1Center = arc.Data.CenterPoint;
                        Point3D arc1StartPoint = new Point3D(arc1X1, arc1Y1, 0.0);
                        Point3D arc1EndPoint = new Point3D(arc1X2, arc1Y2, 0.0);
                        var tolerance = 0.001;
                        foreach (var v in tempList4){
                            var u = PointGeometry.RetrieveEntity(v);
                            if (u is PointGeometry point) {
                                var ux = point.Data.x;
                                var uy = point.Data.y;
                                Point3D uPoint = new Point3D(uy, ux, 0.0);
                                var delta3Xneg = (arc1Center.x - uPoint.x);
                                var delta3Yneg = (arc1Center.y - uPoint.y);
                                var delta3Radneg = Math.Atan2(delta3Xneg, delta3Yneg);
                                var pt3degreeNeg = VectorManager.RadiansToDegrees(delta3Radneg);
                                if (pt3degreeNeg < 0.0){
                                    pt3degreeNeg = (pt3degreeNeg + 360);
                                }
                                var startToUDist = Math.Abs(VectorManager.Distance(arc1StartPoint, uPoint));
                                var endToUDist = Math.Abs(VectorManager.Distance(arc1EndPoint, uPoint));
                                if ((startToUDist >= (endToUDist - tolerance)) && (startToUDist <= (endToUDist + tolerance))){
                                    GeometryManipulationManager.BreakAtMidpoint(arc);
                                }
                            }
                        }
                    }
                }
            }

 

Link to comment
Share on other sites

I took 2 arcs

shifted 1 X+0.001 & Y+0.001
shifted the other X-0.001 & Y-0.001

I created points of where the two circles intersect

I then filtered to only keep the points that are actually on the arc

 

The goal here is to have a chain color A until it hits a point and then change to color B until it hits another point at which it turns back to color A

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...