[Ipe-discuss] Tangent Lines

Otfried Cheong otfried at ipe.airpost.net
Sat Jul 2 19:27:52 CEST 2016


On Sat, Jul 2, 2016, at 15:38, Andrew Martchenko wrote:
> The ipelet works quite well, but I would like to improve it by having 
> some of the line segments be selected after the ipelet executes. 
> Specifically in my case, their can be up to four line segments that are 
> tangent to two circles (see attached pdf for example), the segments that 
> cross one another are rarely useful (to me) and I would like them to be 
> selected so that I can easily delete all such segments with a click of a 
> button. Is this something that can be done with an ipelet??

Yes, this can be done, but it's a bit more tricky.

An ipelet is not allowed to simply modify the current page - it must
cooperate with Ipe's undo mechanism.   One way to do this is to call
model:creation, as you do - this will create an entry for the undo stack
that inserts one new object.   You call this several times, which means
that if you try to undo your ipelet's effect, you'll see that you need
to press Ctrl+Z several times to remove the tangents one by one.

I'm attaching a modified version that has a new function create_objects
that shows how to create an undo item for several new objects.   It
selects only the ones that have the "select" attribute set.

By the way, there seems to be a problem when you make two disks with the
same radius and centers at equal y-coordinate:  the outer tangents are
wrong.

Cheers,
 Otfried

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tangentlines.lua
Type: text/x-lua
Size: 5880 bytes
Desc: not available
URL: <http://lists.science.uu.nl/pipermail/ipe-discuss/attachments/20160702/b60dfa5f/attachment.bin>


More information about the Ipe-discuss mailing list