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: 

Renumbering Detail Number based on location

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
BCampbellNWL
199 Views, 2 Replies

Renumbering Detail Number based on location

BCampbellNWL
Contributor
Contributor

Hey all! I'm developing a tool that will renumber views on a sheet based on their location in relationship to our title block. I'm super close, but when I go to set the value nothing happens. Anyone know why the SetValueString() method wouldn't work?

 

FilteredElementCollector viewportCollector = new FilteredElementCollector(doc.ActiveView.Document)
                .OfCategory(BuiltInCategory.OST_Viewports)
                .WhereElementIsNotElementType();

int arbitrarySet = 1000;

Transaction t2 = new Transaction(doc);
    t2.Start("Reset Detail Numbers");

    foreach (Element vp in viewportCollector)
     {
              arbitrarySet++;
              vp.get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).SetValueString(arbitrarySet.ToString());
                
      }
      t2.Commit();

 

(This portion is designed to renumber them to something arbitrary to avoid duplicate errors)

 

0 Likes

Renumbering Detail Number based on location

Hey all! I'm developing a tool that will renumber views on a sheet based on their location in relationship to our title block. I'm super close, but when I go to set the value nothing happens. Anyone know why the SetValueString() method wouldn't work?

 

FilteredElementCollector viewportCollector = new FilteredElementCollector(doc.ActiveView.Document)
                .OfCategory(BuiltInCategory.OST_Viewports)
                .WhereElementIsNotElementType();

int arbitrarySet = 1000;

Transaction t2 = new Transaction(doc);
    t2.Start("Reset Detail Numbers");

    foreach (Element vp in viewportCollector)
     {
              arbitrarySet++;
              vp.get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).SetValueString(arbitrarySet.ToString());
                
      }
      t2.Commit();

 

(This portion is designed to renumber them to something arbitrary to avoid duplicate errors)

 

Labels (1)
  • API
2 REPLIES 2
Message 2 of 3
RPTHOMAS108
in reply to: BCampbellNWL

RPTHOMAS108
Mentor
Mentor
Accepted solution

Note remarks section for Parameter.SetValueString in RevitAPI.chm:

 

"The method only applies to parameters of value types."

 

String is not a value type so use Parameter.Set.

 

There is also unit parsing overhead associated with SetValueString for value types.

 

Note remarks section for Parameter.SetValueString in RevitAPI.chm:

 

"The method only applies to parameters of value types."

 

String is not a value type so use Parameter.Set.

 

There is also unit parsing overhead associated with SetValueString for value types.

 

Message 3 of 3
BCampbellNWL
in reply to: BCampbellNWL

BCampbellNWL
Contributor
Contributor

@RPTHOMAS108  Thank you so much! Worked Like a charm! This API can be very confusing sometimes! haha I'll get the hang of it eventually!

0 Likes

@RPTHOMAS108  Thank you so much! Worked Like a charm! This API can be very confusing sometimes! haha I'll get the hang of it eventually!

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

Post to forums  

Autodesk Design & Make Report