Set view title default when moving the view to the sheet

Set view title default when moving the view to the sheet

NhuTruong_BeyCons
Contributor Contributor
1,331 Views
8 Replies
Message 1 of 9

Set view title default when moving the view to the sheet

NhuTruong_BeyCons
Contributor
Contributor

Hi everybody, how to set view title default when moving the view to the sheet using C#. Thank you.

0 Likes
1,332 Views
8 Replies
Replies (8)
Message 2 of 9

BardiaJahan
Advocate
Advocate

Try getting the BuiltInParameter View_Description from the view:

 

view.get_parameter(BuiltInParameter.View_Description)

0 Likes
Message 3 of 9

Vuth53569
Observer
Observer

Help me, what do I have to set with BuiltInParameter? Thanks.

My Code:

1.png

0 Likes
Message 4 of 9

buihaviet
Participant
Participant

Dear Vu,

 

Try this:

view.get_Parameter(BuiltInParameter.VIEW_DESCRIPTION).Set("What ever you want!");

 

Cheer,

Viet

0 Likes
Message 5 of 9

NhuTruong_BeyCons
Contributor
Contributor

I want to set view title with the name "No Title" for all viewers. When I move any views to the sheet, they have viewport type is "No Title". Currently, I don't find the parameter for "No Title", I know it at ElementType and get with syntax ElementType elementType = new FilteredElementCollector(doc).OfClass(typeof(ElementType)).Cast<ElementType>().Where(x => x.Name == "No Title").First();

Hope everybody help please. Thanks.

0 Likes
Message 6 of 9

Vuth53569
Observer
Observer

Thanks, everyone. I've resolved it.

0 Likes
Message 7 of 9

buihaviet
Participant
Participant

Dear Nhu,

 

Try this

//Get viewport element
Viewport vp = Viewport.Create(doc, sheet, section, new XYZ(0, 0, 0)); //Find View port type (use System.Linq) Element viewport = new FilteredElementCollector(doc).WhereElementIsElementType().Where(s => (s as ElementType).FamilyName == "Viewport").ToList().FirstOrDefault(s => s.Name == "No Title"); //Change viewport element type vp.LookupParameter("Type").Set(viewport.Id);

Hope this help!

 

Cheer,

Viet

 

0 Likes
Message 8 of 9

FlorisvdG
Advocate
Advocate

Good to hear you got it resolved. Maybe you could select the reply that lead to this as the solution? If you fixed it in an other way, could you post the solution yourself, and mark it as such? Might be helpful for others in the future 🙂

0 Likes
Message 9 of 9

NhuTruong_BeyCons
Contributor
Contributor

Dear FlorisvdG, this is my Code

ElementType elementType = new FilteredElementCollector(doc).OfClass(typeof(ElementType)).Cast<ElementType>().Where(x => x.Name == "No Title").First();
doc.SetDefaultElementTypeId(ElementTypeGroup.ViewportType, elementType.Id);

0 Likes