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

Nested family with shared components not showing in assembly

40 REPLIES 40
SOLVED
Reply
Message 1 of 41
haydenwse
5458 Views, 40 Replies

Nested family with shared components not showing in assembly

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?

40 REPLIES 40
Message 21 of 41
haydenwse
in reply to: YarUnderoaker

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.

Message 22 of 41
YarUnderoaker
in reply to: 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.

Message 23 of 41
haydenwse
in reply to: YarUnderoaker

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. 

  • "Expected class, delegate, enum, interface, or struct (SC1518) 
  • ) expected (SC1026)

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. 

 

http://screencast.com/t/l7H2ckt4

Message 24 of 41
YarUnderoaker
in reply to: haydenwse

I`m sorry, my fail.
must be 2) Select tab Application

Further you may use macro in other projects without it recreating.
Message 25 of 41
haydenwse
in reply to: YarUnderoaker

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.

 

http://screencast.com/t/lGYoe9ra

Message 26 of 41
YarUnderoaker
in reply to: haydenwse

Caps is important when you type name of module. Type Tools instead TOOLS.
Message 27 of 41
haydenwse
in reply to: YarUnderoaker

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.

Message 28 of 41
YarUnderoaker
in reply to: haydenwse

Strange!
Something wrong with your SharpDevelop.
Maybe Autodesk support will help you.
Message 29 of 41
haydenwse
in reply to: YarUnderoaker

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?

Message 30 of 41
YarUnderoaker
in reply to: haydenwse

Here is

Message 31 of 41
haydenwse
in reply to: YarUnderoaker

That worked perfectly.

 

thanks.

Message 32 of 41
haydenwse
in reply to: YarUnderoaker

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

Message 33 of 41
YarUnderoaker
in reply to: haydenwse

Macro just select subcomponents, if they not selected - its not nested.
Message 34 of 41
haydenwse
in reply to: YarUnderoaker

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.

Message 35 of 41
YarUnderoaker
in reply to: haydenwse

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); 			
		}
	}
}
Message 36 of 41
haydenwse
in reply to: YarUnderoaker

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.
    

Message 37 of 41

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.

Kevin Mendenhall
Revit Architecture 2022
Microsoft Windows 11 Professional
Dell Precision 5870 - x64 based PC - Intel Xeon CPU @ 3.80GHz, 6 Core. 80Gb RAM
Installed Add Ins - Enscape/StrucSoft MWF/LotSpec
Message 38 of 41

Autodesk does not bother to fix not critical bug/imperfection, so you must use some workaround.

Message 39 of 41

That's too bad, I'm sure it would be an easy fix for them. Thank you for the reply!

Kevin Mendenhall
Revit Architecture 2022
Microsoft Windows 11 Professional
Dell Precision 5870 - x64 based PC - Intel Xeon CPU @ 3.80GHz, 6 Core. 80Gb RAM
Installed Add Ins - Enscape/StrucSoft MWF/LotSpec
Message 40 of 41

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.

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