I have created some nested families that have shared parameters so I can tag and schedule them. Everything works great until I try making assemblies. When I add these families to an assembly, the only way it will show is if I tab until each individual shared components is selected and add them individually. Is there any way to get a nested family to appear in an assembly with all of its components?
Solved! Go to Solution.
Solved by YarUnderoaker. Go to Solution.
Solved by YarUnderoaker. Go to Solution.
Solved by bjur. Go to Solution.
Good day YarUnderoaker
I have been using another workaround for my shared component problem but have a new project that has 1000s of nested components. i was able to run your macro in R14 but my new project is in R15 and i cannot figure out how to use the update you provided. Any help would be greatly appreciated.
Haydenwse.
Manual
1) Manage tab -> Macro Manager
2) Select tab with your project name
3) Push button Create in Module group. Input "Tools" for name. Ok.
4) Wait for developer environment.
5) Delete all text in editor. Copy-paste text from forum.
6) Menu Project -> Add Reference, find System.Windows.Forms. Оk.
7) Menu Build -> Build Solution
😎 Close environment if there no compilation errors. Use macro as in description in earlier post.
Good day YarUnderoaker
I tried doing what you described but this was the first time i was ever in the SharpDevelop tool so it was "monkey read, monkey do". I got a a couple of errors on line 23.
I made a screencast of my best effort and uploaded it to the link below. Thanks for your help.
The families that I have created contain every rebar and embed on 50' prestressed IT beams. Everything in this beam other than the concrete is contained in one big parametric family. The rebar is actually made in shared electric fixture families as individual bars which are nested in families and arrayed into beam sets. These are then nested into a family that brings every thing together.
Thanbks for the quick reply.
I tried it again with the applicatoin tab but get the same errors on line 23. Any ideas what I did wrong? I provided a screen cast of my latest effort.
Thanks for the reply.
I tried it again with the name "Tools" but got the same error on line 23. It seems to not like the work "Revit" for some reason. i have attached a couple of screen shots that show the error messages.
Thanks for the reply.
Would it be possible for you to send me an R2015 project file with a working macro like the one you uploaded for R2014?
Good day YarUnderoaker
I have gotten the macro to work in my project but it appears to only gather components from one family category for inclusion in assembileis. My assemblies are build as structural framing assemblies but then have structural rebar, connections, generic model electrical conduit (fake rebar), specialtiey items and other family catigory items added in.
should this macro add all of these components into the assembly and if so how do i do that? if not, can it be modified to do it?
The attached beam is made with two basic components. A structural concrete beam and a "furniture system" family that has famfake rebarshea
Good day YarUnderoaker
I have created a screencast that shows my attempt at using the macro you created on your family with some of my extra stuff. I am also uploading that file so you can experiment with it.
Any help you can offer in getting my subcomponents added to an assembly would be greatly appreciated.
You has double nesting. For that you need just run macro twice.
Or if you want to select all sub-subcomponents in one click use this modification
/* * Created by SharpDevelop. * User: YarUnaderoaker * Date: 30.01.2014 * Time: 18:36 * * 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; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; namespace Module { [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] [Autodesk.Revit.DB.Macros.AddInId("0AD12233-53B0-41B9-A47F-5AFC0A765288")] public partial class ThisDocument { 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 private void GetSub(Element e, ICollection<ElementId> subSet) { FamilyInstance fi = e as FamilyInstance; if (fi != null) { ICollection<ElementId> ids = fi.GetSubComponentIds(); if (ids.Count > 0) { foreach(ElementId subId in ids) { Element subE = this.Document.GetElement(subId); GetSub(subE, subSet); } } else subSet.Add(e.Id); } else { AssemblyInstance ai = e as AssemblyInstance; if (ai != null) { ICollection<ElementId> ids = ai.GetMemberIds(); foreach(ElementId subId in ids) { subSet.Add(subId); } } else { Group g = e as Group; if (g != null) { ICollection<ElementId> ids = g.GetMemberIds(); foreach(ElementId subId in ids) { subSet.Add(subId); } } } } } public void SelectSubCompnents() { Document doc = this.Document; ICollection<ElementId> elementSet = this.Selection.GetElementIds(); ICollection<ElementId> subSet = new Collection<ElementId>(); foreach(ElementId id in elementSet) { Element e = doc.GetElement(id); GetSub(e, subSet); } this.Selection.SetElementIds(subSet); } } }
Good day YarUnderoaker
I can get the nested families in the model I sent you yesterday to create an assembly by running the macro twice. Progress! The problem i now have is I cannot figure out how to run that macro in my project model. If I have both models open, they both show up in the macro manager but if I select my model elements in one model and use the macro in a different model, nothing happens.
How do I load your macro into my model. I tried cutting and pasting the text from that macro and also the one you sent today but get the error in the line "[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit .Attributes.Manual)]"
I am sure that most of the problem is my complete ignorance in how to use the SharpDevelop tool. Until i started this thread i didn't even know that there were macros in Revit and I have never tried to use them.
Since it seems to not like the word "Revit" I retyped ".Revit." and the program ran a bit farther. It seems like it might be a difference in the Key Codes used by your computer in Russian and mine in US English. I played around with the Debug tool and here is a screen shot.
I know this is an old thread but wondering if there was ever another fix for this. It seems like a problem that would have been fixed by Autodesk in the last 5 years since this thread was started. I have families with nested components that aren't showing in assemblies. I've never run a macro, so if there is no other fix, I'll be learning about how to do that also. Haha.
Autodesk does not bother to fix not critical bug/imperfection, so you must use some workaround.
That's too bad, I'm sure it would be an easy fix for them. Thank you for the reply!
THe simple truth is that AD does not give a flying fig about the end users as long as they keep sending in their subscription checks each year.