I meet a problem when use AutoLISP:
There is a long , straight line going through a circle. I just want to
trim off the part inside this circle ,and of course to remain the
outside part of this line.
Does anyone know how to do that by using AutoLISP? Hope your answer
might be as simple as possilble, I am just a begineer to use LISP.
(command "trim" "" pt "")
pt must be defined as a varible and be the endpoint of the line to trim.
This line can be placed in your autolisp routine after the endpoint of your
line has been set to the varible pt.
I used this method when I first started learning autolisp but defining the
of the lines and drawing the lines from pointa to pointb is a cleaner way to
same end result. imo
Although with radii it does involve a bit of math to define the points to
draw the line.
I can think of two approaches right off.
One is to actually "trim" it by a command call, selecting the two items, and
using a point inside the circle (easily generated from the circle's center
another is to find the intersections of the line and circle, the endpoints
of the line, and erase the original line and create two lines using the
Both approaches have their challenges.
Have fun, and post some code as you work it out. I'm sure you'll get some
help if needed...
why climb the mountain? because it is there.
why decend into the valley? because it isn't there
writing code is fun, end of why.
I make the bold assumption that either you just want to know how to do
it for achidemic reasons, or you intend to do it very many times.
Michael is (damn it) right again. I like the more complicated way
because in the long run you can do more interesting stuff.
So I would add this. You can make your selection sets by picking
entities. (the line and the circle) For that you went to too much work.
You can also use ssx to select by filters and get ALL the circles of a
particular layer ( or particular radius, radius & layer, linetype,
whatever ) and get all the lines of a particular type. without actually
picking on the screen.
Colour me anal retentive, but I do my utmost to avoid the word "command"
in any lisp. It just isn't right. Once you have the ename of the line
you want to "trim" you have choices. Erase the old and create two new
entities, or modify the old and create one new. Create a copy of the old
line in a new layer. Sum the lengths of the two new lines........
And all this is pretty simple. Error checking, now that't hard.
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.