how do I create line/curve that basically looks like a pipe?

how do I create line/curve that basically looks like a pipe?

jeff.wangD95HG
Collaborator Collaborator
1,401 Views
15 Replies
Message 1 of 16

how do I create line/curve that basically looks like a pipe?

jeff.wangD95HG
Collaborator
Collaborator

 

jeffwangD95HG_1-1727120393524.png

end result will look something like this but it will be a line? polyline? 

I got some progress by converting an arc into polyline and use pedit to give it width 

jeffwangD95HG_2-1727120547813.png

but i couldn't figure out how to make it so that it will not be filled in

 

0 Likes
1,402 Views
15 Replies
Replies (15)
Message 2 of 16

pendean
Community Legend
Community Legend
0 Likes
Message 3 of 16

jeff.wangD95HG
Collaborator
Collaborator

not what I am looking for.

i just need to create something like this on a daily basis

jeffwangD95HG_0-1727122075283.png

i would like the pipe to be easily mutable in all directions basically. and i basically want it to be 1 singular arc that i can just drag and drop the ends and be done with it.

0 Likes
Message 4 of 16

Simon_Weel
Advisor
Advisor

Maybe a Multiline ?

Message 5 of 16

Kent1Cooper
Consultant
Consultant

@Simon_Weel wrote:

Maybe a Multiline ?


... if it can be of only straight-line segments.  And of course the "cut" end part would need to be in addition.

Kent Cooper, AIA
0 Likes
Message 6 of 16

jeff.wangD95HG
Collaborator
Collaborator

I would need it to work with curves. since everything i draw under the manhole will be pretty much curves

 

i briefly explored dynamic blocks but no combination of dynamic blocks is making sense in making what I wanted so far.

0 Likes
Message 7 of 16

pendean
Community Legend
Community Legend

@jeff.wangD95HG wrote:

...i would like the pipe to be easily mutable in all directions basically. and i basically want it to be 1 singular arc that i can just drag and drop the ends and be done with it.


Plain AutoCAD has no such ability, sorry. Is this a civil need? If yes, are you using C3D?

 

I suspect you are looking at an add-on (likely not free) if a vertical version of AutoCAD/Civil3D does not offer it as a core feature. Explore add-ons at the app store here to see if any match your need

https://apps.autodesk.com/ 

 

Ask for help in the Dynamic Blocks forum if you wish to still explore that, but give them a DWG to work with and show any variations or other needs in there too. Here is the link:

https://forums.autodesk.com/t5/dynamic-blocks-forum/bd-p/154

 

 

0 Likes
Message 8 of 16

jeff.wangD95HG
Collaborator
Collaborator

yes i am using civil 3d

I thought creating width to a polyline and removing the fill is a simple built in toggle in autocad which is why I am asking here.

i guess i will just ask dynamic blocks forums and see if they can give me any pointers

0 Likes
Message 9 of 16

leeminardi
Mentor
Mentor

I'm not sure if the following does something close to what you want.  The user specifies a pipe diameter and a series of spline fit points and the program create two offset splines with ellipses at the ends.

leeminardi_0-1727198333013.png

The user can trim one of the ellipses if desired.

The program does not indicate the spline  fit point as they are being specified and it uses the start point to select the orignal spline.  This could cause a problem in certain circumstances.  Improvedments to the code are welcomed.

Lee 

