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: 

Swapping linestyles

0 REPLIES 0
Reply
Message 1 of 1
Kevin.Bell
107 Views, 0 Replies

Swapping linestyles

Kevin.Bell
Advisor
Advisor

Hi,

 

I'm looking to create some sort of addon that allows the user to globally swap all lines of style x to style y.

 

So to do this, I create a FilteredElementCollector to get all lines:

 

            FilteredElementCollector getlines = new FilteredElementCollector(doc)
                .WherePasses(new ElementCategoryFilter(BuiltInCategory.OST_Lines))
                .WhereElementIsNotElementType();

 

Then use GetLineStyleIds() to get all the line styles, iterate the style names to find the one I want then cast it to a GrpahicsStyle and set it with DetailLine.LineStyle (or ModelLine).

 

The issue I have is that this only covers Detail or Model lines, so I then have to get all Filled Regions, and iterate through their lines and check the linestyles.

 

Is there a better way to do this to simply get all items using a line style? I'm concerned that I might miss something using the line style I want to change?

 

Thanks!

 

0 Likes

Swapping linestyles

Hi,

 

I'm looking to create some sort of addon that allows the user to globally swap all lines of style x to style y.

 

So to do this, I create a FilteredElementCollector to get all lines:

 

            FilteredElementCollector getlines = new FilteredElementCollector(doc)
                .WherePasses(new ElementCategoryFilter(BuiltInCategory.OST_Lines))
                .WhereElementIsNotElementType();

 

Then use GetLineStyleIds() to get all the line styles, iterate the style names to find the one I want then cast it to a GrpahicsStyle and set it with DetailLine.LineStyle (or ModelLine).

 

The issue I have is that this only covers Detail or Model lines, so I then have to get all Filled Regions, and iterate through their lines and check the linestyles.

 

Is there a better way to do this to simply get all items using a line style? I'm concerned that I might miss something using the line style I want to change?

 

Thanks!

 

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report