Plumbing fittings at intersection of single lines

Plumbing fittings at intersection of single lines

DC-MWA
Collaborator Collaborator
3,742 Views
27 Replies
Message 1 of 28

Plumbing fittings at intersection of single lines

DC-MWA
Collaborator
Collaborator

Hi all,

Hard to describe in words what I'm trying to do. So here is an image.

0 Likes
Accepted solutions (2)
3,743 Views
27 Replies
Replies (27)
Message 2 of 28

Kent1Cooper
Consultant
Consultant

[The image didn't attach....]

Kent Cooper, AIA
0 Likes
Message 3 of 28

DC-MWA
Collaborator
Collaborator

Here is the image.

1.JPG

I have tried blocks, but it becomes tedious.

If the lisp would 1. ask user to select the intersection, 2. then draw and trim as shown in image parametrically..

It would save us a lot of time and effort.

0 Likes
Message 4 of 28

DC-MWA
Collaborator
Collaborator

I'm hoping somebody has done something similar I can use or at least get me going in the right direction programming-wise.

0 Likes
Message 5 of 28

doaiena
Collaborator
Collaborator

You say "parametrically". So what is the parameter? You should probably upload a drawing and be a bit more detailed in your request.

0 Likes
Message 6 of 28

DC-MWA
Collaborator
Collaborator

The dimensions would always be 1/4" long from intersection x 1/8" wide ( 1/16" from line). These numbers would by multiplied by the current dimscale....

See image to clarify

2.JPG

0 Likes
Message 7 of 28

doaiena
Collaborator
Collaborator

How about this approach:

-select lines

-find intersections

-draw a rectangle for each line (representing the fitting outline)

-region the rectangles

-break the lines at the point of intersection and at the point where the fitting ends

 

That should leave you with a region. If you want it to be a polyline, you can explode the region and join the remaining lines.

0 Likes
Message 8 of 28

DC-MWA
Collaborator
Collaborator

Seems like selecting lines, then intersection is more clicks than desired.

If I could get the lines and intersection in one click? Not sure how I would do this..

Also, drawing the rectangles from the two midpoints? Not sure how to do this either?

All this is way out of my league.

 

0 Likes
Message 9 of 28

DC-MWA
Collaborator
Collaborator

I think using LINEWORKSHRINKWRAP and selecting the rectangles instead of region and explode with work.

0 Likes
Message 10 of 28

Kent1Cooper
Consultant
Consultant

@DC-MWA wrote:

.... LINEWORKSHRINKWRAP ....


... is a Civil3D command, not available in plain AutoCAD or other overlay programs.

Kent Cooper, AIA
0 Likes
Message 11 of 28

DC-MWA
Collaborator
Collaborator

I'm using ACA. it works.

0 Likes
Message 12 of 28

DC-MWA
Collaborator
Collaborator

Ok,

I have the angled rectangle by two clicks (midpoints) figured out.

I have LINEWORKSHRINKWRAP to draw boundary around the rectangles after drawing.

Then erase the rectangles.

 

I now need to figure out the intersection point and each line direction from picking the intersection?

0 Likes
Message 13 of 28

_Tharwat
Advisor
Advisor

Hi,

Here is my Drainage Program that might be of interests.

https://autolispprograms.wordpress.com/one/drainage-pipe/ 

0 Likes
Message 14 of 28

DC-MWA
Collaborator
Collaborator

Thank you but we have a long time client that there way of doing things. It's a lot of tedious work, but we would like to keep the client happy.

 

0 Likes
Message 15 of 28

_Tharwat
Advisor
Advisor

Just download the program and test it yourself and definitely you would find out how powerful, fast and accurate this program is as soon as you get familiar to it. 

0 Likes
Message 16 of 28

doaiena
Collaborator
Collaborator

If you are offering software solutions to clients, you should at least try and improve your lisp skills. The function you want to create is almost trivial /basic 2D geometric functions/. Here is a starting point for you /barely tested/.

(defun c:test ( / DrawRect line1 line2 len width fuzz line1Start line1End line2Start line2End intersPt line1Ang line2Ang p1 p2 p3 p4)

(defun DrawRect (lst)
(entmake (append (list (cons 0 "LWPOLYLINE")
(cons 100 "AcDbEntity")
(cons 100 "AcDbPolyline")
(cons 90 (length lst))
(cons 70 1))
(mapcar (function (lambda (p) (cons 10 p))) lst)))
);defun

(while (not line1) (setq line1 (entsel "\nPick first line: ")))
(while (not line2) (setq line2 (entsel "\nPick second line: ")))

(setq len 80)
(setq width 20)
(setq fuzz 0.01)

(setq line1Start (cdr (assoc 10 (entget (car line1)))))
(setq line1End (cdr (assoc 11 (entget (car line1)))))
(setq line2Start (cdr (assoc 10 (entget (car line2)))))
(setq line2End (cdr (assoc 11 (entget (car line2)))))

;If the 2 lines intersect
(if (setq intersPt (inters line1Start line1End line2Start line2End))
(progn

(setq line1Ang (angle line1Start line1End))
(setq line2Ang (angle line2Start line2End))

(mapcar '(lambda (line / lineStart lineEnd lineAng)

(setq lineStart (car line) lineEnd (cadr line) lineAng (caddr line))

(cond
;Intersection point is on the start point of the line
((equal intersPt lineStart fuzz)
(setq p1 (polar intersPt (- lineAng (/ pi 2)) (/ width 2)))
(setq p2 (polar (polar intersPt lineAng len) (- lineAng (/ pi 2)) (/ width 2)))
(setq p3 (polar (polar intersPt lineAng len) (+ lineAng (/ pi 2)) (/ width 2)))
(setq p4 (polar intersPt (+ lineAng (/ pi 2)) (/ width 2)))
(DrawRect (list p1 p2 p3 p4))
)

;Intersection point is on the end point of the line
((equal intersPt lineEnd fuzz)
(setq p1 (polar intersPt (- lineAng (/ pi 2)) (/ width 2)))
(setq p2 (polar (polar intersPt (+ lineAng pi) len) (- lineAng (/ pi 2)) (/ width 2)))
(setq p3 (polar (polar intersPt (+ lineAng pi) len) (+ lineAng (/ pi 2)) (/ width 2)))
(setq p4 (polar intersPt (+ lineAng (/ pi 2)) (/ width 2)))
(DrawRect (list p1 p2 p3 p4))
)

;Intersection point is in the middle of the line
(T
(setq p1 (polar (polar intersPt lineAng len) (- lineAng (/ pi 2)) (/ width 2)))
(setq p2 (polar (polar intersPt (+ lineAng pi) len) (- lineAng (/ pi 2)) (/ width 2)))
(setq p3 (polar (polar intersPt (+ lineAng pi) len) (+ lineAng (/ pi 2)) (/ width 2)))
(setq p4 (polar (polar intersPt lineAng len) (+ lineAng (/ pi 2)) (/ width 2)))
(DrawRect (list p1 p2 p3 p4))
)
);cond

)
(list (list line1Start line1End line1Ang) (list line2Start line2End line2Ang))
);mapcar

))

(princ)
);defun


If you spend some time, im sure this can be written in a far more elegant way, in probably less than half the code.

Message 17 of 28

DC-MWA
Collaborator
Collaborator

To clarify, I never offered any software to any client. I do a lot of work for them which is tedious. The software is for me to assist me in doing the work. The client knows nothing of my means and methods, only how they want drawings to look when complete.

0 Likes
Message 18 of 28

doaiena
Collaborator
Collaborator

I'm sorry. I misunderstood your previous post. But still, learning a bit of lisp goes a long way.

0 Likes
Message 19 of 28

DC-MWA
Collaborator
Collaborator

I have learned a lot in the past year But you gurus always blow my mind.

0 Likes
Message 20 of 28

DC-MWA
Collaborator
Collaborator

Your code works but I ran into a couple things.

What if I have more than two lines? Corners are problematic as well.

3.JPG

0 Likes