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
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?
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