Jump to content
Developer Wiki and Function Reference Links ×

Linear PIO behavior


alberto72

Recommended Posts

This is my answer. I create a new command called "Join Linear PIOs", placed under "Edit" menù and this is its code:

Procedure JoinTwoSelectedLinearPios;
VAR
h1,h2:HANDLE;
P1,P2,P3,P4:POINT;
P:POINT;
parallel     :BOOLEAN;
intOnLines   :BOOLEAN;
d1,d2,d3,d4:REAL;
BEGIN
h1:=FSActLayer;
h2:=NextSObj(h1);
GetSegPt1(h1,P1.x,P1.y);
GetSegPt2(h1,P2.x,P2.y);
GetSegPt1(h2,P3.x,P3.y);
GetSegPt2(h2,P4.x,P4.y);
LineLineIntersection(P1,P2,P3,P4,parallel,intOnlines,P);
{====gather P1,P2,P3,P4 distances from P========}
    IF (parallel=FALSE) THEN BEGIN
        d1:=Distance(P1.x,P1.y,P.x,P.y);
        d2:=Distance(P2.x,P2.y,P.x,P.y);
        d3:=Distance(P3.x,P3.y,P.x,P.y);
        d4:=Distance(P4.x,P4.y,P.x,P.y);
    {    ===== join PIOs trimming the shortest side...=====}
        IF d1<d2 THEN SetSegPt1(h1,P.x,p.y) ELSE SetSegPt2(h1,P.x,p.y);
        IF d3<d4 THEN SetSegPt1(h2,P.x,p.y) ELSE SetSegPt2(h2,P.x,p.y);
    END;
END;
RUN(JoinTwoSelectedLinearPios);

Well, it doesn't check if h1 and h2 are linear PIO's or other objects, but it works with 2d Lines too.

Hope to be useful....

2D Linear Objs.png

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...