Jump to content

make a multiple point distance command??


Recommended Posts

Posted

can any one tell me if its possible to have a command which does a multiple distance? at the moment im drawing a polyline, doing a list on it then deleting it, which is a bit mudane now.lol

 

any help would be great:)

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • GE13579

    5

  • PS_Port

    2

  • raj banerjee

    2

  • Tiger

    1

Posted

Not sure if it helps, but I'd just use DIST then pick start and endpoint (assuming all straight lines), then right click and repeat... is it for just noting down the lengths?

Guest Alan Cullen
Posted

It would be relatively simple to do in lisp. Come to think of it, it would be handy to have. I'll knock it out at lunch time.

 

GE13579, I think he wants to measure around curves.

Posted

There has to be a more simplified way than this, but my Lisp is basic so this is my solution.

This first lisp is a multiple distance routine from the one starting point to multiple second points.

 

 
(defun c:mdist1 (/ pt1 pt2 dist)
(setq pt1 (getpoint "\nSpecify first point (hit Enter to Exit):"))
   (while
(setq pt2 (getpoint "\nSpecify next point:"))
(setq dist (strcat "Distance = " (rtos(distance pt1 pt2))))
(print)
(prompt dist)
   )
)

 

And this one is a multiple distance selecting start and second point each time.

 

 
(defun c:mdist (/ pt1 pt2 dist)
   (while
(setq pt1 (getpoint "\nSpecify first point (hit Enter to Exit):"))
(setq pt2 (getpoint "\nSpecify next point:"))
(setq dist (strcat "Distance = " (rtos(distance pt1 pt2))))
(print)
(prompt dist)
   )
)

 

This all seems to complicated for a simple task, so feel free to simplify.

 

Hope this helps Raj, (couldn't let Alan beat me):)

Guest Alan Cullen
Posted

Thanks for that code, Paul. I have modified it slightly.

 

raj banerjee,

 

See if this does what you want:

 

(defun c:mdi ()
(princ "\n Multi-DIST samt Ackumulerad längd  -  Oktober 2007 - CadTutor.net Forum")
(setq ad 0)
(setq pt1 (getpoint "\nVälj första punkten <tryck Enter för att avsluta>"))
(while
 (setq pt2 (getpoint pt1 "\nVälj nästa punkt <tryck Enter för att avsluta>"))
 (setq sd (distance pt1 pt2))
 (setq ad (+ ad sd))
 (setq pt1 pt2)
 (prompt (strcat "\n Del längd = "(rtos sd)"   Ackumulativ Längd = "(rtos ad) ))
)
(princ)
)

 

Paul, I accept that you won.

Posted

Thats a sweet modification alan, thanks :)

just one thing, shouldn't you localize the variables :huh:

 

I'm usually not this picky:lol:

Guest Alan Cullen
Posted

You can if you wish, but with todays computers, it is not necessary.

Posted

thats the bollox!!! cheers to both of you

Posted

*Tiger sneaking in, steals the lisp, and sneaks out, sniggering* :P

Posted

Very nice Alan, but...

 

GE13579, I think he wants to measure around curves.

 

Is it possible to have it work on arcs as well?:huh:

 

It would be mighty handy if it could...?:roll:

Guest Alan Cullen
Posted

I've been thinking about that all afternoon, it would definitely be handy if it could, but I have my doubts. However, I will keep thinking about it. :geek:

Posted
...it would definitely be handy if it could, but I have my doubts.

 

I thought that might be the case :unsure:

 

Just as a thought as I have no clue as to the capability of these Lisp routines :oops: ... would it be possible to select the object, and then get something to take info from the properties box (length/ arc length) and then add subsequent selections to the total?

 

PS I hope you can understand what I'm saying here as I'm struggling myself :? :lol:

Guest Alan Cullen
Posted

Thats a damn good idea....and yes it can easily be done. Give me more on the specific situation you are talking about.

Posted

Cool...:)

 

The instance is where I am doing pre- design on conveyors, it would be a useful way of calculating the full length of a given conveyor which might arc, then run straight, arc, straight.... etc. I'm only drawing in 2D if that helps?

 

Looking forward to your response...:D

Guest Alan Cullen
Posted

So you want the total length of a conveyor belt? You could turn all the components into a polyline and LIST it...is there a reason why you don't want to do that?

Posted
You could turn all the components into a polyline and LIST it

 

This is true, but I prefer to keep lines and arcs separate... keeps them easier to modify... and they are sometimes broken anyway... but...

 

Don't you think it can be made with the well known lisp TLEN?

 

This is exactly what I was after thank you Riga!!! I really need to learn something about programming these Lisp routines! :oops:

 

Thanks for your help guys :D

  • 1 year later...
Posted

TLEN was just what the doctored ordered.. Got to love the net..

  • 2 years later...

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...