×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

In response to thread555-151638

In response to thread555-151638

In response to thread555-151638

(OP)
I have a question about thread555-151638: Measuring Distance

I am running AutoCad Civil 3D 2007 and attempted to run the gel lisp posted by IFRs (Petroleum) on 7 Apr 06 18:53  

All lengths are calculated except for the polylines.  It says "0 objects found" when selecting any polyline.  Anyone with any suggestions?

CODE USED:

(DEFUN c:GEL ( / attr elength ss dst cnt) ; Adds the lengths of selected lines, arcs, circles, polylines, or splines
  (setq dst 0 cnt 0)(setvar "cmdecho" 0)
  (princ "= Get length...  Adds the lengths of selected lines, arcs, circles, polylines, or splines ")
  ;
(DEFUN attr (ent indx)(cdr (assoc indx ent)))
  ;
(DEFUN elength (ent / sa ea)
    (cond
      ((= (attr ent 0) "LINE")(distance (attr ent 10)(attr ent 11)))
      ((= (attr ent 0) "ARC")(setq sa (attr ent 50) ea (attr ent 51))
        (* (if (> ea sa)(- ea sa)(+ (- ea sa)(* 2 pi)))(attr ent 40)))
      ((= (attr ent 0) "CIRCLE")(* 2 pi (attr ent 40)))
      ((= (attr ent 0) "POLYLINE")(command "area" "e" (attr ent
-1))(getvar "perimeter"))
      ((= (attr ent 0) "SPLINE")(command "area" "e" (attr ent
-1))(getvar "perimeter"))
    )
  )
  (if (setq ss (ssget '((-4 . "<or")(0 . "LINE")(0 . "ARC")(0 .
"CIRCLE")
                                    (0 . "POLYLINE")(0 . "SPLINE")(-4 .
"or>"))))
    (progn
      (repeat (sslength ss)
        (setq dst (+ dst (elength (entget (ssname ss cnt)))) cnt (+ cnt
1))
      )
      (princ (strcat "\n The length of the entity or entities selected
is "(rtos dst 2 8)"  "))
    )
    (princ "\n Input error... ")
  )
  (princ)
)

RE: In response to thread555-151638

You could change the 2 instances of "polyline" to "lwpolyline", that should fix the problem.  Will need a few more edits to work on both POLYLINES & LWPOLYLINES.

You can find a more robust routine, "TLEN.LSP" at http://www.turvill.com/t2/free_stuff/index.htm

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources