| Author |
Message |
Jeff Clark
Guest
|
Posted:
Mon Jan 10, 2005 9:57 pm Post subject:
Length of a Polyline |
|
|
Does anyone have a subroutine for extracting the total length of a polyline
you would be willing to share with me?
I'm trying to get together a group of Quantity Take-off routines.....
Thanks
--
Jeffrey A. Clark
Project Designer
Consulting Engineer Services
856/228-2200
Jclark@ces-1.com
|
|
| Back to top |
|
 |
GaryDF
Guest
|
Posted:
Mon Jan 10, 2005 10:03 pm Post subject:
Re: Length of a Polyline |
|
|
This works great...
Gary
;;;Juerg Menzi
;;;MENZI ENGINEERING GmbH, Switzerland
;;;http://www.menziengineering.ch
(defun c:GETLENGTH ( / CurEnt CurLgt CurObj CurSet FltLst TmpLgt)
(vl-load-com)
(setq FltLst '((0 . "ARC,LINE,LWPOLYLINE,POLYLINE,SPLINE,CIRCLE"))
CurLgt 0.0
)
(if (setq CurSet (ssget FltLst))
(progn
(while (setq CurEnt (ssname CurSet 0))
(setq CurObj (vlax-ename->vla-object CurEnt)
TmpLgt (vlax-curve-getDistAtParam CurObj
(vlax-curve-getEndParam CurObj)
)
CurLgt (+ CurLgt TmpLgt)
)
(ssdel CurEnt CurSet)
)
(princ (strcat "\n* Total Length = " (rtos CurLgt) " *"))
)
)
(princ)
)
"Jeff Clark" <jclark@ces-1.com> wrote in message news:41e2b3f8$1_1@newsprd01...
| Quote: | Does anyone have a subroutine for extracting the total length of a polyline
you would be willing to share with me?
I'm trying to get together a group of Quantity Take-off routines.....
Thanks
--
Jeffrey A. Clark
Project Designer
Consulting Engineer Services
856/228-2200
Jclark@ces-1.com
|
|
|
| Back to top |
|
 |
Jeff Clark
Guest
|
Posted:
Mon Jan 10, 2005 11:58 pm Post subject:
Re: Length of a Polyline |
|
|
Excellent! Thanks Gary.
"GaryDF" <arch_program@hotmail.com> wrote in message
news:41e2b637$1_2@newsprd01...
| Quote: | This works great...
Gary
;;;Juerg Menzi
;;;MENZI ENGINEERING GmbH, Switzerland
;;;http://www.menziengineering.ch
(defun c:GETLENGTH ( / CurEnt CurLgt CurObj CurSet FltLst TmpLgt)
(vl-load-com)
(setq FltLst '((0 . "ARC,LINE,LWPOLYLINE,POLYLINE,SPLINE,CIRCLE"))
CurLgt 0.0
)
(if (setq CurSet (ssget FltLst))
(progn
(while (setq CurEnt (ssname CurSet 0))
(setq CurObj (vlax-ename->vla-object CurEnt)
TmpLgt (vlax-curve-getDistAtParam CurObj
(vlax-curve-getEndParam CurObj)
)
CurLgt (+ CurLgt TmpLgt)
)
(ssdel CurEnt CurSet)
)
(princ (strcat "\n* Total Length = " (rtos CurLgt) " *"))
)
)
(princ)
)
"Jeff Clark" <jclark@ces-1.com> wrote in message
news:41e2b3f8$1_1@newsprd01...
Does anyone have a subroutine for extracting the total length of a
polyline
you would be willing to share with me?
I'm trying to get together a group of Quantity Take-off routines.....
Thanks
--
Jeffrey A. Clark
Project Designer
Consulting Engineer Services
856/228-2200
Jclark@ces-1.com
|
|
|
| Back to top |
|
 |
Jeff Mishler
Guest
|
Posted:
Tue Jan 11, 2005 12:09 am Post subject:
Re: Length of a Polyline |
|
|
Gary, instead of posting copyrighted material you should post a link to
where it can be downloaded. The web page that came from has some disclaimers
that users really need to know about and agree to.
Jurg has spent considerable time and effort to post all of the routines on
his site. It would be one thing if he actually posted his routines here, but
he always posts a link back to his website. So let's not undermine his
wishes and maybe he will continue to post additional high quality functions.
Thanks,
--
Jeff
check out www.cadvault.com
"GaryDF" <arch_program@hotmail.com> wrote in message
news:41e2b637$1_2@newsprd01...
| Quote: | This works great...
Gary |
|
|
| Back to top |
|
 |
