• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

discretize a polyline with constant ascisses

  • Thread starter Thread starter Counterblow Hammer
  • Start date Start date

Counterblow Hammer

Guest
Good morning!

are a mechanical expert in the area of the Treviso that deals with hot stamping.

I am currently implementing a system for the determination of the axisimmetric pieces that put me in front of the following problem: discuss a polyline with constant ascisses. in practice: I take a polyline, the long project y on the x axis and get a line; I discrete this line in n points; After that I would need to redesign along y such points until my starting polyline. I already have a lisp to extremize the x-y coordinates of such points.

I kindly ask those who know more about me if you have any idea to do this; or some other way to get the same result described above.

Thank you so much in advance!
 
numbers indicate the order of steps to be executed.

keep in mind that such work should do so with a number of points hardly less than 100.. .
 

Attachments

I hope I understand, see if the lisp is your case.
Code:
(defun c:dpoly)

(vl-load-com)
(prompt "\n*")
(setq _poly (vlax-name->vla-object (because (entsel "\nselezioneare la polilinea ")))))
(if)
(/= (vlax-get _poly 'objectname) "acdbpolyline")
(/= (vlax-get _poly 'objectname) "acdb2dpolyline")
)
(progn
(alert "the oggetto selezionato non è una polilinea 2d ")
(exit)
)
)
(prompt "\n*")
(setq n_div (getint "\nnumero di divisioni orizzontali "))
(setq p1 (vlax-curve-getstartpoint _poly))
(setq p2 (vlax-curve-getendpoint _poly))
(setq p3 (list (min (car p1) (car p2)) 0.0)
(setq p4 (list (max (car p1) (car p2))
(setq div (/ (distance p3 p4) n_div))
(setq p5 p3)
(peat (- n_div 1)
(setq p5 (polar p5 0 div))
(entmake
(list
(cons 0 "line")
(Cons 8 (getvar "clayer"))
(cons 10 p5)
(Cons 11 (polar p5 (/ pi 2) 1.0))
)
)
(setq lin_v (entlast))
(setq p_int (vlax-invoke (vlax-name->vla-object lin_v) 'intersectwith _poly acextentisity))
(entdel lin_v)
(entmake
(list
(cons 0 "point")
(Cons 8 (getvar "clayer"))
(cons 10 p_int)
)
)
)
)
 
I hope I understand, see if the lisp is your case.
Code:
(defun c:dpoly)

(vl-load-com)
(prompt "\n*")
(setq _poly (vlax-name->vla-object (because (entsel "\nselezioneare la polilinea ")))))
(if)
(/= (vlax-get _poly 'objectname) "acdbpolyline")
(/= (vlax-get _poly 'objectname) "acdb2dpolyline")
)
(progn
(alert "the oggetto selezionato non è una polilinea 2d ")
(exit)
)
)
(prompt "\n*")
(setq n_div (getint "\nnumero di divisioni orizzontali "))
(setq p1 (vlax-curve-getstartpoint _poly))
(setq p2 (vlax-curve-getendpoint _poly))
(setq p3 (list (min (car p1) (car p2)) 0.0)
(setq p4 (list (max (car p1) (car p2))
(setq div (/ (distance p3 p4) n_div))
(setq p5 p3)
(peat (- n_div 1)
(setq p5 (polar p5 0 div))
(entmake
(list
(cons 0 "line")
(Cons 8 (getvar "clayer"))
(cons 10 p5)
(Cons 11 (polar p5 (/ pi 2) 1.0))
)
)
(setq lin_v (entlast))
(setq p_int (vlax-invoke (vlax-name->vla-object lin_v) 'intersectwith _poly acextentisity))
(entdel lin_v)
(entmake
(list
(cons 0 "point")
(Cons 8 (getvar "clayer"))
(cons 10 p_int)
)
)
)
)
A dragon!

Thank you very much!...
 
another way, among the many, to solve the problem, in the field of visuallisp.
I usually use discussions for personal purpose to try new functions; However, in this way, I always arrive late in providing a solution; I hope at least it serves as a point to others.
 

Attachments

another way, among the many, to solve the problem, in the field of visuallisp.
I usually use discussions for personal purpose to try new functions; However, in this way, I always arrive late in providing a solution; I hope at least it serves as a point to others.
works, but with a small problem: it takes the divisions on the opposite side of the polylinea. in the sense that it starts from the extreme final and then develops towards the positive ascisses, that is from the part where the polylinea does not exist... .
 
definitely your polylinea has been designed from right to left.
This is the modified code.
of course the points are returned from right to left; if you want them sorted from right to right it is enough to add to the end the code:
(setq pts)
 

Attachments

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
ciao
Back
Top