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

Pline vertex group code

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
473 Views, 7 Replies

Pline vertex group code

I am trying to collect a group of lines and convert them to a polyline.
Then I want to be able to pick the start point of the pline so when the
drawing is exported to a CNC Router the cut is going the correct direction.
Here is what I have so far. Thanks for any help.

Ken Alexander

(defun C:makepline (/ lines lineinfo info spnt mspnt nspnt)
(setq lines (ssget '(
(-4 . " (0 . "LINE")
(0 . "arc")
(-4 . "or>")
)
)
)
(command "pedit" lines "y" "j" lines "" "w" "1" "")
(setq info (entget (entlast))
spnt (cdr (assoc 10 info))
mspnt (getpoint "\Pick new start point: ")
info (subst (cons 10 mspnt) (assoc 10 info) info)
info (subst (cons 8 "LF_25") (assoc 8 info) info)
nspnt (cdr (assoc 10 info))
)
(entmod info)
(alert
(strcat "Pline created on layer: " (cdr (assoc 8 info)))
)
(princ)
)
7 REPLIES 7
Message 2 of 8
BillZ
in reply to: Anonymous

Hi Ken,
Assoc 10 of the polyline is a "dummy" point, not the startpoint of the polyline (LW or Regular). The "start point" would be one of the vertices or vertexes of the pline. The order or direction of the polyline seems to have something to do with the direction of the entities selected when making the pline. Picking the entities in a different order sometimes determines the direction that the pline travels. I haven't got it figured out yet but I know if there are several lines selected, the polyline tends to go in the direction of the lines (start point to endpoint), I think if an arc is selected first, it can go in the direction of the arc. One program I wrote I had to figure out the direction that the boundary I was using traveled, then made adjustments to get the tool path going the way I wanted.

Hope this helps.

BillZ
Message 3 of 8
Anonymous
in reply to: Anonymous

Billz,
Thanks for replying.
If you notice when drawing a pline then edit the vertices, the first vertex
given for edit is always the "startpoint" of the pline. I guess what I
would need to do is loop through the pline and set a variable to every
vertex found then redraw the pline in the order wished. I am not sure how
to loop through to get all the verices.

--
Ken Alexander
Acad 2000
Win 2000
"BillZ" wrote in message
news:f0cc616.0@WebX.maYIadrTaRb...
> Hi Ken,
> Assoc 10 of the polyline is a "dummy" point, not the startpoint of the
polyline (LW or Regular). The "start point" would be one of the vertices or
vertexes of the pline. The order or direction of the polyline seems to have
something to do with the direction of the entities selected when making the
pline. Picking the entities in a different order sometimes determines the
direction that the pline travels. I haven't got it figured out yet but I
know if there are several lines selected, the polyline tends to go in the
direction of the lines (start point to endpoint), I think if an arc is
selected first, it can go in the direction of the arc. One program I wrote I
had to figure out the direction that the boundary I was using traveled, then
made adjustments to get the tool path going the way I wanted.
> Hope this helps.
>
> BillZ
>
>
Message 4 of 8
Anonymous
in reply to: Anonymous

If you need just to know the direction, then download PolyDir.lsp from my Freebies page.

--
John Uhden, Cadlantic/formerly CADvantage
[ mailto:juhden@cadlantic.com ]
[ http://www.cadlantic.com ]
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711


"Ken Alexander" wrote in message news:951761FB733AF135488EBE765D7D875A@in.WebX.maYIadrTaRb...
> I am trying to collect a group of lines and convert them to a polyline.
> Then I want to be able to pick the start point of the pline so when the
> drawing is exported to a CNC Router the cut is going the correct direction.
> Here is what I have so far. Thanks for any help.
>
> Ken Alexander
>
> (defun C:makepline (/ lines lineinfo info spnt mspnt nspnt)
> (setq lines (ssget '(
> (-4 . " > (0 . "LINE")
> (0 . "arc")
> (-4 . "or>")
> )
> )
> )
> (command "pedit" lines "y" "j" lines "" "w" "1" "")
> (setq info (entget (entlast))
> spnt (cdr (assoc 10 info))
> mspnt (getpoint "\Pick new start point: ")
> info (subst (cons 10 mspnt) (assoc 10 info) info)
> info (subst (cons 8 "LF_25") (assoc 8 info) info)
> nspnt (cdr (assoc 10 info))
> )
> (entmod info)
> (alert
> (strcat "Pline created on layer: " (cdr (assoc 8 info)))
> )
> (princ)
> )
>
>
>
Message 5 of 8
Anonymous
in reply to: Anonymous

I need to know the direction, but also be able to change directions. Thanks.

--
Ken Alexander
Acad 2000
Win 2000
"John Uhden" wrote in message
news:571D8DB532D73AB4BFAC354449B430E0@in.WebX.maYIadrTaRb...
> If you need just to know the direction, then download PolyDir.lsp from my
Freebies page.
>
> --
> John Uhden, Cadlantic/formerly CADvantage
> [ mailto:juhden@cadlantic.com ]
> [ http://www.cadlantic.com ]
> 2 Village Road
> Sea Girt, NJ 08750
> Tel. 732-974-1711
>
>
> "Ken Alexander" wrote in message
news:951761FB733AF135488EBE765D7D875A@in.WebX.maYIadrTaRb...
> > I am trying to collect a group of lines and convert them to a polyline.
> > Then I want to be able to pick the start point of the pline so when the
> > drawing is exported to a CNC Router the cut is going the correct
direction.
> > Here is what I have so far. Thanks for any help.
> >
> > Ken Alexander
> >
> > (defun C:makepline (/ lines lineinfo info spnt mspnt nspnt)
> > (setq lines (ssget '(
> > (-4 . " > > (0 . "LINE")
> > (0 . "arc")
> > (-4 . "or>")
> > )
> > )
> > )
> > (command "pedit" lines "y" "j" lines "" "w" "1" "")
> > (setq info (entget (entlast))
> > spnt (cdr (assoc 10 info))
> > mspnt (getpoint "\Pick new start point: ")
> > info (subst (cons 10 mspnt) (assoc 10 info) info)
> > info (subst (cons 8 "LF_25") (assoc 8 info) info)
> > nspnt (cdr (assoc 10 info))
> > )
> > (entmod info)
> > (alert
> > (strcat "Pline created on layer: " (cdr (assoc 8 info)))
> > )
> > (princ)
> > )
> >
> >
> >
Message 6 of 8
BillZ
in reply to: Anonymous

Here is a program I have never used, it's supposed to reverse a polyline.

Bill
Message 7 of 8
kcalexander71
in reply to: Anonymous

Thanks BillZ
That is what I was looking for.

Ken Alexander
Message 8 of 8
BillZ
in reply to: Anonymous

You are most welcome.

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

Post to forums  

Autodesk Design & Make Report

”Boost