Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sweep multple polylines at once. Code does not work *yet*

53 REPLIES 53
Reply
Message 1 of 54
l.l.oldescholtenhuis
6128 Views, 53 Replies

sweep multple polylines at once. Code does not work *yet*

Hi There,

 

I'm using AutoCAD Civil 3D to model inner city utility construction projects. For my research project, I need to include water and storm pipes, but also various sorts of cables. Currently, I'm manually creating cables profiles using plines from existing 2D drawings and the sweep function.. a very cumbersome taks. 

 

I was wondering whether there is a way to speed this process up. At the moment, I draw a circle, copy it myriads of times, and sweep each along the dozens of plines (one by one). I cannot select multiple lines and sweep them all, can I?

 

I posed a this question: "Can anybody tell me whether I can select mutiple plines to sweep all at once?" and was directed at the following code in the civil3D forum.

 

(defun c:sweepm ()
(princ "\PSelect objects to sweep: ")
(setq pick1 (ssget))
(princ "\nSelect sweep paths: ")
(setq ss (ssget '((0 . "LINE,*POLYLINE,3dpoly"))))
(setq NumPath (sslength ss) Count 0)
(repeat NumPath
(setq Ename (ssname ss Count))
(command "sweep" pick1 "" Ename)
(repeat NumPath
(setq Count (+ 1 count))
)
(princ)
)

 

 

I tried to implement it via VLISP. However, although the selection features allow me to select multiple objects and plines, autocad eventually only sweeps one line. Does anybody know why?

 

53 REPLIES 53
Message 41 of 54
danaag
in reply to: hmsilva

Thats great, thank you!

Message 42 of 54

Hi Kent, 

 

Ill try to implement your suggested code, I've been away for a while. Again, thanks a lot for your help till so far!

 

Léon

Message 43 of 54
hmsilva
in reply to: danaag

You're welcome, danaag
Glad I could help

Henrique

EESignature

Message 44 of 54
konrad.r.koltun
in reply to: hmsilva

I was wondering if this lisp could be adjusted to work with rectangles rather than circles by any chance?

Thanks!

Message 45 of 54
hmsilva
in reply to: konrad.r.koltun


@konrad.r.koltun wrote:

I was wondering if this lisp could be adjusted to work with rectangles rather than circles by any chance?

Thanks!


Hello Konrad and welcome to the Autodesk Community!

 

Can you be more specific concerning which code you want to modify,

 

Henrique

EESignature

Message 46 of 54

I was also wondering if the code could be altered to allow a rectangular polyline to be used as the object to sweep (by either selecting the polyline to use or entering values for the length/width of the recangular polyline)

Thanks

Joe
Message 47 of 54

Apologies, i think it was the second code that was posted
Message 48 of 54


@joewainwright90 wrote:
Apologies, i think it was the second code that was posted

... still not quite clear to me which one -- if one of mine, are you talking about the code in Message 7?  19?  25?  32?  Or someone else's?

Kent Cooper, AIA
Message 49 of 54

Just saw this thread.

I realized four years ago the pipe network objects were not suited to production, so did routines that turn c3d alignments into 3d polys and sweep on them.

It allows both circles and rectangles, and works great.

The tool does suffer from the limitations of the sweep command.

Sweep does not like sharp angles and certain things I have not yet figured out.

So if you break the 3d poly at sharp points, it works on both but not if they are one.

to deal with that, we use:

 

(SETVAR "DELOBJ" 0)

(vl-catch-all-apply '(lambda () (COMMAND ".SWEEP" CIRCENAME "" PL-ENAME)))

 

so it does not crash the routine.

see pics of what we do.

Believe me, pipe networks are rediculous compared to making pipes like this.

Notice the pipes keep going in the distance. That is about 1/10th of what we did complete with bridges and so on.

3D modeling is easy, its C3D that makes it hard if you try to do all that.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 50 of 54


@joewainwright90 wrote:
I was also wondering if the code could be altered to allow a rectangular polyline to be used as the object to sweep (by either selecting the polyline to use or entering values for the length/width of the recangular polyline)
....

For a square section, see TubeSquare.lsp with its TUBESQ command, here.  There are some caveats described there.  I may do a version that asks for rectangle length and width, some day soon....

Kent Cooper, AIA
Message 51 of 54
Kent1Cooper
in reply to: Kent1Cooper


@Kent1Cooper wrote:
For a square section, see TubeSquare.lsp with its TUBESQ command, here.  There are some caveats described there.  I may do a version that asks for rectangle length and width, some day soon....

Here's a Rectangle version, subject to the same caveats about orientation of the rectangle for paths that don't lie nicely in (or parallel to) the WCS plane.

Kent Cooper, AIA
Message 52 of 54
JamesMaeding
in reply to: Kent1Cooper

what is the advantage of extrude instead of sweep?

I thought sweep dealt with keeping the shape normal to the 3d pline as it goes along.

Also, sweep does not need a rectangle drawn in same plane as start of 3d pline. Seems like extrude is a hassle to me.

 

Are you trying to control the "twist" that sweep will do just a bit? Its almost not noticable though.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 53 of 54
Kent1Cooper
in reply to: JamesMaeding


@jmaeding wrote:

what is the advantage of extrude instead of sweep?

I thought sweep dealt with keeping the shape normal to the 3d pline as it goes along.

Also, sweep does not need a rectangle drawn in same plane as start of 3d pline. Seems like extrude is a hassle to me.

 

Are you trying to control the "twist" that sweep will do just a bit? Its almost not noticable though.

 


The "advantage" is only that I have an older version of AutoCAD here, without the Sweep command.  I imagine it wouldn't be hard for somebody to adjust it to use that command, but I can't test it here.

Kent Cooper, AIA
Message 54 of 54
JamesMaeding
in reply to: Kent1Cooper

oh, minor detail 🙂

Bricscad 14.2 just got the command, 13 did not have it.

I keep looking for a way to get around the fact that sweep fails here and there.

It locks up acad sometimes too for some reason.

 

What I plan to do is write a .net routine that creates the swept solid so I can error catch better.

If it fails, I can have it try to locate the fail point(s) but I do not understand why they fail yet.

If we could make extrude do the job, or some other method like lofting a bunch of circles, I am open to it if it was more dependable.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost