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: 

Remove Template from View

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Ryan
3158 Views, 5 Replies

Remove Template from View

Hi All,

 

I have been trying to figure out how to  remove an assigned View Template from a view; Set it to "None". I know how to find a view template and get its ID and assign to a view, but when i look for "None" it doesn't come through on the FEC.

 

Ive tried setting the View.ID to -1, but does't work.

 

Is there something Simple I'm missing?

 

Thanks!

 

 

2015-06-08_0932.png

5 REPLIES 5
Message 2 of 6
R.van.den.Bor
in reply to: Ryan

Hi All,

 

You can in this way :

 

View vw = doc.ActiveView;
Transaction tr = new Transaction(doc,"template to none");
tr.Start();
Parameter par = vw.GetParameter("View Template");
par.Set(new ElementId(-1));   <----------- I think what you did is just type par.Set(-1) and that doesn't work. SO you need to 'convert' the int to elementid
tr.Commit();

 

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 3 of 6
Ryan
in reply to: R.van.den.Bor

Great! Thanks!

 

I didn't think of trying to convert the int to an ElementID.

Message 4 of 6
R.van.den.Bor
in reply to: Ryan

In general this is the trick whenever you'll need to set a parameter of the elementId type. It's taken me some headache before I'll discovered this trick 🙂
Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 5 of 6
IAN~JAMES
in reply to: R.van.den.Bor

You are probably safer setting the value to ElementId.InvalidElementId as follows:

par.Set(ElementId.InvalidElementId);

So if anything changes under the hood in time to come, this should still work.
Message 6 of 6
v.slizen
in reply to: R.van.den.Bor

When I'm writing "View Template", for method "GetParameter" then it didn't converting "string" to "Autodesk.Revit.DB.ForgeTypeId"

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