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: 

Deleting Fill Patterns

25 REPLIES 25
SOLVED
Reply
Message 1 of 26
Anonymous
4147 Views, 25 Replies

Deleting Fill Patterns

hey there,

 

I have a tool which deletes fill patterns in a family. Up till Revit 2014 it worked, but now in 2015 it doesn't anymore.

 

It looks like the standard Fill Patterns like Solid fill, Vertical, Diagonal up, Crosshatch ect. can't be deleted anymore?? 

 

With RevitLookup I concluded that all 'standard' fill patterns have an ElementId which consists of less digits then 'user fill patterns'.

So I've made the workaround like below, but this will only bypass them. Does anybody know how I can delete these standard fill patterns in a family ?

 

public static void RemoveFillPatterns(Document doc)
{
List<FillPatternElement> fillp = new FilteredElementCollector(doc).WherePasses(new ElementClassFilter(typeof(FillPatternElement))).OfType<FillPatternElement>().ToList();


foreach (FillPatternElement HatchPattern in fillp)
{
try
{
if (HatchPattern.Id.ToString().Length > 5) doc.Delete(HatchPattern.Id);
}
catch (Exception ex)
{

   // apperently a standard fill pattern which can't be deleted in 2015
   MessageBox.Show(ex.Message);
}
}
}

 

 

25 REPLIES 25
Message 2 of 26
mertens3d
in reply to: Anonymous

You are wrapping this in a transaction right?
Message 3 of 26
Anonymous
in reply to: mertens3d

yes, I do, otherwise I wouldn't be able to delete any fill pattern. ANd it's like I said, with this code I can delete all fill patterns in a family, except for the default standards fill patterns like Crosshatch, solid fill ect. Try this code in revit 2014, and it will work and delete all fill patterns. So it looks like something has been changed in the Revit 2015. I'm afraid this another of those 'as designed' answers, since I saw the same behavior with subcategories. Up to Revit 2014 you could delete all subcategories with the api as you could by manual delete. And in Revit 2015 some couldn't be deleted anymore by the api. So, I'm hoping in the next Revit these issues are fixed.
Message 4 of 26
mertens3d
in reply to: Anonymous

Sorry about that. I was reading on my phone and not paying a lot of attention I thought I had a possible quick solution.
Message 5 of 26
Anonymous
in reply to: mertens3d

haha, no problemo, thanks or the suggestion anyway.
Message 6 of 26
jeremytammik
in reply to: Anonymous

Dear Remy,

 

How important is this to you?

 

I can always pass this on to the development team as a wish list item.

 

On the other hand, they have more than enough to do anyway.

 

Can you explain why this is important to you?

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 7 of 26
Anonymous
in reply to: jeremytammik

Well, this function is part of our Revit application where a user can clean up it's families and project. In order to localize the content, dutch fill patterns will be imported and we don't have the need for the english fill patterns. Up till version 2014 it worked perfectly, but in 2015 this changed for some reason. How important is it.. Well, it's not a huge showstopper, so I guess it's not that important. But then again, since it did work up till 2014 the development team already has the technology, so I guess if a development team member looks at it during a coffee break, it should be a quick fix 🙂 🙂 🙂  

Message 8 of 26
jeremytammik
in reply to: Anonymous

Dear Remy,

 

Thank you for the explanation. That makes sense.

 

I logged the issue REVIT-48299 [API: deleting basic fill patterns works in 2014 but fails in 2015 -- 10019483] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software.

 

Please make a note of this number for future reference.

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 9 of 26
jeremytammik
in reply to: Anonymous

Dear Remy,

 

I have an update on this issue for you.

 

The development team explored the issue REVIT-48299 [API: deleting basic fill patterns works in 2014 but fails in 2015 -- 10019483] and reply:

 

We did indeed implement a change REVIT-44131 in Revit 2015 UR4 and Revit 2015 R2 that prevents the deletion of the Solid fill pattern only. Apparently, deleting this one is really bad, because Revit expects to be able to use it in certain situations and it cannot be reloaded once deleted.

 

It is unfortunate that this change ended up in an UR, because we did know that some add-ins actively attempted this deletion. It would of course have been much better to make this change only in a next major release when we could document the behavior and allow 3rd party developers to adjust to it.

 

That being said, I cannot reproduce the claim that *all* built-in fill patterns cannot be deleted. I upload a family and project both with embedded macros based on the users' code which try to delete the fill patterns one at a time. The only one prevented from being deleted (out of 6 in the family, and 48 in the project) is the solid fill pattern - all the rest are still deleted as expected.

 

I'm going to close this as "Works as Expected" since the only time the deletion seems to be prevented is indeed as we intended. Unfortunately the developers may need to issue an update to deal with this behavioral change.

 

I hope this clarifies.

 

Thank you for your understanding!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 10 of 26
Anonymous
in reply to: jeremytammik

Thanks for clearifying. You are right, only solid fill can't be deleted 🙂
Message 11 of 26
jeremytammik
in reply to: Anonymous

Dear Remy,

 

I am glad you see the same behaviour.

 

Thank you for the confirmation.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 12 of 26
hugha
in reply to: jeremytammik

My add-In disallows deleting the Solid pattern since on my reading of the API docs I could not find any way to recreate it (short of copying it in from another project) once deleted.  I had no idea that deleting the Solid pattern could lead to difficulties elsewhere.

 

Hugh Adamson

www.hatchkit.com.au

 

 

 

Message 13 of 26
Anonymous
in reply to: hugha

Hi Hugh, it's like I've wrote, up till 2014 it's wasn't a problem. In 2015 the rules have been changed.
Message 14 of 26
Anonymous
in reply to: Anonymous

I noe have two fill patterns in my template and I only want the Solid Fill. Somewhere along the line we have ended up with the French version of solid fill. Can't rename, can't delete no way of getting rid of a redundant fill pattern unless I open a previous version.....Very frustrating.

Message 15 of 26
Kimtaurus
in reply to: Anonymous

*bump*

 

I've got the same problem. Actually I have 4 different solid fills in 4 languages.

They probably got imported with custom families online. But I can't delete them.

 

Is there maybe a way through Dynamo to delete them?

_____________________________________________________________________________
Please use "Accept as Solution" and give kudos as appropriate to further enhance these forums. Thank you!
Message 16 of 26
jeremytammik
in reply to: Kimtaurus

Dynamo useds the Revit API for all itss interactions with Revit.

 

If the Revit API does not enable this, Dynamo cannot do so either.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 17 of 26
jeremytammik
in reply to: jeremytammik

Hi guys, 

 

I added a note on the new issues you reported to REVIT-48299 [API: deleting basic fill patterns works in 2014 but fails in 2015 -- 10019483] and asked the development team to take another look at it.

 

Let's hope for the best.

 

Thank you for your patience.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 18 of 26
Anonymous
in reply to: jeremytammik

Good morning,

 

Please, tell me, I have a problem with deleting FillPatterns in Revit 2015. The deleting is not work.

 

Will It works in Revit 2016?

 

Thank you in advance.

Message 19 of 26
jeremytammik
in reply to: Anonymous

Please read the explanations above.

 

There are issues with the deletion of solid fill patterns.

 

All others should work fine.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 20 of 26
Anonymous
in reply to: jeremytammik

Thank you, I readed and I understand )

 

I delete all elements, but I can't delete SOLID FillPatternElement. Maybe that is normal?!

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

Post to forums  

Rail Community


Autodesk Design & Make Report