OK so I fix up your code above. This code is great but I had spend an hour laying it out in Note++
I also added two key features: 1) Select None at the beginning 2) At the end it will copy delete and Paste same_Position then mirror the Pig Tail so if you need the pig upside down or right side up you can simply Undo to the mirrored version of your choice. This is a big help.
Macro Pipe End Pig Tail Bologna Slice Select none define me as MouseEvent define ppx1 as Point # x value of first user selected point define ppy1 as Point # y value of first user selected point define ppx2 as Point # x value of second user selected point define ppy2 as Point # y value of second user selected point define cpx1 as point # x value of centre point between user selected points define cpy1 as point # y value of centre point between user selected points #get first point me = Wait MouseClick ppx1 = me.ptMMGrid.x ppy1 = me.ptMMGrid.y #get second point me = Wait MouseClick ppx2 = me.ptMMGrid.x ppy2 = me.ptMMGrid.y cpx1 = ((ppx1 + ppx2) / 2) cpy1 = ((ppy1 + ppy2) / 2) #determine X and Y distance between the user selected points define tempx1 as point # x distance between the user selected points define tempy1 as point # y distance between the user selected points if (ppx1 > ppx2) tempx1 = (ppx1 - ppx2) else tempx1 = (ppx2 - ppx1) end if if (ppy1 > ppy2) tempy1 = (ppy1 - ppy2) else tempy1 = (ppy2 - ppy1) end if # determine the distance between the user selected points (hypotenuse) define hyplength as point # the length of the line between the user selected points hyplength = (sqrt ((tempx1 * tempx1) + (tempy1 * tempy1))) # determine the angle between the user selected points define hypangle as point if (tempx1 > tempy1) hypangle = arctan (tempy1 / tempx1) else hypangle = arctan (tempx1 / tempy1) end if # COP OUT SOLUTION IS TO DRAW BEZIER HORIZONTALLY AND THEN ROTATE THE WHOLE THING. define copx2 as point define copy2 as point cpx1 = (ppx1 + (hyplength / 2)) cpy1 = ppy1 copx2 = (ppx1 + hyplength) copy2 = ppy1 define ofp1x as point define ofp1y as point ofp1x = (cpx1 - (hyplength / 16)) ofp1y = (cpy1 + (hyplength / 20)) define ofp2x as point define ofp2y as point ofp2x = (cpx1 + (hyplength / 16)) ofp2y = (cpy1 -(hyplength / 20)) # NEXT DEFINE THE BEZIER CURVE AS AN ELEMENT SO THAT LINE THICKNESSES CAN BE SET define bz1 as element bz1 = create bezier curve ppx1 ppy1 ppx1 (ppy1 + (hyplength / 5)) (ofp2x - (hyplength / 4)) (ofp2y + (hyplength / 4)) ofp2x ofp2y append bezier segment (ofp2x + (hyplength / 6)) (ofp2y - (hyplength / 6)) copx2 (copy2 - (hyplength / 6)) copx2 copy2 append bezier segment copx2 (copy2 + (hyplength / 6)) (ofp1x + (hyplength / 6)) (ofp1y + (hyplength / 6)) ofp1x ofp1y bz1.bezier.segments.pen = "Medium" bz1.bezier.segments.pen = "Medium" bz1.bezier.segments.pen = "Medium" Group Selection # NOW TO DETERMINE THE ANGLE TO ROTATE THE FINISHED BEZIER define ppx_diff as point define ppy_diff as point ppx_diff = (ppx2 - ppx1) ppy_diff = (ppy2 - ppy1) define rotate_angle as point rotate_angle = 0 if (ppx_diff > 0) if (ppy_diff > 0) if (abs (ppx_diff) > abs (ppy_diff)) rotate_angle = ( + hypangle) else rotate_angle = (90 - hypangle) end if else if (abs (ppx_diff) > abs (ppy_diff)) rotate_angle = (- hypangle) else rotate_angle = (-90 + hypangle) end if end if else if (ppy_diff > 0) if (abs (ppx_diff) > abs (ppy_diff)) rotate_angle = (180 - hypangle) else rotate_angle = (90 + hypangle) end if else if (abs (ppx_diff) > abs (ppy_diff)) rotate_angle = (180 + hypangle) else rotate_angle = (-90 - hypangle) end if end if end if Rotate selection ppx1 ppy1 rotate_angle no_Patterns Copy Delete selection Paste same_Position Reflect selection ppx1 ppy1 rotate_angle no_Patterns Delete selection Paste same_Position Select none End Macro
Amazing - a reply after over 9 years. Thanks BLArts. That was one of my first useful drawing macros and your enhancement to copy it several times to allow undo levels is very innovative - I relied on the toolbar icon being informative (i.e. showing point 1 and point 2 of a sketch of the shape), so hoping user would get it right first time.
I thought I'd tried Select None all over the place with no discernible effect. What does it do at the start?
I have lots of other macros to speed up drawing tasks. Maybe I should put some up to see if there is a reaction? A couple of examples:
ribbed pipe - draws a pipe with curved ribs following any bezier curve
scale toolbar - you set a scale point and click scale up or scale down to precisely scale selected geometry
Fixings - draws sets of fixings (either nuts with washers or screws with washers) automatically to correct scale and orientation by one click on the hole they fit into and one click in the general direction to draw them (draws both exploded and fitted fixings in several types and lengths).
Tim, Yeah LOL 9 years! This is a great macro so thanks. I added the Select none at beginning because if someone forgot they had something selected. The selection gets grouped in with the pig tail if so.
I also have other helpful macros and we could compare them and see what might be helpful to each other. I have one the will scale up or down proportionally that might be similar to yours. We might be able to use parts of each others. Lets touch base if possible. I'm currently trying to use some of your macro to figure out how to determine a lines angle for a macro I would like to create.
What would be the best way to do this. I would be open to calling because I can talk faster than I type. Whatever works for you LMK.