;;(defun c:splinepipe (/ dia r p more spl slope perslope smax pStart pEnd p1 p2 p3 )
(defun c:splinepipe (/  )
; Creates offset spline with eliipses at their ends for a series of
; user specified spline fit points.
; L. Minardi 9/24/2024  
(setq dia  (getreal "\nEnter pipe diameter: ")
      r	   (/ dia 2.)
      p	   (getpoint "\nEnter spline start point: ")
      more T
)
(command "_spline")
(while more
  (command p)
  (setq p (getpoint p "\nEnter next spline fit point: "))
  (if (not p)
    (setq more nl)
  )
)
(command "" "" "")
(setq spl      (entlast)
      slope    (unitvec (vlax-curve-getfirstDeriv spl 0))
      perslope (list (cadr slope) (- (car slope)) 0.0)
      smax     (vlax-curve-getEndParam spl)
      pStart   (vlax-curve-getPointAtParam spl 0)
      p1       (mapcar '+ pStart (mapcar '* perslope (list r r r)))
      p2       (mapcar '- pStart (mapcar '* perslope (list r r r)))
      p3       (mapcar '+
		       pStart
		       (mapcar '* slope (list (/ r 2) (/ r 2) (/ r 2)))
	       )
)
(command "_offset" r pStart "_non" p1 "")
(command "_offset" r pStart "_non" p2 "")
(command "_ellipse" "_non" p1 "_non" p2 "_non" p3)
(setq
  slope	   (unitvec (vlax-curve-getfirstDeriv spl smax))
  perslope (list (cadr slope) (- (car slope)) 0.0)
  pEnd	   (vlax-curve-getPointAtParam spl smax)
  p1	   (mapcar '+ pEnd (mapcar '* perslope (list r r r)))
  p2	   (mapcar '- pEnd (mapcar '* perslope (list r r r)))
  p3	   (mapcar '+
		   pEnd
		   (mapcar '* slope (list (/ r 2) (/ r 2) (/ r 2)))
	   )
)
(command "_ellipse" "_non" p1 "_non" p2 "_non" p3)
(command "_erase" spl "")
(princ)
)

