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: 

Wrong menu after the CopyElements command

2 REPLIES 2
Reply
Message 1 of 3
tobiazambon
242 Views, 2 Replies

Wrong menu after the CopyElements command

Hello,

 

I'm using the CopyElements command in order to copy a bunch of ModelLines from a project to a family. I've create the family document and I've the list of lines' reference to copy; the statement I'm using is the following:

 

ElementTransformUtils.CopyElements(myProjectDocument, new Collection<ElementId>(myListOfReference.Select(r => myProjectDocument.GetElement(r).Id).ToList()), myFamilyDocument, Transform.CreateTranslation(new XYZ(-location.X, -location.Y, 0)), null)

 

and it correctly copies the lines. After this I close the family document:

 

myFamilyDocument.SaveAs(completeFilePath);
myFamilyDocument.Close(false);

 and insert an instance of this new family into my project:

 

myProjectDocument.LoadFamilySymbol(familyPath, familyType, new FamilyLoadingOverwriteOption(), out familySymbol);
myProjectDocument.Create.NewFamilyInstance(location, familySymbol, StructuralType.NonStructural);

 

The instance is correctly inserted and I see the lines and everything is OK with the geometry/family symbol.

The prolem is that the Revit menu has been changed like I'm into a family document and not a project document: Architecture/Structure/Systems/etc ribbons are gone away and a "Load into project" command appears to all the remaining ribbons. I've to lunch another command (like Create extrusion) and exit from the command in order to re-obtain my correct menu.

This is very annoying to do every time I run my command and maybe will lead to new errors for further command development. Does anyone know how to avoid this behavior?

 

Thank you

Tobia

2 REPLIES 2
Message 2 of 3

Hi,

 

When the command starts, is it running this from a Project document or Family document? Is it a matter of refreshing the screen or is it changing during/after the execution?

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 3

Hi, I'm copying elements from a project document to a family document. The command is running from the project document. The problem is that after the execution of the command, the menu is wrong in the way described above

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