NNJ Posted May 24, 2010 Posted May 24, 2010 Hy there, I`m a newbie in AutoLISP and I have some homeworks to do, I would be grateful if anyone could help me in solving them. One of them is: For a selected set of polylines I have to mark all the ends of the polylines with squares. The square side is given by the user. Thank you Quote
NNJ Posted May 24, 2010 Author Posted May 24, 2010 Maybe is just a coincidence, because I didn`t saw the thread and I don`t know if any of my colleagues joined this forum, the thing is that everyone in my class has his own homework, and we didn`t do enough laboratories to understand how things work, so if you could help me, I would be greatful. Quote
NNJ Posted May 24, 2010 Author Posted May 24, 2010 yes, that is it only that the squares side is given by the user Quote
Lee Mac Posted May 24, 2010 Posted May 24, 2010 Yes, there is a prompt for that. Only problem is, this site has rules against doing homework assignments for people... I would point you in the direction of these sites: http://www.afralisp.net/ http://www.jefferypsanders.com/autolisptut.html http://ronleigh.info/autolisp/index.htm Quote
Lee Mac Posted May 24, 2010 Posted May 24, 2010 Think about how to approach such a problem, in psuedo-code: Prompt user for selection of Polylines (can also include lines, arcs etc) - look into ssget function, with a filter. Prompt for user specification of side length - look into getdist function so that the user can pick the length too. Iterate through the selection set and look at each entity in turn. Get the Start/End Points of each entity (perhaps with vlax-curve-getStartPoint / getEndPoint) Create a Square at the Start Point (either using a command call (think about OSnap in this case), or look into entmake(x) - perhaps use the polar function to get the location of the points of the square). Before making a square at the End Point, check the Start and End points aren't the same (e.g. in the case of a closed polyline) - look into the IF function, and also the equal function. Lee Quote
alanjt Posted May 24, 2010 Posted May 24, 2010 Out of curiosity, in an AutoLISP class, do the teach the Visual LISP commands, or is it all AutoLISP? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.