Visual LISP, AutoLISP and General Customization

Reply
*Alexander, Ken
Message 1 of 8 (50 Views)

Pline vertex group code

50 Views, 7 Replies
03-30-2002 02:17 AM
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)
)
Distinguished Contributor
Posts: 4,707
Registered: ‎12-12-2003
Message 2 of 8 (50 Views)

Re: Pline vertex group code

03-31-2002 07:59 PM in reply to: *Alexander, Ken
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
*Alexander, Ken
Message 3 of 8 (50 Views)

Re:

03-31-2002 09:06 PM in reply to: *Alexander, Ken
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
>
>
*Uhden, John
Message 4 of 8 (50 Views)

Re: Pline vertex group code

03-31-2002 09:22 PM in reply to: *Alexander, Ken
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)
> )
>
>
>
*Alexander, Ken
Message 5 of 8 (50 Views)

Re:

03-31-2002 09:29 PM in reply to: *Alexander, Ken
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)
> > )
> >
> >
> >
Distinguished Contributor
Posts: 4,707
Registered: ‎12-12-2003
Message 6 of 8 (50 Views)

Re:

03-31-2002 09:56 PM in reply to: *Alexander, Ken
Here is a program I have never used, it's supposed to reverse a polyline.

Bill
Contributor
Posts: 25
Registered: ‎03-30-2003
Message 7 of 8 (50 Views)

Re:

04-02-2002 03:20 AM in reply to: *Alexander, Ken
Thanks BillZ
That is what I was looking for.

Ken Alexander
Distinguished Contributor
Posts: 4,707
Registered: ‎12-12-2003
Message 8 of 8 (50 Views)

Re:

04-02-2002 03:41 AM in reply to: *Alexander, Ken
You are most welcome.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community