Jump to content

Identify direction of pipe line


Dayananda

Recommended Posts

tea.PNG.3276ad98338a6c15b5f38792a8de5159.PNGI have a black called T-Joint

By picking on main pipe line and sub line 1 or 2 (All MLines), I can calculate intersection point of 2 pipe lines.

Can obtain main pipe angle also.

Then insert the T block.

The difficulty is to find out weather the block should  mirror or not 

to fit with sub pipe line 1 or 2.

Any ideas ?

Link to comment
Share on other sites

2 hours ago, Dayananda said:

tea.PNG.3276ad98338a6c15b5f38792a8de5159.PNGI have a black called T-Joint

By picking on main pipe line and sub line 1 or 2 (All MLines), I can calculate intersection point of 2 pipe lines.

Can obtain main pipe angle also.

Then insert the T block.

The difficulty is to find out weather the block should  mirror or not 

to fit with sub pipe line 1 or 2.

Any ideas ?

 

You don't need to mirror the block, just rotate it pi radians (180degrees). If you know the insertion point and the end of line 2, you can test if the angle (line1 ip) Line2 ip)  (end line2) is clockwise or ccw. Depending on result rotate or not. This code function by Gilles will test whether the angle is clockwise or ccw. It requires 3 points in order of the direction.

 

(defun gc:clockwise-p ( p1 p2 p3 ) (< (sin (- (angle p1 p3) (angle p1 p2))) -1e-14))

 

  • Like 1
Link to comment
Share on other sites

On 3/7/2020 at 5:06 PM, Dayananda said:

tea.PNG.3276ad98338a6c15b5f38792a8de5159.PNGI have a black called T-Joint

By picking on main pipe line and sub line 1 or 2 (All MLines), I can calculate intersection point of 2 pipe lines.

Can obtain main pipe angle also.

Then insert the T block.

The difficulty is to find out weather the block should  mirror or not 

to fit with sub pipe line 1 or 2.

Any ideas ?

 

If it's me, like what dlanorh says, I will rotate it. I'd set the rotation of the block at (- (angle intersectionpt endpt) (* 0.5 pi))

 

And endpt can be found using (if (equal intersectionpt startpt 1e-8) endpt startpt), so line direction doesn't matter.

  • Like 1
Link to comment
Share on other sites

On 3/7/2020 at 3:06 AM, Dayananda said:

tea.PNG.3276ad98338a6c15b5f38792a8de5159.PNGI have a black called T-Joint

By picking on main pipe line and sub line 1 or 2 (All MLines), I can calculate intersection point of 2 pipe lines.

Can obtain main pipe angle also.

Then insert the T block.

The difficulty is to find out weather the block should  mirror or not 

to fit with sub pipe line 1 or 2.

Any ideas ?

Would you, please, upload both the dwg and lisp samples.?

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...