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

place a family in a family-file / assembly a family out of multiple families

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
346 Views, 5 Replies

place a family in a family-file / assembly a family out of multiple families

hey there,

 

few days ago I started to develop a small project for my company. The goal is it to assemble automatically a REVIT-family out of multiple existing REVIT-families by placing them in a family-document. After that I want to provide that document as a download.

Right now I can open documents and place family instances (in a project file by coordinates) by using an WCF, so I can run it later on the server an call the functions from outside. I tried that to test the API in general. So far I didn't have any problems. But know I tried to place and move the instances in a family-file by simply using the document.Create.NewFamilyInstance function. But it doesn't work in a family-file for me. Right now it's hard to debug because of the WCF. 

 

So my question now, is it in principle possible to "assemble" REVIT families in a family-document? Or do you have any other ideas how I can realize my plans?

 

 

Thanks, Marco

5 REPLIES 5
Message 2 of 6
Revitalizer
in reply to: Anonymous

Hi,

 

in Family context, use document.FamilyCreate instead of document.Create.

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 6
Anonymous
in reply to: Revitalizer

Hey Revitalizer,

 

thanks for your answer. My fault, I used document.FamilyCreate.NewFamilyInstance already, but it doesn't work.

So to make it clear, I want to place a existing Family within a opened .rfa-file. I think we have some issues with the WCF an it's not a problem of the REVIT-API. But again the question is it in general possible to place a existing family within a family-file by using the API?

 

Thanks, Marco

Message 4 of 6
Revitalizer
in reply to: Anonymous

Dear Mail,

 

do you use the correct overload of the NewFamilyInstance method ?

 

Since Families can have a different insertion behaviour, it is necessary to use the right one:

http://thebuildingcoder.typepad.com/blog/2013/09/family-instance-placement.html

 

Cheers,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 5 of 6
Anonymous
in reply to: Revitalizer

Hey Revitalizer,

 

it seems like I have another problem. I just cleared up my code to the basics and left out the WCF. I'm still not able to simply load a Family. Here my code:

 String FamilyPath = @"C:\Module_800_SEG.rfa";
                Family family = null;

                if (null == family)
                {
                    // It is not present, so check for 
                    // the file to load it from:

                    if (!File.Exists(FamilyPath))
                    {
                        throw new Exception("File not found " + FamilyPath);
                    }

                    // Load family from file:

                    using (Transaction tx = new Transaction(doc))
                    {
                        tx.Start("Load Family");
                        doc.LoadFamily(FamilyPath, out family);
                        tx.Commit();
                    }
                }

 

Any Ideas? Evertime I call it, I get a "System.Runtime.InteropServices.SEHException" in RevitAPI.dll. Is it possible to get additonal Information about the error.

 

Thanks, Marco

Message 6 of 6
Anonymous
in reply to: Anonymous

Hey there,

 

I solved a lot of problems over the weekend and now biggest parts of the code do their job. But I habe still one last problem left.

After I placed a family into a new FamilyDocument I want to place the next block right next to the first, the third right next to the second and so on. The width of the blocks can be different, so I decided to use planes in families I place, to find the Point for the next block. But I don't find a way to access the planes via the API.

 

To make it clear. I want to open an emtpy FamilyDocument(FamilyHost) (check). After that I want to place a existing family (Element1) into it (check). Then I try to place a second family(Element2) right next to the first(looking for a solution). All blocks can have the same y- and z-coordinates, only the x-part is different. Now I modified the Element1-Family, so that it has a plane at its end named RIGHT. After placing the familyInstance the plane is not visible int he Document, but i want to know the x-coordinate of the plane "RIGHT".

 

Any ideas?

 

 

Thanks, Marco

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community