Dayananda Posted March 7, 2020 Posted March 7, 2020 I 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 ? Quote
dlanorh Posted March 7, 2020 Posted March 7, 2020 2 hours ago, Dayananda said: I 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)) 1 Quote
Jonathan Handojo Posted March 8, 2020 Posted March 8, 2020 On 3/7/2020 at 5:06 PM, Dayananda said: I 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. 1 Quote
devitg Posted March 8, 2020 Posted March 8, 2020 On 3/7/2020 at 3:06 AM, Dayananda said: I 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.? Quote
Recommended Posts
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.