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: 

How to change Element.Geometry?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
1164037746
1770 Views, 7 Replies

How to change Element.Geometry?

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.

7 REPLIES 7
Message 2 of 8
BardiaJahan
in reply to: 1164037746

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.

Message 3 of 8
1164037746
in reply to: BardiaJahan

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.

Message 4 of 8
BardiaJahan
in reply to: 1164037746

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.

Message 5 of 8
matthew_taylor
in reply to: 1164037746

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))


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 6 of 8
1164037746
in reply to: BardiaJahan

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.

Message 7 of 8
1164037746
in reply to: matthew_taylor

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.

QQ截图20161215133424.png

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?

Message 8 of 8
matthew_taylor
in reply to: 1164037746

Hello,

Referencing an ienumerable value will cause issues if referenced multiple times.

A quick google will bring up discussions like this:

http://stackoverflow.com/questions/8240844/handling-warning-for-possible-multiple-enumeration-of-ien...

 

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


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?

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