Jack_O'neill Posted December 24, 2019 Share Posted December 24, 2019 (edited) Howdy folks... I know this has probably been asked a thousand times, but I'm here asking again. I need a 3d tube bending program. I've done several searches and can't quite find what i'm looking for. Most of the ones I've found are aimed at pipe anyway and there is a big difference in tubing and pipe. Here's the situation. I have a couple of customers who use hundreds of bent tubes. They don't provide drawings of these tubes, only a material list and an xyz bend data table. To generate a drawing, I take that table, plug in the coordinates on the command line, then pop in the bend radii, sweep circles along the path and union all the bits. Not a big deal normally. However, I just found out that we may be getting several hundred more of these tubes, and I'd really like to automate this as much as possible. Any suggestions? I'm not asking anybody to write something for me, just if someone has already run across this. I can't be the first person to ever need it, though I can't find anything out there that is exactly what I'm looking for. Thanks. edit...I don't even really need it to be a tube. a simple solid will suffice. Doesn't have to be hollow. Edited December 24, 2019 by Jack_O'neill more info Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 24, 2019 Share Posted December 24, 2019 A bit more detail please for the un educated like me a dwg or image at least. Quote Link to comment Share on other sites More sharing options...
Jack_O'neill Posted December 24, 2019 Author Share Posted December 24, 2019 11 hours ago, BIGAL said: A bit more detail please for the un educated like me a dwg or image at least. Sorry, I forget that not everybody spends their days blissfully drawing tubes...lol. At any rate, what I get from the customer is not a drawing but a table with 3d coordinates similar to this: These arrive in various forms. Sometimes a txt file, sometimes a word document, an excel file, a pdf....just about any means you can come up with. I take this data and plug it into autocad, and get something like this: This is just an example, some of these tubes are 6 feet long and have a dozen bends in them. Some are quite short and have only 1, and everything in between. I then fillet the intersections of the segments according to the table, and then sweep a circle along the thing from one end to the other to make the tube. Well, most of the time I don't actually make it hollow. No reason to, it just gets used as a reference for bend angles and where to put any markings the customer requires. Clear as mud? Any questions, feel free to ask. I appreciate any and all help. Quote Link to comment Share on other sites More sharing options...
devitg Posted December 24, 2019 Share Posted December 24, 2019 (edited) Is the radii constant?? Please upload a xls with more points . 10 at least Edited December 24, 2019 by devitg Quote Link to comment Share on other sites More sharing options...
Jack_O'neill Posted December 24, 2019 Author Share Posted December 24, 2019 5 hours ago, devitg said: Is the radii constant?? Please upload a xls with more points . 10 at least The radius is the same at each bend of each tube, but they vary with different diameters.. For instance, .25 dia tube usually is a .75 radius. Industry standards recommend what we refer to as a 3d bend. In other words its 3 times the diameter of the tube. Sometimes it will be more than that, sometimes they try to make it smaller. I'll get you the points you asked for tomorrow. We will be leaving shortly for a Christmas eve service at our Church. Thanks for all the help. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted December 25, 2019 Share Posted December 25, 2019 Gile's 3dPolyFillet function may be useful. Note: Since a 3D polyline does not support curved segments, the fillets are in fact faceted. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted December 25, 2019 Share Posted December 25, 2019 51 minutes ago, Roy_043 said: Gile's 3dPolyFillet function may be useful. Note: Since a 3D polyline does not support curved segments, the fillets are in fact faceted. There is modified version I posted at theswamp... It adds arced spline instead of 3dpoly with faceted segments... It's a little complicated to work with, but you'll get results as desired after sweeping... You read my instructions and I think you'll have to download all posted files which should be loaded before usage... You have to be logged at theswamp to download... http://www.theswamp.org/index.php?topic=49959.0 HTH., M.R. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 25, 2019 Share Posted December 25, 2019 (edited) I don't play much with 3d stuff but would not using UCS then I exploded the pline and added a true arc on a plane at each intersection. Then using extrude for each element and a union. The must do is to make sure the circle is perpendicular to the extrude path. There was a staircase scenario similar problem posted here. Edited December 25, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
Jack_O'neill Posted December 30, 2019 Author Share Posted December 30, 2019 Sorry guys...when I posted this I didn't think about being gone on vacation all last week. I'll get back with you guys tonight after I get home with a better explanation of what's going on. Quote Link to comment Share on other sites More sharing options...
Jack_O'neill Posted December 30, 2019 Author Share Posted December 30, 2019 Ok, I take a table of 3d coordinates like this: These are absolute coordinates, not relative. I then type them in to autocad and get something like this: I pop in fillets between the segments and sweep circles along the segments thusly: and when I'm finished, it looks like this: Some of these only have one bend, some, like this one have 9 or 10, maybe more, and anything in between. Any questions, fire away. I'll be home around 5:15 CST. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 31, 2019 Share Posted December 31, 2019 That's what I was getting at, you should be able to create the arc via ucs, and put a circle at correct location and rotate3d to start end. Just take the points and draw a line Pt1 pt3, then take pt2 and draw a line perp to the 1st line use this for UCS ob. If I have time will have a go, I know did something similar once before. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 31, 2019 Share Posted December 31, 2019 Starting to play jack post as csv etc had to make. (list (list 0 0 0) (list 0 2.801 0) (list 1.004 5.045 0) (list 1.39 8.231 0.067) (list 1.701 10.332 -1.171) (list 1.986 12.688 -1.121) (list 2.002 14.855 -2.657) (list 2.916 19.939 -2.503) (list 3.285 21.477 -0.376) ) Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted December 31, 2019 Share Posted December 31, 2019 Try this solution: (defun KGA_Conv_EnameList_To_Pickset (lst / ret) (setq ret (ssadd)) (foreach enm lst (if (not (vlax-erased-p enm)) (ssadd enm ret))) (if (/= 0 (sslength ret)) ret) ) (defun KGA_Data_FileRead (fnm / lst ptr str) (if (setq ptr (open fnm "r")) (progn (while (setq str (read-line ptr)) (setq lst (cons str lst)) ) (close ptr) (reverse lst) ) ) ) (defun KGA_List_LastRemove (lst) (reverse (cdr (reverse lst))) ) ; Every record in the CSV has to have 3 or 4 numerical fields: X,Y,Z[,Radius]. (defun CsvToSweep_ReadCsv (fnm) (mapcar (lambda (str / lst) (setq lst (read (strcat "(" (vl-string-translate "," " " str) ")"))) (cond ((= 4 (length lst)) lst ) ((= 3 (length lst)) (append lst '(0.0)) ; Add default radius. ) ) ) (KGA_Data_FileRead fnm) ) ) ; Return value: List of line and arc objects. (defun CsvToSweep_CreatePath (spc datLst / linLst oldFilletrad ret) (setq oldFilletrad (getvar 'filletrad)) (setq linLst (mapcar '(lambda (subA subB) (vla-addline spc (vlax-3d-point (KGA_List_LastRemove subA)) (vlax-3d-point (KGA_List_LastRemove subB))) ) datLst (cdr datLst) ) ) (setq ret (cons (car linLst) (apply 'append (mapcar '(lambda (linA linB rad / enm) (setq enm (entlast)) (setvar 'filletrad rad) (command "_.fillet" (vlax-vla-object->ename linA) (vlax-vla-object->ename linB)) (if (not (equal enm (entlast))) (list (vlax-ename->vla-object (entlast)) linB) (list linB) ) ) linLst (cdr linLst) (mapcar 'cadddr (cdr datLst)) ) ) ) ) (setvar 'filletrad oldFilletrad) ret ) (defun CsvToSweep_CreateSolid (spc pathLst rad / lst oldDelobj prof) (setq oldDelobj (getvar 'delobj)) (setvar 'delobj 0) (setq prof (vlax-vla-object->ename (vla-addcircle spc (vlax-3d-point 0.0 0.0 0.0) rad))) (setq lst (vl-remove nil (mapcar '(lambda (path / enm) (setq enm (entlast)) (command "_.sweep" prof "" (vlax-vla-object->ename path)) (if (not (equal enm (entlast))) (entlast) ) ) pathLst ) ) ) (command "_.union" (KGA_Conv_EnameList_To_Pickset lst) "") (entdel prof) (setvar 'delobj oldDelobj) ) (defun c:CsvToSweep ( / datLst diam doc fnm pathLst spc) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (setvar 'cmdecho 0) (if (and (setq fnm (getfiled "Select CSV file" "" "csv" 4)) (setq datLst (CsvToSweep_ReadCsv fnm)) (or (not (vl-position nil datLst)) (prompt "\nError: invalid data ") ) (setq diam (getdist "\nDiameter: ")) ) (progn (setq spc ((if (= 1 (getvar 'cvport)) vla-get-paperspace vla-get-modelspace) doc)) (setq pathLst (CsvToSweep_CreatePath spc datLst)) (CsvToSweep_CreateSolid spc pathLst (/ diam 2.0)) (mapcar 'vla-delete pathLst) ) ) (setvar 'cmdecho 1) (vla-endundomark doc) (princ) ) 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 1, 2020 Share Posted January 1, 2020 Roy_043 a couple of questions Not sure and hard to check, when you fillet 2 3d lines the arc is created in the x y current UCS plane not a tilted plane, so it may be a spline actually, watch a car exhaust pipe being made only bends in 1 direction so tube must be rotated. The other is similar that the circle must be added at a true 90 to the direction of the line or in the case of the arc a 3d plane. More than happy to accept that I am wrong in my ideas. There are smarter 3d people than me out there. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted January 1, 2020 Share Posted January 1, 2020 The code was tested in BricsCAD V18 and works fine there. I am attaching a zip file with the code and 2 csv files. CsvToSweep.zip Quote Link to comment Share on other sites More sharing options...
Jack_O'neill Posted January 1, 2020 Author Share Posted January 1, 2020 Bigal and Roy_043...thanks for all your help on this. I'll give it a try tomorrow after I get back to work. This being New Year's Day I'm going to spend the day doing fun stuff. Thanks again and Happy New Year every body! Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted January 1, 2020 Share Posted January 1, 2020 My code is a little rough around the edges. There is not much in terms of error checking. And if two lines connect without a bend, the final solid will have a gap at that connection. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 2, 2020 Share Posted January 2, 2020 (edited) Roy_043 yes your right if do 2 3d lines with no fillet union will be a odd intersection. But if you do it my way using ucs it will work correctly as you can make the two lines into a pline and use that as the path.This the way I think I would go with coding. Look at second image done with 1 path. I think it will still have to do each segment extrude individually including arcs then union them all. Edited January 2, 2020 by BIGAL Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 2, 2020 Share Posted January 2, 2020 Been looking at some U tube and basically you can only have say 2 lines or 2 lines with a fillet to be extruded. Plant, Inventor etc have functions built in. https://www.bing.com/videos/search?q=create+3d+path+autocad&&view=detail&mid=A122C47CAA85F861F277A122C47CAA85F861F277&&FORM=VDRVRV Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted January 2, 2020 Share Posted January 2, 2020 (edited) @BIGAL: I was focusing on the bends while writing the code. An alternative to your suggestion would be to join the affected lines into 3D polylines which may be easier. Can you confirm that filleting, what you call, '3D lines' in AutoCAD does not work as you have described in a previous post? Edited January 2, 2020 by Roy_043 Quote Link to comment Share on other sites More sharing options...
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.