Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to determine the total length of multiple lines

58 REPLIES 58
SOLVED
Reply
Message 1 of 59
lucilarosso
151636 Views, 58 Replies

How to determine the total length of multiple lines

This is something that used to be very easy to do in autocad (with a polyline) and checking the lenght on the properties bar.

When I select multiple lines (chain of lines) the "lenght" data is greyed out.

I hate having to measure every segment separately! It has to be easier... right?

 

 

58 REPLIES 58
Message 21 of 59
GTisRule
in reply to: chrisplyler

A dirty, but do-able method would be to create a conduit run, then use a Conduit Run Schedule

 

(A "Conduit Run" schedule will show a length.  This is the ONLY place we've been able to find it.)

 

 

 

 

 runschss.png

Message 22 of 59
SSStudio
in reply to: Alfredo_Medina

The "Solution" doesn't seem to work if the chain of model "lines" contain arcs - at least not for me anyway.

 

I was attempting to get the perimeter value from a HSS square tube steel column by quickly creating the perimeter model lines.

 

While I can tab-select the entire chain, once the Measure Along tool is engaged, it will not tab-select beyond the start of the first non-linear connected element in the chain.

 

Oh well ... now looking for an extension.

 

Message 23 of 59
Dennis_Berner
in reply to: lucilarosso

it is also possible with a macro

 

/*
 * Created by SharpDevelop.
 * User: dbe
 * Date: 09-09-2016
 * Time: 08:28
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;

namespace lengthofline
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("7FFD8872-80F5-4667-867C-E90F88E955DC")]
    public partial class ThisApplication
    {
        private void Module_Startup(object sender, EventArgs e)
        {

        }

        private void Module_Shutdown(object sender, EventArgs e)
        {

        }

        #region Revit Macros generated code
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(Module_Startup);
            this.Shutdown += new System.EventHandler(Module_Shutdown);
        }
        #endregion
        public void lineLength()
{
    double length = 0;
    Document doc = this.ActiveUIDocument.Document;
    UIDocument uidoc = this.ActiveUIDocument;
    ICollection<ElementId> ids = uidoc.Selection.GetElementIds();
    foreach (ElementId id in ids)
    {
        Element e = doc.GetElement(id);
        Parameter lengthParam = e.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH);
        if (lengthParam == null)
            continue;
        length += lengthParam.AsDouble();
    }
    string lengthWithUnits = UnitFormatUtils.Format(doc.GetUnits(), UnitType.UT_Length, length, falsefalse);
    TaskDialog.Show("Length", ids.Count + " elements = " + lengthWithUnits);
}
//        public void NewTagMethod()
//        {
//        }
    }
}

 

Message 24 of 59
Homsey-CCH
in reply to: lucilarosso

Regardless of why someone might want to see a total distance of connected detail lines when you TAB+select them, this seems like a very basic reporting function that should already be there.

 

Revit will currently show any single detail line length if you pick it.  Can't Revit add up the connected lengths and show that?

 

What programmer would think it's OK to have the "Length" box in the properties dialog go blank in that situation?

This doesn't seem like a function that should be at all hard to implement.

Message 25 of 59
ToanDN
in reply to: Homsey-CCH

Another workaround is draw lines in an in-place mass and use divided path.

 

Capture.PNG 

Message 26 of 59
Homsey-CCH
in reply to: ToanDN

Thank you.  I understand there are several workarounds for building a path that will report total length.  This is not a "feature" that would be added as a cool new thing.  It's just a property dialog box that isn't reporting an obvious piece of data.  And it's data that Revit already has, since it will tell the length of any single detail line; they just need to add up the lengths of TAB+selected detail lines and show that length in Properties.

 

We should not need a workaround for that.

 

I do think they should also add a feature for very easily making egress paths on Egress Plans, as that is a common part of normal documentation, and I've seen some pretty creative workarounds for that.

Message 27 of 59
loboarch
in reply to: Homsey-CCH


@2003homsey wrote:

 

Revit will currently show any single detail line length if you pick it.  Can't Revit add up the connected lengths and show that?

 

What programmer would think it's OK to have the "Length" box in the properties dialog go blank in that situation?

This doesn't seem like a function that should be at all hard to implement.


I agree it should probably be easier to do this, but as far as resolving the "length" on the properties dialog to "null" once more than one line in a chain is selected, it follows the "logic" of Revit.

 

The properties palette is showing instance properties of the selected element. If more than one element is selected, the properties palette will show instance parameters/values that are common between the selected elements. If you select more than one line, unless they are EXACTLY the same length, the "length" INSTANCE parameter reports a null value. Even if you select multiple lines exactly the same length, the values are not added, the length of the individual lines is reported. The properties palette in Revit is just not capable of reporting "length" in the way you are asking.

 

The command "Measure Along" will add individual lengths together. It is a different tool. It reports the value in a different location. I am not sure why Measure Along will not work with detail lines or stops once it encounters a non linear segment? 

 

In order to do what you are asking I suspect you would have to totally re-architect the way the properties palette works, or introduce a new element type like a polyline in AutoCAD that could report the total length of the elements making up the "polyline" element.

 

If it is important to your workflow, I would suggest adding to the Revit Idea Station thread on the subject so the Revit team can understand your needs.



Jeff Hanson
Principal Content Experience Designer
Revit Help |
Message 28 of 59
Dennis_Berner
in reply to: Homsey-CCH

If you use the macro i provided earlier, you end up with a result like the picture below. Maybe Autodesk will make a dedicated button for measuring a line. Maybe you could make a dynamo script.

There is also a last solution. Create a detail item family that will fulfil your needs.

I'm not sure that Revit ever will be as good as Autocad at the 2D part, but I also don’t think that it is meant to be.

 

Capture.PNG

Message 29 of 59
GTisRule
in reply to: lucilarosso

I feel the real question here is when is Autodesk going to address the shortcomings of electrical?  Reference planes on conduit and duct have been missing since the original release of Revit MEP!  I mean seriously, Bottom of Duct is available, but not bottom of cable tray?  We're coming up on 5 years now of relatively simple fixes that would help us in the field tremendously.  Conduit runs are glitchy, and as we've found, don't fully even work right for conduit run lengths.  I ended up building a dynamo script to analyze conduits and bends to calculate a run length to solidify the reporting from Revit, as we had numerous discrepancies of the "Conduit Run" data was lost or blanked out in scheduling.  

Message 30 of 59
GTisRule
in reply to: GTisRule

I wouldn't mind sharing the script, but it requires a couple of custom shared parameters, and line numbers applied to the associated conduit your trying to schedule.  

We had some cabling on a project we modeled as "conduit" that was several thousand dollars a foot, so accuracy was of extreme importance.  My script was the only way I could sleep at night to know we got the takeoff right.

Message 31 of 59
Dennis_Berner
in reply to: GTisRule

in Revit2017 i have the bottom and top elevation of a cable tray. And conduit.

Message 32 of 59
GTisRule
in reply to: lucilarosso

Try aligning to them to somethi ng by bottom of tray.
Message 33 of 59
Dennis_Berner
in reply to: GTisRule

Do you measn ín a section?

I drew a line, pressed AL, tabed over the bottom on the cable tray, clicked the mouse.

Now the bottom of the cable tray is aligned with the line.

This works in both fine and medium detail level.

Message 34 of 59
GTisRule
in reply to: Dennis_Berner

Yeah, sorry, in a section the top and bottom Reference Planes are shut off, or not active.  And since you can't modify a system family, the end users can't even fix it.

Message 35 of 59
Dennis_Berner
in reply to: lucilarosso

I'm not sure I understand. It works perfectly in my project.
You just have to TAB to get hold of the bottom or top of the cable tray.
Message 36 of 59
ToanDN
in reply to: Dennis_Berner

How is it coming from measuring lines to bottom of ductwork? Can they be in separate threads?
Message 37 of 59

hi 

 

if you want find the path length for pipe,conduit,cable tray,.etc..  first select the total path after give the required name as a comment in PP ( example: equipment name from to( LDB1 TO MDB )). after create the schedule add comment parameter,length,family and type. here we will got length . but must be select our required path only.

Message 38 of 59
kjeboe
in reply to: ToanDN

You can always draw a railing to get the length...

pure.architect
http://www.purark.no
Message 39 of 59
kjeboe
in reply to: kjeboe

Maybe an updated macro

 

public void TotalLength()
        {
            UIDocument uidoc = this.ActiveUIDocument;
            Selection lines = uidoc.Selection;
            ICollection<ElementId> elementIds = lines.GetElementIds();
            
            FilteredElementCollector collector = new FilteredElementCollector(ActiveUIDocument.Document, elementIds);
            ElementCategoryFilter filteredElements = new ElementCategoryFilter(BuiltInCategory.OST_Lines);
            
            var elements = collector.WherePasses(filteredElements).ToElements();
            
            double length = 0;
            foreach (var e in elements){
                Parameter lengthParam = e.LookupParameter("Length");
                if (lengthParam == null)
                    continue;
                length += lengthParam.AsDouble();
            };
            
            var converted = UnitUtils.ConvertFromInternalUnits(length,Autodesk.Revit.DB.DisplayUnitType.DUT_MILLIMETERS);
            
            TaskDialog.Show("TotalLength",converted.ToString());
            
        }
        

pure.architect
http://www.purark.no
Message 40 of 59
Homsey-CCH
in reply to: kjeboe

Lots of creative ideas and workarounds listed in the posts above.

 

There is another way that seems to work for those who just want to draw some detail lines and measure the combined length.  Revit can toggle detail lines to model lines, and change them back again.  So just tab+select your chain of detail lines.  Click the toggle button (it will appear once the lines are selected) called "Convert Lines".  They will all become model lines.  Then use the Measure tool -> "Measure along an element" and tab+select the chain of model lines.  It reports the total in the upper left corner.

 

De-select and re-select the chain of lines, and toggle them back to detail lines using "Convert Lines"

 

If your model isn't flat, some segments may "disappear" from view when changed to model lines.  Don't worry, you can still tab+select them as long as a portion is visible, and when you toggle them back to detail lines, they will all appear again.

 

("Thank you" to a previous contributor who reminded me that Revit will measure a chain of model lines.)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report


Autodesk Design & Make Report