@faridfarmani2000 wrote:
Hey, Gordon. What if we have a polyline?
May not be watching after all these years, so....
If you want to get the start and end points of a Polyline from the entity data list [if in a 'data' variable as in previous posts], all vertices are in (assoc 10) entries. You could do this:
(setq start (cdr (assoc 10 data))); same as for a Line
But for the end:
(setq end (cdr (assoc 10 (reverse data)))); the last such entry
BUT if it's a closed Polyline, that will get the last vertex, not the end [which is at the same place as the start].
The other way, not involving the entity-data list [with LNAME being the entity name as in earlier posts]:
(setq
start (vlax-curve-getStartPoint LNAME)
end (vlax-curve-getEndPoint LNAME)
)
which will give you the actual end [back at the beginning] for a closed one, rather than the last vertex. You may need to run:
(vl-load-com)
to be able to use those functions.
Kent1Cooper wrote "May not be watching after all these years, so...."
By amazing coincidence after years of not being here, I arrived today and started browsing through recent posts to see one by me which was a surprise - well, well, strange coincidence - thanks for stepping in Kent
@Kent1Cooper wrote:
....
The other way...:
(setqstart (vlax-curve-getStartPoint LNAME)
end (vlax-curve-getEndPoint LNAME)
)
....
And by the way, that's a universal approach, and will get the start and end points from anything that has them -- not just a Line or Polyline, but an Arc, Circle, Ellipse, or Spline, and also the start point [only] of a Ray.
What would I do if I wanted to make a lisp that changed the start and end points of a line?
@erik.vold wrote:
What would I do if I wanted to make a lisp that changed the start and end points of a line?
There are several ways. Do you have the points defined/saved already somehow, or do you need to ask the User for them, or....? Also, since Message 1 talks in terms of a Line but the snippet of entity data shown is clearly about a Polyline, which are you actually asking about? [It would make a big difference to some of the alternative ways.]
Maybe I'm understanding wrong but the lisp above tells you the start and end point so then you could use that data in combination with another lisp to move the endpoints. I have a bunch of parts with bend lines on them and need to offset the ends of the bend lines .01" from the sides of the part.
Here's a link to another post I made about it.
Sorry the file I was trying to use before wasn't working but this one should. I need the blue LINE .01" away from the sides.