; Unit vector of v
(defun unitvec (v / x)
  (setq	x (distance '(0 0 0) v)
	x (mapcar '/ v (list x x x))
  )
)

 

lee.minardi
0 Likes
Message 10 of 16

Kent1Cooper
Consultant
Consultant

A few things to think about:

 

You could eliminate the 'p3' variable with its calculation, by using the ELLIPSE command's Rotation option instead of specifying a perpendicular-axis endpoint.  Remove lines 41 through 44, and at line 46:

  (command "_.ellipse" "_non" p1 "_non" p2 "_rotation" 60)

[or some other number at the end, if you don't like the resulting proportion of that].  [But see below about p1 & p2.]

 

Should line 16 be:

  (setq more nil)

?  [As it is, it will have the same effect, but only because 'nl' itself doesn't exist and therefore returns nil.  But that could be anything:  (setq more MarilynMonroe).]

 

If you make a VLA-object out of the original Spline, you can use (vla-offset) on it with positive r and negative r, to Offset it to both sides, instead of needing to pick points for the side in Offset commands.  Save each result to a variable, and you can use (vlax-curve-getStartPoint) and (...EndPoint) functions on them for the Ellipse axis endpoints, and don't need two rounds of all the vectors and slopes and (mapcar)s and p1's and p2's.

Kent Cooper, AIA
0 Likes
Message 11 of 16

Washingtonn
Collaborator
Collaborator

It looks like you are requesting two different things - one is a pipe end that terminates within the manhole, the other is the flow path at the bottom of the manhole. Here is my take on the latter.

 

 

Washingtonn_0-1727205874367.png

 

0 Likes
Message 12 of 16

jeff.wangD95HG
Collaborator
Collaborator

"The other is the flow path at the bottom of the manhole"

yea all I need is this.

and I think your explanation pretty much matches exactly what I wanted it to do. I am gonna steal your picture and ask in dynamic blocks first.  the idea is for it to be highly mutable

 

if i want to create a function for it, then i would make it so i can let it read an excel file with all the necessary data and just output all the needed flow path without it being highly mutable.

0 Likes
Message 13 of 16

pendean
Community Legend
Community Legend

@jeff.wangD95HG wrote:

yes i am using civil 3d...


Any reason you don't wish to ask in the C3D forum, or better yet, the dedicated C3D Customization forum?

here is the link to the latter

https://forums.autodesk.com/t5/civil-3d-customization/bd-p/190 

pendean_0-1727210683658.png

 

0 Likes
Message 14 of 16

leeminardi
Mentor
Mentor

@Kent1Cooper thanks for looking over my code.


@Kent1Cooper wrote:

A few things to think about:

 

You could eliminate the 'p3' variable with its calculation, by using the ELLIPSE command's Rotation option instead of specifying a perpendicular-axis endpoint.  Remove lines 41 through 44, and at line 46:

  (command "_.ellipse" "_non" p1 "_non" p2 "_rotation" 60)

[or some other number at the end, if you don't like the resulting proportion of that].  [But see below about p1 & p2.]

I'm not sure this suggestion saves much if anything.  The angle woud need to be calculated instead of p3.

Should line 16 be:

  (setq more nil)?

Thanks for catching this typo.

  [As it is, it will have the same effect, but only because 'nl' itself doesn't exist and therefore returns nil.  But that could be anything:  (setq more MarilynMonroe).]

"MarilynMonroe"?  You're dating yourself!😊

 

If you make a VLA-object out of the original Spline, you can use (vla-offset) on it with positive r and negative r, to Offset it to both sides, instead of needing to pick points for the side in Offset commands.  Save each result to a variable, and you can use (vlax-curve-getStartPoint) and (...EndPoint) functions on them for the Ellipse axis endpoints, and don't need two rounds of all the vectors and slopes and (mapcar)s and p1's and p2's.

I'm still breaking the ice with vlax functions. It's not clear to me when to pursue non-vlax based tactics and when to go with vlax functions when both strategies yield desirable results.


It looks like I misinterpreted the OP's needs as it looks like he want a dynamic block approach. Oh well.

lee.minardi
0 Likes
Message 15 of 16

Kent1Cooper
Consultant
Consultant

@leeminardi wrote:
....

  (command "_.ellipse" "_non" p1 "_non" p2 "_rotation" 60)

....

I'm not sure this suggestion saves much if anything.  The angle woud need to be calculated instead of p3.

KC:  Not really.  Rotation as an option in ELLIPSE is not what you apparently think, but the rotation into the 3rd dimension of a Circle that would produce the appearance that results if that 3D rotated [virtual] Circle were flattened into the drawing plane.  [Experiment with it.]  The axis endpoints are still picked, so the direction between them doesn't need to be calculated.  60 makes a pretty good imitation of the example -- greater number = skinnier Ellipse.

....

"MarilynMonroe"?  You're dating yourself!😊

KC:  One of the historical things that happened on my birthday was her death (my 10th birthday), that is, the discovery of her body (she might have died late the day before).

....

I'm still breaking the ice with vlax functions. It's not clear to me when to pursue non-vlax based tactics and when to go with vlax functions when both strategies yield desirable results.

KC:  For (vlax-curve-...) class objects, a lot of things can be done with them using those functions with less code, because those will accept regular entity names, so no VLA-object conversion is needed [and they do also accept VLA objects if there's other reason to convert them].


....


 

Kent Cooper, AIA
0 Likes
Message 16 of 16

leeminardi
Mentor
Mentor

@Kent1Cooper 


@Kent1Cooper wrote:

@leeminardi wrote:
....

  (command "_.ellipse" "_non" p1 "_non" p2 "_rotation" 60)

....

I'm not sure this suggestion saves much if anything.  The angle woud need to be calculated instead of p3.

KC:  Not really.  Rotation as an option in ELLIPSE is not what you apparently think, but the rotation into the 3rd dimension of a Circle that would produce the appearance that results if that 3D rotated [virtual] Circle were flattened into the drawing plane.  [Experiment with it.]  The axis endpoints are still picked, so the direction between them doesn't need to be calculated.  60 makes a pretty good imitation of the example -- greater number = skinnier Ellipse.

 


I had not noticed the "rotation" option for the ellipse command.  Silly me, I thought it would rotate the ellipse!  What it does (as you know) is to create a projection of a circle from a plane defined by the rotation angle about the axis defined by the major axis of the ellipse.  An angle of zero yields a circle while an angle of 90 yields a line.  To get the equivalent of an isometric ellipse for the top of a 2D isometric cube you can create an ellipse with a horizontal major axis and rotate it by an angle of 54.7356° (90 - atan(1/sqrt(2)).  Your choice of 60 is close enough.

lee.minardi
0 Likes