Write/export Detail Items listed by View

I’m new to Dynamo, but this little thing feels like an obvious starting project in Dynamo.

I want ot make some chanegs to a Detail Component and in order to check that each instance is still buildable I want to list the views in which this detail component is placed. A clumsy way to say this might be
<ul style=“list-style-type: undefined;”>

  • Get list of Family Instances in Category Detail Items

  • Get list of Views of Type Detail Views

  • Foreach View write list of Detail Item Instances Type names to file, for example CSV
  • Am I going about it the correct way? Can anyone help me find the code blocks/nodes I need to use? This business of find what I need is the tricky part for me, as I don't really know what such nodes would be called.

    Hopefully you have the insights I need and will share them with me.

    PS. Sorry about the formatting mess, I’ve tried to edit my post but it’s not working.

    If this is a work shared project, the detail components will inherit a work set by the view in which they are placed. From there it can be as simple as select all detail components>getparametervalue>groupby key.

     

    I will try to post a screenshot later on today if that all makes sense.

     

     

    imageThis would grab filled regions as well though

    I’d recommend using the OwnerView property - every view-specific element in Revit has that prperty, regardless of whether the project is workshared or not. Element.OwnerView in package Clockwork will retrieve the owner view of a given element:

    OwnerView

    Hi JOhnp, thanks for the help

    I understand the concept of Dynamo and visual programming, but have some show stoppers as I move along.

    I can’t find the nodes I need, I can’t fin one called ‘Categories’, or ‘All Elements of Category’

    I have found GroupByKey.

    What is ‘Code Block’ and ElementGetParameterValueByName - and why is it a different color?

    Feel free to say RTFM, but please hep me find the relevant bit to read :slight_smile:

    Thanks again, Duncan

    Hi Andreas, like JOhnp’s post, I just can’t find the nodes - I’m missing some basic knowledge here. I have installed Clockwork and found Element.OwnerView

    I’ve found Watch, GroupByKey, ElementOwnerView. But not the others.

    I’m running version 0.8.1.1823

    Although all our projects are work shared I would love to be able to make both examples work - that’d be a great learning path.

    Duncan, it sounds like you’re running Dynamo in standalone mode (or Dynamo Studio which is basically the same). That would explain why none of the built-in Revit-related nodes show up. You’ll need to start the Dynamo addin from Revit.

    Thanks Andreas, had to fix this issue:

    http://dynamobim.com/forums/topic/dynamo-doesnt-start-from-revit-after-0-73-upgrade/

    Up and running now. But I can’t get it to write anything very useful. It looks as though it writing the name of each OwnerView but not the name of the Detail Items.

    2015-07-07_1354

     

     

     

     

    Here’s an excerpt of the output in a text file (which I though was going to be a CSV file…)

    FloorPlanView(Name = 21V15 - Let ydervæg / overgang under vindue )
    SectionView(Name = 23L03 - Etagedæk ved stålramme / let ydervæg )
    SectionView(Name = 23L03 - Etagedæk ved stålramme / let ydervæg )
    SectionView(Name = 23L03 - Etagedæk ved stålramme / let ydervæg )
    SectionView(Name = 23L03 - Etagedæk ved stålramme / let ydervæg )
    SectionView(Name = 23L03 - Etagedæk ved stålramme / let ydervæg )
    SectionView(Name = 23L03 - Etagedæk ved stålramme / let ydervæg )
    SectionView(Name = 23L03 - Etagedæk ved stålramme / let ydervæg )
    SectionView(Name = Opstalt Vest )
    SectionView(Name = Opstalt Nord )
    SectionView(Name = Opstalt Syd )
    SectionView(Name = Opstalt Øst )
    SectionView(Name = 1-200 Opstalt Nord )
    SectionView(Name = 1-200 Opstalt Syd )
    SectionView(Name = 1-200 Opstalt Vest )
    SectionView(Name = 1-200 Opstalt Øst )
    FloorPlanView(Name = 21V14 - Let ydervæg / sidefals vindue )
    FloorPlanView(Name = 21V14 - Let ydervæg / sidefals vindue )
    FloorPlanView(Name = 21V14 - Let ydervæg / sidefals vindue )
    FloorPlanView(Name = 21V15 - Let ydervæg / overgang under vindue )
    FloorPlanView(Name = 21V15 - Let ydervæg / overgang under vindue )
    FloorPlanView(Name = 21V15 - Let ydervæg / overgang under vindue )
    SectionView(Name = Snit G-G )
    FloorPlanView(Name = 21V06 - Ydervæg, skift i bagvægstykkelse i naturfag )
    FloorPlanView(Name = 21V04 - Skrå udvendig fals i teglvæg, Idrætshal )

    The language is Danish. The xxnxx abreviations are the start of the View Names.

    Thanks for the help so far, nice that I’m starting to get somewhere!

    1. You may want to run those lists through an Element.Name node before passing them to the CSV Exporter

    2. You have a three-dimensional list structure which is one level too many for the CSV node. Assuming that your CSV file should be a list of value pairs (detail component & owner view), you’ll need to flatten your list structures before passing them to the List.Create node and then transpose the resulting list, like so:

    FlattenedTransposed

    Seeing that you’re working in Denmark, will you attend the Dynamo event in Copenhagen in August?

    https://dk.gep.autodesk-services.com/registration/39009

    Andreas, which version of Dynamo are you using. I am still having issues with a lot of nodes with the Dynamo 0.8.1 stable build.

    Nevermind, the problem was I had an older version of clockwork installed. This was due to the fact that each 0.8 version pulled the packages from 0.7.5 Which were out of date

    Lieber Andeas

    Gibt es keiner PM in dieses Dynamo Forum? Ich sehe kein Programm, wo kann ich sehen wie der Tag in København strukturiert werden wird?

    Now it’s working almost perfectly, how can I change the delimiter of the csv file? Comma is a valid character in Type Names & View Names, so a few places in the CSV are slightly broken.

    CaptureI believe that GroupByKey is where we get a rectangular array with View Names as values, but where is the key value coming from? Then when we try to make a list from 3 items we get a 3d array which the CSV.WriteToFile node isn’t designed ot handle. Correct?

    Vielen Dank für Deine Hilfe!

    Now I’m trying to get the Family Name of the Detail Components so I can join it to the Type Name in the usual Family : Type format. I don’t understand why All Elements of Category -> Family.Name is just returning the list of types.

    • How do I get the Family Name in front of the Type names?

    I think String.Join can concatenate the two strings but String.Join is spitting out Warning: Asked to convert non-convertible types. Type conversion has always confused me, where can I read about it in the context of strings used in the Revit API? Also is there a node which can tell me what type of string I’m dealing with, like the watch node shows results?

    • How do I join the Family and Type Names into one string?

    I got rid of the two Flatten nodes since one was redundant (Element.OwnerView already gave a one dimensional list). The other was only there because of the empty Element.OwnerView feeding the keyProjector of GroupByKey. I’m surprised that the relationship between DC and View is preserved without that node…

    So here’s the block as it looks now:

    2015-07-08_1031

    And the DYN file: Detail Items per View

    Thanks for the great Clockwork nodes!

    Duncan, have to say I’m impressed with your German! No PM functionality on this forum, but you can contact me through LinkedIn or Twitter.

    A detailed schedule for the Copenhagen event is in the works. Here’s what I can tell you at this point: Speakers will be Matt Jezyk and Dieter Vermeulen of Autodesk, Havard Vasshaug of Dark Architects, someone from CS Moller and myself. And yes, I believe we do have some interesting topics lined up.

    Regarding your graph:

    1. In your case, you wouldn’t actually need GroupByKey - instead you would use SortByKey to get a flat sorted list (for some reason that doesn’t work with the Element.OwnerView node, though).

    2. You can pass any number of items per row as long as your list does not have more than two dimensions. In the example below I have chosen to export the element IDs as well to show that you can export larger sets of data per row.

    3. Also, I just added a simple CSV exporter to package Clockwork that allows you to specify a custom delimiter - I’ve actually wanted that functionality myself for quite some time…

    CustomCSVExport

    For concatenating strings I would just a code block.

    Here’s how you can access types and families based on instances:

    InstancesTypesFamilies

    • How do I get access to the new node? I can’t see a way to update or uninstall node packages.

    • On the FamilyInstance.Symbol node I’m getting the warning

    Warning: No function called %get_Symbol could be found. Please check the name of the function

    • How can I see which package a given node comes from?

    • I’ve started a page on the wiki to start documenting the warning & errors I encounter, see https://github.com/DynamoDS/Dynamo/wiki/Warnings is that really the only place to look for documentation?

    How do I add comments to my code?

    1. For installing a new package version, go to the packages menu > search for packages.

    2. FamilyInstance.Symbol likely fails because your list of DetailComponents contains FilledRegions. Use Clockwork’s Element.Type node instead - it’s a little bit more robust than FamilyInstance.Symbol …

    3. Afaik there is no way of seeing which package a custom node actually comes from. If it’s a node you aready have installed, you can of course use Windows Explorer to find its package by searching for the node name in C:\Users\YOUR_USER_NAME\AppData\Roaming\Dynamo.8\packages

    4. In code blocks you can add lines of comments by starting the line witha double forward slash. On camvas you can use text notes (Crtl + W).

    I was going through that discussion which gave me an idea so i got started but… there’s always a but :slight_smile:

     

    The Element.OwnerView return me any values. I included a screen capture

     

     

    Owner.View