Hi
Is it possible to change Element.Geometry? I get points from Element.Geometry,and I want to change the values of these points.But it seems impossible by Revit API.
Solved! Go to Solution.
Solved by matthew_taylor. Go to Solution.
Solved by BardiaJahan. Go to Solution.
Element.Geometry is a {get;} property which basically means you can only retrieve it and you cannot assign new value/data to it. To change the geometry of element you need to modify the element by available tools/options in its class for example to edit a wall you can change its location curve, etc.
Thank you for your answer.
When I change Elements' location curves ,it takes even an hour to make changes in some revit examples.Is there any way to improve efficiency?
Here is my code and file screenshots.
I am not an expert but there are a few things that might help:
1 - Try to avoid LINQ and use revit filters instead (however it is a one time thing in your code and shouldn't really matter.
2 - I would say use foreach to implement the loop and avoid using ElementAt (I think it is not very efficient)
3 - Another thing that I think would improve the efficiency is to do all the analysis in a separate thread than your RevitAPI-calling thread. So your plugin would calculate and analyze oldPoint and tempPoint in one thread and does the transaction and creates lines in the main thread.
4 - I would like to know your findings if you tried any of these or even a different approach.
Hello,
There's one thing that looks particularly taxing in your code, and another one that may be contributing.
1. Do one transaction around your loop, not a loop with transactions in it.
2. The get geometry part. Is that necessary? If it is, I'd run it in the loop (as opposed to your
FilteredElementCollector). If it's a wall, it's going to have geometry.
Cheers,
-Matt
p.s. If you just want walls, you could filter just for them using. (in vb.net) .ofclass(gettype (db.wall))
Thank you for your answer.
I added this line of code. Change IEnumerable to List.
List<Element> elems = elems1.ToList();
Efficiency has been greatly improved.I am confused about this, but it does happen.
Thank you for your answer.
I want to embed a watermark in Revit.Watermarks are embedded by coordinate values.
But when I read his article, it was found impossible.As shown in the following screenshot.
I have three questions
1.For example, I get a triangular net, read the point information, modify it, then update back. Is this possible?
2.Only by changing the file format,Can I change the geometric coordinates ?
3.When I change the eighth decimal place of the value of locationpoint, revit will report an error, which is very distressing.How do I avoid this situation?
Hello,
Referencing an ienumerable value will cause issues if referenced multiple times.
A quick google will bring up discussions like this:
Putting the transactions around your entire modification loop will make a massive improvement also.
As for your final message, it appears to be unrelated to this conversation, and isn't clear. I would suggest creating a new post, and being very clear about what your questions are.
8 decimal places? Forget about it!
Cheers,
-Matt