Jump to content

Polylines with square endings


NNJ

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Yes, there is a prompt for that. Only problem is, this site has rules against doing homework assignments for people... :geek:

 

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...