Jump to content

tube bending lisp or??


Jack_O'neill

Recommended Posts

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 by Jack_O'neill
more info
Link to comment
Share on other sites

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:

image.png.b3cbbad6ad1ed1823281b3c9ed583999.png

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:

image.png.668a7ed7607bf28fb814f866948ec3ff.png

 

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by BIGAL
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Ok,  I take a table of 3d coordinates like this:

image.png.a30523dc8b64e8cb5706e22d07206411.png

These are absolute coordinates, not relative.

I then type them in to autocad and get something like this:

image.png.70a7c550809b70b25d4451b1b40f2246.png

 

I pop in fillets between the segments and sweep circles along the segments thusly:

image.png.5cee2e476f6b0fb51df27899af6f4e12.png

and when I'm finished, it looks like this:

 

image.png.1374c22395f77a13bee116a83bd54652.png

 

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.

Link to comment
Share on other sites

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. 

 

image.thumb.png.1d047290e6877000d96e9948809f3adf.png

 

If I have time will have a go, I know did something similar once before.

Link to comment
Share on other sites

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)
)

 

Link to comment
Share on other sites

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)
)

 

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

image.png.ed99d5d4be0646436c24b394f81efd6f.png

image.png.f91a833e37159b2f45443d04b8b7a4c7.png

image.png.d876849c1290455dbecae488933190bf.png

Edited by BIGAL
Link to comment
Share on other sites

@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 by Roy_043
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...