SWEEP coding

SWEEP coding

sanju.p
Enthusiast Enthusiast
2,316 Views
11 Replies
Message 1 of 12

SWEEP coding

sanju.p
Enthusiast
Enthusiast

Hi everyone,

 I was trying to define sweep (3D) in AutoLisp coding, but I am not know how to define the point in other direction.

So I request the member to let me know how to define it.

Just take bottle as example with circle definition.

 

 

Thanks in advance.

Basic Learner.

0 Likes
2,317 Views
11 Replies
Replies (11)
Message 2 of 12

Kent1Cooper
Consultant
Consultant

@sanju.p wrote:

....

 I was trying to define sweep (3D) in AutoLisp coding, but I am not know how to define the point in other direction.

....


I don't understand what you mean by "the point in other direction."  Can you post an image or small sample drawing, with before and after conditions, or describe what you would do manually that you want a routine to do for you?  Since I can more easily imagine what that phrase might mean if using EXTRUDE, might that be more appropriate than SWEEP for what you are trying to do?

Kent Cooper, AIA
0 Likes
Message 3 of 12

Ranjit_Singh
Advisor
Advisor

@sanju.p wrote:

Hi everyone,

 I was trying to define sweep (3D) in AutoLisp coding, but I am not know how to define the point in other direction.

..........


You need to work with the extrusion vector. See below example to sweep circle along a spline in 3d.

(defun c:somefunc  (/ ent ent2 etdata etdata2)
 (setq ent     (car (entsel "\nSelect circle: "))
       etdata  (entget ent)
       ent2    (car (entsel "\nSelect spline: "))
       etdata2 (entget ent2))
 (entmod
  (subst (cons 210
               (vlax-curve-getfirstderiv ent2 (vlax-curve-getparamatpoint ent2 (vlax-curve-getstartpoint ent2))))
         (assoc 210 etdata)
         etdata))
 (entmod (subst (cons 10 (trans (vlax-curve-getstartpoint ent2) 1 ent))
                (assoc 10 (setq etdata (entget ent)))
                etdata))
 (command "._sweep" "_m" "_su" ent "" ent2)
 (princ))

Sweep_along_spline.gif 

0 Likes
Message 4 of 12

sanju.p
Enthusiast
Enthusiast
Thank you for your reply sir,
I am trying to model bottle so I need sweep command. So I need coding for
sweep command to define.

#if you know the coding for bottle model kindly share me it sir.
0 Likes
Message 5 of 12

sanju.p
Enthusiast
Enthusiast
Thank you for your reply sir.

I am not able to understand your above coding.
I know basics.

My programme is as below as what I am trying.

(defun c:bottle()

(setq
p1(getpoint"pick point:")
p2(polar p1 (/ pi 2) 200)
)

(command
"circle" p1" 10"
"Sweep"............?

)

)

I feel the point p2 defined is wrong, I want to define it in perpendicular
direction.

Above coding in is just for example.
0 Likes
Message 6 of 12

Ranjit_Singh
Advisor
Advisor

Try below

(defun c:somefunc  ( / circ lin p1 p2)
 (setq p1 (getpoint "pick point:")
       p2 (polar p1 (/ pi 2) 200))
 (command "._line" p1 p2 "")
 (setq lin (entlast))
 (command "._circle" p1 " 10")
 (setq circ (entlast))
 (command "._sweep" circ "" lin))

sweep_circle.gif

 

0 Likes
Message 7 of 12

sanju.p
Enthusiast
Enthusiast
Thank you so much sir for your quick response.

#I will let you know by as soon as possible.
0 Likes
Message 8 of 12

Kent1Cooper
Consultant
Consultant

@sanju.p wrote:
....
I feel the point p2 defined is wrong, I want to define it in perpendicular direction.
....

Perpendicular to what?  It's already in a  perpendicular direction, but if you want a different one....  Do you mean you want it perpendicular to the drawing plane, that is, vertical, going upward in the Z direction?

 

(defun C:CYLV10200 (/ pt1 lin)
; = CYLinder, Vertical, 10-unit radius, 200-unit height (setq pt1 (getpoint "Point at center of Cylinder base: ")) (command "_.line" pt1 "@0,0,200" "") (setq lin (entlast)) (command
"_.circle" pt1 10 "_.sweep" (entlast) "" lin
)
)

Or, without the need for a Line as path along which to Sweep:

 

(defun C:CYLV10200 ()
 ; = CYLinder, Vertical, 10-unit radius, 200-unit height
  (command
"_.circle" (getpoint "Point at center of Cylinder base: ") 10 "_.extrude" (entlast) "" 200
) )

 

Kent Cooper, AIA
0 Likes
Message 9 of 12

devitg
Advisor
Advisor

Please show us , at least, your bottle sketch . 

 

 

May it can be solved with REVOLVE command , or with partials  LOFT  command  

0 Likes
Message 10 of 12

ActivistInvestor
Mentor
Mentor

@sanju.p wrote:
Thank you for your reply sir,
I am trying to model bottle so I need sweep command. So I need coding for
sweep command to define.

#if you know the coding for bottle model kindly share me it sir.

You wouldn't use the SWEEP command to model a bottle.

 

You would use the REVOLVE command, with a profile curve that represents the surface of the bottle (e.g., as it would appear in a quater-section through the center axis).

 

If you are trying to model a bottle as a simple surface, then a simple curve representing the profile will do. If you are trying to model the bottle fully, then a curve that has two offset segments where the offset distance represents the wall thickness of the bottle is required, and the curve would start and end on the axis of revolution.

0 Likes
Message 11 of 12

Ranjit_Singh
Advisor
Advisor

Also take a look at this thread.

Message 12 of 12

sanju.p
Enthusiast
Enthusiast
Thanks to everyone who has replied, at present my system is crashed.
So I am unable to reply.
0 Likes