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: 

View.Duplicate method return same Id

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
b.molinaSGEZ5
434 Views, 4 Replies

View.Duplicate method return same Id

Hi!

I have tried to invoke the duplicate method (https://www.revitapidocs.com/2023/0cb1793f-1df0-d5b4-3b72-8d468b80199e.htm) on the Level 1 view in Floors Plan with Id 312 inside the default project "RAC_basic_sample_project.rvt" that comes with the Revit 2023 installation.

 

To my surprise, the method doesn't return a new Id for the duplicate view. Instead it returns the same Id as the view I'm trying to duplicate (in this case 312).

 

Does anyone know what could be causing this behavior? Thank you very much for your answers

Labels (3)
4 REPLIES 4
Message 2 of 5

Hi @b.molinaSGEZ5 ,

 

I tested it on my end.
I am not able to reproduce the issue.
New duplicated ViewPlan/view is having new id(not 312).
Could you please share the sample code you used?


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 5

private View GetViewFloorPlanModel()
{
    var viewRoom = ViewUtilities.DuplicateView(this.Document, this.Document.ActiveView);
    return viewRoom;
}
public static View DuplicateView(Document doc, View view)
{
    var duplicatedView = view.Duplicate(ViewDuplicateOption.WithDetailing);
    return doc.GetElement(duplicatedView) as View;
}

 

Message 4 of 5

Hi @b.molinaSGEZ5 ,

 

I tested the sample code you shared.

I am still unable to reproduce the issue.

Please see the attached screenshot.

 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 5 of 5

Hi, sorry for the delay,

Clean uninstall following this instructions (https://knowledge.autodesk.com/support/revit/learn-explore/caas/sfdcarticles/sfdcarticles/How-to-Com...


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

Post to forums  

Rail Community


Autodesk Design & Make Report