3D Pipes - with a difference!

Discussion in 'AutoCAD' started by Holly, Dec 15, 2004.

  1. Holly

    Holly Guest

    Hi Guys.
    We draw drainage pipe layouts quite regularly:

    Draw a line (or pline) from one manhole block to another, whose insert points are the invert level of the manhole. This gives us a line representing the invert level of the pipe, so that we can determine the invert level anywhere along that run.
    What I am looking for is a routine to draw a circle of given size, placed on the end of the line about the bottom quad point, in the correct UCS plane of the chosen line, then extrude the circle along the path of that line/pline.

    I have searched the ng but can only find routines that do this operation based on the centre of the circle, not the bottom quad point.

    Can anyone help please?
    Much thanks in advance.

    HOLLY
     
    Holly, Dec 15, 2004
    #1
  2. Holly

    David Kozina Guest

    Run the routine you have then:
    MOVE (entlast) (0,0,0)->(0,0,PipeRadius)?

    Or am I missing something obvious here?
     
    David Kozina, Dec 15, 2004
    #2
  3. Holly

    Holly Guest

    David,
    Thanks for the quick response!

    Quote:
    Run the routine you have then:
    MOVE (entlast) (0,0,0)->(0,0,PipeRadius)?

    Don't yet have a routine!! ;o)
    The "move" command issued above, would surely not move the pipe by the "true" pipe radius though, would it?

    HOLLY
     
    Holly, Dec 15, 2004
    #3
  4. If there's something out there that does everything else you're after, but
    based on the center of the circle, it shouldn't be too hard to change the
    drawing-of-the-circle part so it does a 2P circle, using that endpoint for
    one point, and calculating up the Y axis by the diameter of the circle for
    the other point.

    What I would wonder about is the direction of the Y axis. I assume such a
    routine would use UCS ZA. I know that if you give it a Z axis direction
    that's in the WCS X-Y plane, it sets the UCS with positive Y in the
    direction that used to be positive Z. But if you have a 3D line whose ends
    are not at the same Z elevation in the WCS, I don't know without
    experimenting whether the resulting UCS Y axis would be in the
    closest-to-the-old-Z-axis direction.
     
    Kent Cooper, AIA, Dec 15, 2004
    #4
  5. Holly

    David Kozina Guest

    Kent,
    I think your explanation just mirrored me via the 4th dimension.
    Now I won't be able to digest anything, thank you very much.
    :)
     
    David Kozina, Dec 15, 2004
    #5
  6. It would if you were in a UCS whose Z axis is defined by the ends of the
    line the pipe is extruded along. It would not if you moved it in the WCS.
     
    Kent Cooper, AIA, Dec 15, 2004
    #6
  7. Holly

    SkintSubby Guest

    Holly,

    Here's a routine that will extrude circles along various centre lines.

    It's not my code but I cant remember where I got it from, apologies to whoever wrote it.

    Type PX to Invoke the routine. It will ask you a diameter and then you pick objects you wish to extrude this circle along.

    You can now change it to move everything by the radius of a circle in the Z direction as mentioned by David.

    I hope it helps.

    MarkG
     
    SkintSubby, Dec 15, 2004
    #7
  8. Holly

    OLD-CADaver Guest

    We use "unit" blocks, a pipe of the proper diameter 1" long (X direction), with the insertion point at the INvert of the "left" end. The insertion point is on the "left" end so that the rotation angle of the inserted block will match. Then insert the block with the XSCALE of the line length and ALIGN it to the line. We place POINTs at the invert of each end to aid in alignment.
     
    OLD-CADaver, Dec 15, 2004
    #8
  9. I tried UCS ZA with a line with a delta-Z, and the Y axis does come out
    going upward. So if it's a line you draw between manhole inverts, this
    ought to work:
    [in screen/tablet/toolbar menu format]

    (setq pipedia (getreal "\nDiameter of pipe: ")) \+
    (setq linepath (car (entsel "\nSelect pipe route line: "))) \+
    (setq lineinfo (entget linepath)) +
    UCS ZA (cdr (assoc 10 lineinfo)) (cdr (assoc 11 lineinfo)) +
    CIRCLE 2P 0,0 (list 0 pipedia) +
    EXTRUDE L ;P !linepath +
    UCS P

    Add layer controls, error handling, osnap controls, defunification,
    whatever, as desired.

    If it's a polyline, that's more complicated....

    [Sorry to blow your mind, Dave -- might have been clearer with diagrams or
    something. At least if you can't digest anything, you won't gain weight
    over the holidays!]
     
    Kent Cooper, AIA, Dec 15, 2004
    #9
  10. Holly

    Holly Guest

    Thanks everyone.
    The px.lsp routine works v nicely along a centreline, thank you for posting.
    However, when it comes to modifying code to a 3rd dimension, you might as well be speaking a foriegn language to me!
    I just don't know where to begin in putting the suggestions (which I do fully appreciate and understand!) from Kent and David into practice.
    The pipe needs to be drawn along the "invert" line for accuracey. So just moving everything up by half the pipe dia, depending on its angle in space, could possibly be out of our "correctness" tolerances!
    If anyone can/would help out with this code I would be eternally grateful.
    Apologies for my lack of knowledge.

    HOLLY
     
    Holly, Dec 15, 2004
    #10
  11. Holly

    David Kozina Guest

    OK, pardon my trig, but IIUYC, this is what you'll need to calculate...

    Given:
    Start_pt = endpoint 1
    End_pt = endpoint 2
    PipeDiameter

    Calculations:
    PipeLength = (dist Start_pt End_pt) ; 3D space distance

    DeltaXY = (dist (list (car Start_pt) (cadr Start_pt))
    (list (car End_pt) (cadr End_pt))
    ); 2D plane distance (IOW don't include Z)

    [NOTE: cos(vertical_angle) = adjacent side/hypotenuse =
    DeltaXY/PipeLength => most likely very close to 1.0 if ~flat terrain]

    So
    TrueZMoveDistance = (/ (* 0.5 PipeDiameter DeltaXY) PipeLength)

    One thing you could try is using UCS->Object on the 3D line and see where
    that 'puts you'.
    (you may be able to skip the calculations that way and just move the thing
    relative to the
    slope of the pipe - however, doing THAT will move the endpoint X & Y values
    slightly, correct?)

    You probably ought to check my math :)

    hth,
    David Kozina
     
    David Kozina, Dec 15, 2004
    #11
  12. (See mine of 3:20 -- does use UCS based on the line including its slope, and
    doesn't require moving anything, or any trigonometry.)
     
    Kent Cooper, AIA, Dec 15, 2004
    #12
  13. Holly

    Holly Guest

    Kent,
    Thanks for the input - I think I posted about the same time as you, but before I read yours, if you know what I mean?!

    You lost me a bit with the "[in screen/tablet/toolbar menu format]" bit though, I must admit!
    Have tried pasting to a new button, but it fails when run. Please advise?

    HOLLY
     
    Holly, Dec 15, 2004
    #13
  14. I haven't messed with buttons, so I'm not sure, but I tried putting it in a
    pull-down menu. I put it in in this format:

    [Pipe Extrude]^C^C(setq pipedia (getreal "Diameter of pipe: ")) \+
    (setq linepath (car (entsel "Select pipe route line: "))) \+
    (setq lineinfo (entget linepath)) +
    UCS ZA (cdr (assoc 10 lineinfo)) (cdr (assoc 11 lineinfo)) +
    CIRCLE 2P 0,0 (list 0 pipedia) +
    EXTRUDE L ;P !linepath +
    UCS P

    adding the bracketed heading and the cancels at the beginning. I also took
    out the \n's that had been in the prompts, which for some reason seemed to
    be stalling it (they never seem to work for me, though they're in the
    customization descriptions and in various routines that show up in this
    NG -- I don't know what I could be doing wrong). Then it worked, at least
    for me.

    The same thing should work in a screen menu, or a tablet menu (where it
    doesn't need the heading part unless you want it there for identification
    when you're looking at the menu file), if you use either of those.
     
    Kent Cooper, AIA, Dec 15, 2004
    #14
  15. Holly

    SkintSubby Guest

    Holly,

    I've changed the lisp for you.

    It will move the cylinder the correct distance in the correct plane, but you have to be careful which way you draw the line. i.e. the lisp takes the ucs of the lines / arcs that it is using for a centreline, so if you draw the line in the wrong direction the ucs would be inverted, and the pipe would move down instead of up.

    I don't have that much time at the moment to modify it to correct this. But at least it's a start for you....

    Somethings better than nothing etc...

    MarkG
     
    SkintSubby, Dec 16, 2004
    #15
  16. Holly

    SkintSubby Guest

    Sh!t.....Typo's forget previous post and use this one.

    Sorry.
     
    SkintSubby, Dec 16, 2004
    #16
  17. Holly

    Holly Guest

    Thanks SkintSubby,
    Know what you mean about time!!
    Much appreciated.

    HOLLY x
     
    Holly, Dec 16, 2004
    #17
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.