Autocad Sum Length Of Lines

2020年12月9日
Download: http://gg.gg/nfi4v
*Autocad Sum Length Of Lines Intersect
*Autocad Sum Lengths Of Lines
*Autocad Sum Length Of Lines DiagramFunction SyntaxLF (Length Field) / AF (Area Field)Current Version1.3DownloadLengthAreaFieldV1-3.lspView HTML VersionLengthAreaFieldV1-3.htmlDonateContents
Charl van der Merwe Building and Architectural Design autocad, count, lengths, sum, table The way to do this very efficiently is to create a table and add extract all the lengths from each line into the table and then add up all the segment lengths to get the total length.
*AutoCAD doesn’t have anything like that built in, but it’s easily done with TLEN.lsp (Total LENgth of selected objects) If you’re not familiar with how to use lisp, simply copy/paste (CTRL+V) ALL the text and characters in the above link into your command line and press Enter, then type TLEN into the command line and follow the command prompt (select the objects) Note using this method, the lisp is only loaded for the current session, if you.
*Upon issuing the command syntax LF (Length Field) at the AutoCAD command-line, the program first prompts the user to make a selection of objects for which to return the length summation. At this prompt, the user may select any number of Arcs, Circles, Lines, 2D Polylines (light or heavy), or 3D Polylines.
*Hi, Can anyone help me find length of a polyline. Welcome to 3DCADForums Join our CAD community forums where over 25,000 users interact to solve day to day problems and share ideas.
*How to sum the lengths of multiple lines? AutoCAD LT 2015. Enter the length. Click on the next line. Repeat as necessary. 1 point 5 years ago.Program Description
This program offers two commands to allow a user to generate a field expression referencing either the area or the length/perimeter/circumference of one or more selected objects.
In the case of selecting multiple objects, the field expression will reference the sum of the areas or lengths of all objects in the selection.
The user may opt to specify a point at which to create a new multiline text object housing the field expression, pick a table cell in which the field should be inserted, or select an existing single-line text, multiline text, multileader, or attribute to be populated with the field expression.Length Field
Upon issuing the command syntax LF (Length Field) at the AutoCAD command-line, the program first prompts the user to make a selection of objects for which to return the length summation.
At this prompt, the user may select any number of Arcs, Circles, Lines, 2D Polylines (light or heavy), or 3D Polylines.Area Field
Alternatively, upon issuing the command syntax AF (Area Field) at the AutoCAD command-line, the program will prompt the user to make a selection of objects for which to return the area summation.
At this prompt, the user may select any number of Arcs, Circles, Ellipses, Hatches, 2D Polylines (light or heavy), Regions, or Splines. If the selected object is open, the area is computed as though a straight line connects the start point and endpoint.Field Output
The user is then prompted to specify a point or table cell to insert a field expression referencing the summation of the lengths or areas of the selected objects.
At this prompt, the user may also choose the ’Object’ option in order to populate the content of an existing annotation object with the field expression.
Upon choosing this option, the user may select any single-line text (DText), multiline text (MText), single-line or multiline attribute, attributed block, or multileader (MLeader) with either multiline text or attributed block content.
If the user selects an attributed block or attributed multileader with more than one attribute, the user is presented with a dialog interface listing the available attributes, and is prompted to select a destination for the field expression.
The user may optionally predefine the target block/multileader attribute by specifying the attribute tag where noted at the top of the program source code.
The resulting field expression will display the sum of the lengths or areas of the selected objects, formatted using the field formatting code specified at the top of each command definition.Custom Commands
The available commands offered by the program are defined at the very top of the program source code. Additional custom commands which target specific attribute tags, or which employ varying field formatting codes may be defined by the user to accommodate drawings in which lengths or areas must be expressed in a variety of formats.
Four custom commands are already defined as examples:
Here, the general format of the definition of a command is:
Here, the <Target-Attribute-Tag> may be the tag name of an attribute reference to be populated with the field expression (such tag is not case-sensitive), or nil if the user is permitted to select any attribute.For example:
The above custom command may be invoked at the AutoCAD command-line using the syntax mylf and targets an attribute with tag name ’TAG1’ with the resulting length formatted:
*in Decimal Units (%lu2)
*to a Precision of 3 d.p. (%pr3)
*with a Prefix of ’Length:’ (%ps[Length:,])
*with a Conversion Factor of 0.1 (%ct8[0.1])Length / Area Formatting Code
The field formatting code supplied as the second parameter for each custom command may be altered to display the length or area in a desired format:
To determine the correct formatting code to be used, perform the following steps:
*Type FIELD at the AutoCAD command-line and press ENTER to open the Field dialog.
*Select Objects from the ’Field Category’ drop-down menu.
*Select Object from the ’Field Names’ section.
*Select an object (with length or area) from the drawing by clicking the object selection button adjacent to the ’Object Type’ box.
*Select the Length or Area property from the ’Property’ panel (or equivalent property for Arcs & Circles).
*Configure the formatting options as desired.
*Click OK and pick a point in the drawing to create a temporary MText Field.
*Download & load my Field Formatting Code program.
*Type fieldformat to run the program and select the temporary MText Field created earlier.
*Following a valid selection, the field formatting code will be printed to the command-line, e.g.:
For more examples & information on how to supply a field formatting code to a custom command, please refer to the program page for my Quick Field program.Instructions for Running
Please refer to How to Run an AutoLISP Program.
Here is a lisp that collects the lengths of lines or polylines on selected layers:
;;; LENLYR.LSP a program to find the length of all;;; entities on any selected layer;;;(defun err (s) (if (= s ’Function cancelled’) (princ ’nLENLYR - cancelled: ’) (progn (princ ’nLENLYR - Error: ’) (princ s) (terpri)) ); if (resetting) (princ ’SYSTEM VARIABLES have been resetn’) (princ)); err(defun setv (systvar newval) (setq x (read (strcat systvar ’1’))) (set x (getvar systvar)) (setvar systvar newval) ); setv (defun setting () (setq oerr *error*) (setq *error* err) (setv ’CMDECHO’ 0) (setv ’BLIPMODE’ 0)); end of setting(defun rsetv (systvar) (setq x (read (strcat systvar ’1’))) (setvar systvar (eval x))); restv(defun resetting () (rsetv ’CMDECHO’) (rsetv ’BLIPMODE’) (setq *error* oerr)); end of resetting
(defun dxf (code ename) (cdr (assoc code (entget ename)))); dxf
(defun lenlyr ( / LayerList EntityList EntityLengths) (setq LayerList (get-lyrs) EntityList (get-ents LayerList) EntityLengths (do-len EntityList) ) ; setq (prin1 (read (rtos EntityLengths 2 2)))); lenlyr
(defun get-lyrs ( / isent lyr-list ss i lname) (setq isent nil lyr-list nil) (prompt ’nSelect object(s) on required layer(s): ’) (setq ss nil) (while (not ss) (setq ss (ssget)) (if (not ss) (prompt ’nNo entities were selected.’) ); if ); while (setq i (- 1)) (repeat (sslength ss) (setq lname (dxf 8 (ssname ss (setq i (1+ i))))) (if (not (member lname lyr-list)) (setq lyr-list (append lyr-list (list lname))) ); if ); repeat lyr-list); get-lyrs
(defun get-ents (LayerList / lstr lst lyr str filtlist i ss ename elist) (setq lstr (strcat (car LayerList) ’,’)) (setq lst (cdr LayerList)) (foreach lyr lst (setq str (strcat lyr ’,’) lstr (strcat lstr str) ); setq ); foreach (setq lstr (substr lstr 1 (1- (strlen lstr)))) (setq filtlist (list (cons 8 lstr) ’(-4 . ’<or’) ’(0 . ’LINE’) ’(0 . ’ARC’) ’(0 . ’CIRCLE’) ’(0 . ’POLYLINE’) ’(0 . ’LWPOLYLINE’) ’(-4 . ’or>’) ); list ); setq (setq i (- 1) elist nil ss nil) (setq ss (ssget ’X’ filtlist)) (if ss (progn (repeat (sslength ss) (setq ename (ssname ss (setq i (1+ i)))) (setq elist (append elist (list ename))) ); repeat (princ (strcat ’nTotal length of all ’ ’entities on layer(s) ’ lstr ’: ’) ); print ); progn (progn (alert (strcat ’No eligible entities on ’ ’layer(s) n’ lstr ’naborting.’)) (exit) ); progn ); if elist); get-entsAutocad Sum Length Of Lines Intersect
(defun do-len (EntityList / TotalLength ent len) (setq TotalLength 0 len 0) (foreach ent EntityList (setq len (ent-len ent)) (if len (setq TotalLength (+ len TotalLength)) ); if ); foreach); do-len
(defun ent-len (en / elength) (setq elength (cond ((= (dxf 0 en ) ’LINE’) (do-line en)) ((= (dxf 0 en ) ’ARC’) (do-arc en)) ((= (dxf 0 en ) ’CIRCLE’) (do-circle en)) ((= (dxf 0 en ) ’POLYLINE’) (do-pline en)) ((= (dxf 0 en ) ’LWPOLYLINE’) (do-lwpline en)) ); cond ); setq elength); ent-len
(defun do-line (en / p10 p11 len) (setq p10 (dxf 10 en) p11 (dxf 11 en) len (distance p10 p11) ); setq len); do-line
(defun do-arc (en / rad sang eang theta len) (setq rad (dxf 40 en) sang (dxf 50 en) eang (dxf 51 en) theta (- eang sang) ); setq (if (minusp theta) (setq theta (+ theta pi pi)) ); if (setq len (* rad theta))); do-arc
(defun do-circle (en / rad len) (setq rad (dxf 40 en) len (* rad pi 2) ); setq len); do-circle
(defun do-pline (en / is-closed vlist vvlist len) (setq is-closed (dxf 70 en)) (if (/= is-closed 100) (progn (setq en (entnext en)) (setq vlist nil vvlist nil ); setq (while (/= ’SEQEND’ (dxf 0 en)) (setq vlist (dxf 10 en) vlist (reverse vlist) vlist (cdr vlist) vlist (list (reverse vlist)) ); setq (setq vlist (append vlist (list (dxf 42 en)))) (setq vvlist (append vvlist (list vlist))) (setq en (entnext en)) ); while ); progn ); if (setq len (do-polylen vvlist is-closed))); do-pline
(defun do-lwpline (en / num-vert is-closed elist vlist vvlist len) (setq num-vert (dxf 90 en) is-closed (dxf 70 en) elist (entget en) elist (member (assoc 10 elist) elist) vlist nil vvlist nil ); setq (repeat num-vert (setq vlist (list (cdr (assoc 10 elist)))) (setq vlist (append vlist (list (cdr (assoc 42 elist))))) (setq vvlist (append vvlist (list vlist))) (setq elist (cdr elist) elist (member (assoc 10 elist) elist) ); setq ); repeat (setq len (do-polylen vvlist is-closed))); do-lwplineAutocad Sum Lengths Of Lines
(defun do-polylen (vvlist is-closed / closed seglen plen first p10 p11 bulge) (setq closed (logand is-closed 1) seglen 0 plen 0 ); setq (if (= closed 1) (progn (setq first (car vvlist) vvlist (append vvlist (list first)) ); setq ); progn ); if (repeat (1- (length vvlist)) (setq p10 (caar vvlist) p11 (caadr vvlist) bulge (cadar vvlist) ); setq (setq seglen (do-seg p10 p11 bulge)) (setq plen (+ plen seglen)) (setq vvlist (cdr vvlist)) ); repeat plen); do-polylen
(defun do-seg (p1 p2 bulg / seglen ang4 ang dis rad) (if (= bulg 0.0) (progn (setq seglen (distance p1 p2)) ); progn (progn (setq ang4 (atan bulg) ang (* 4.0 ang4) dis (distance p1 p2) rad (/ (/ dis 2.0) (sin (/ ang 2.0))) seglen (* rad ang) ); setq ); progn ); if seglen); do-seg
(defun c:lnl () (setting) (lenlyr) (resetting) (princ)); c:lnl
(prompt ’nEnter LNL to start’)Autocad Sum Length Of Lines DiagramEdited by msplcdykee69 - 27.Aug.2009 at 22:54
Download: http://gg.gg/nfi4v

コメント

最新の日記 一覧

<<  2025年7月  >>
293012345
6789101112
13141516171819
20212223242526
272829303112

お気に入り日記の更新

テーマ別日記一覧

まだテーマがありません

この日記について

日記内を検索