GaryDF
Guest
|
Posted:
Tue Jan 11, 2005 12:35 am Post subject:
Re: Length of a Polyline |
|
|
Good point, my bad.
Gary
"Jeff Mishler" <jeff_m@cadvault.com> wrote in message
news:41e2d301$1_3@newsprd01...
| Quote: | Gary, instead of posting copyrighted material you should post a link to
where it can be downloaded. The web page that came from has some disclaimers
that users really need to know about and agree to.
Jurg has spent considerable time and effort to post all of the routines on
his site. It would be one thing if he actually posted his routines here, but
he always posts a link back to his website. So let's not undermine his
wishes and maybe he will continue to post additional high quality functions.
Thanks,
--
Jeff
check out www.cadvault.com
"GaryDF" <arch_program@hotmail.com> wrote in message
news:41e2b637$1_2@newsprd01...
This works great...
Gary
|
|
|
| Back to top |
|
 |
AnneBrown
Guest
|
Posted:
Tue Jan 11, 2005 1:11 am Post subject:
Re: Length of a Polyline |
|
|
Copyright file removed and copying the answer on why removed.
---
Anne Brown
Discussion Groups Administrator
Autodesk, Inc.
Subject:
Re: Length of a Polyline
Date:
Mon, 10 Jan 2005 11:09:53 -0800
From:
"Jeff Mishler" <jeff_m@cadvault.com>
Organization:
TDG Engineers
Newsgroups:
autodesk.autocad.customization
Gary, instead of posting copyrighted material you should post a link to
where it can be downloaded. The web page that came from has some disclaimers
that users really need to know about and agree to.
Jurg has spent considerable time and effort to post all of the routines on
his site. It would be one thing if he actually posted his routines here, but
he always posts a link back to his website. So let's not undermine his
wishes and maybe he will continue to post additional high quality functions.
Thanks,
--
Jeff
check out www.cadvault.com
"GaryDF" <arch_program@hotmail.com> wrote in message
news:41e2b637$1_2@newsprd01...
This works great...
Gary
;;;Juerg Menzi
;;;MENZI ENGINEERING GmbH, Switzerland
;;;http://www.menziengineering.ch |
|
| Back to top |
|
 |
ECCAD
Guest
|
Posted:
Tue Jan 11, 2005 3:19 am Post subject:
Re: Length of a Polyline |
|
|
(defun get_length_objects ()
(setvar "highlight" 1)
(prompt "\nPick Objects for Length Calculations:")
(setq SS (ssget))
); function
(defun do_individual_lengths ()
(setvar "cmdecho" 0)
(setq SS nil)
(get_length_objects); Select individual lengths
(if SS
(progn
(setq NUM 0)
(setq LENGX (SSLENGTH SS))
(repeat LENGX
(setq TOTAL 0 AVE 0 COUNT 1)
(setq C (ssname SS NUM))
(setq D (entget C))
(setq E (cdr (assoc -1 D)))
(get_obj_len C) ; obtain object's length
(if (/= obj_len 0)
(progn
(calc_lengths obj_len)
(setq TOTAL U_len)
(*********** do what you need with U_len here*******)
); progn
); if
(setq NUM (+ NUM 1))
); repeat
); progn
); if
(princ)
); end function
(defun calc_lengths ( x_length )
(setq U_len 0 U_len_S " FT" LN 0 FEET 0 YARDS 0 INCHS 0 METERS 0 MILES 0 KMETERS 0)
(setq LN x_length)
(if (and (= ADJ_LEN 1)(/= LEN_FT nil)(/= LEN_FT 0.0)); Adjustment in Feet
(setq LN (+ LN LEN_FT)); +/- if input is -xx
); if
(if (> LN 0)
(progn
(setq FEET LN
YARDS (/ FEET 3.0)
INCHS (* FEET 12.0)
METERS (/ INCHS 39.36)
MILES (/ FEET 5280.0)
KMETERS (/ METERS 1000.0)
); setq
); progn
); if
); defun
(defun get_obj_len ( ss_ent )
(setq obj_len 0 oname nil)
(setq obj (vlax-ename->vla-object ss_ent))
(setq oname (vlax-get obj 'ObjectName))
(cond
( (= "AcDbPolyline" oname)
(command "_area" "O" E)
(setq obj_len (getvar "Perimeter"))
)
( (= "AcDbCircle" oname)
(setq obj_len (vlax-get obj 'Circumference))
)
( (= "AcDbLine" oname)
(setq obj_len (vlax-get obj 'Length))
)
( (= "AcDbArc" oname)
(setq obj_len (vlax-get obj 'ArcLength))
)
( (= "AcDbEllipse" oname)
(command "_area" "O" E)
(setq obj_len (getvar "Perimeter"))
)
); cond
(if obj (vlax-release-object obj))
(princ)
); function
(defun C:run ()
(do_individual_lengths)
(princ)
); end function
------------------------
Above are fragments from real program.
Cheers,
Bob |
|
| Back to top |
|
 |
|
|
|
|