NNJ Posted May 24, 2010 Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted May 24, 2010 Share Posted May 24, 2010 It seems you guys are doing the same course... Quote Link to comment Share on other sites More sharing options...
NNJ Posted May 24, 2010 Author Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted May 24, 2010 Share Posted May 24, 2010 So you are looking to do something like this? Quote Link to comment Share on other sites More sharing options...
NNJ Posted May 24, 2010 Author Share Posted May 24, 2010 yes, that is it only that the squares side is given by the user Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 24, 2010 Share 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 Link to comment Share on other sites More sharing options...
NNJ Posted May 24, 2010 Author Share Posted May 24, 2010 And than how could we resolve this matter? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 24, 2010 Share 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 Link to comment Share on other sites More sharing options...
NNJ Posted May 24, 2010 Author Share Posted May 24, 2010 ok I will do that. Thank you for your help Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 24, 2010 Share Posted May 24, 2010 You're welcome Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 24, 2010 Share Posted May 24, 2010 Out of curiosity, in an AutoLISP class, do the teach the Visual LISP commands, or is it all AutoLISP? Quote Link to comment Share on other sites More sharing options...
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.