Element.Geometry node (from Revit) to Python Script


#1

Hello, dear friends,

how to excecute the action from Element.Geometry node inside of Python Script? Can’t find the solution… Please, help! :3


#2

 

 

Are you trying to use the node equivalent or the backend method? For the node, simply try this:

 

If you want to dig deeper, you’ll need to check out the freely available source code here:

There’s a ready-made “Convert” method, so all we need to do is to get to the Revit primitive and apply the conversion method:


Modify Line Styles in Filled Regions
Retrieving detailed wall layer geometry without physically generating parts in Revit
#3

Hello, dear.
What I want is exactly in your first screenshot.
This is weird, because I have already tried to use .Geometry()! But it works now… Maybe, I was drunken too much.
Thank you!


#4

Hi @DIMITAR VENKOV

How to convert code in pic 1 and pic 2 to revit python shell, when i use element.Geometry in revit python shell, the result is not Solid, and in pic 2, i can not use method Convert(),

Can you please show me that code in revit API (i use revit python shell)

Thanks you !!


#5

still need help !!!


#6

still need help !!!


#7

You always need help, but never help anyone.


#8

How did you know that ??

If you don’t want to help me, or don’t know the answer, please don’t comment like spammer.


#9

Could you show me the last time you helped someone on this forum?

Evil Spammer

 


#10

Why you care about my help, this is very important with you ?? Maybe you care about you obtained than things you can help someone ?? :slight_smile:

http://dynamobim.org/forums/topic/sheet-creation-with-special-character/

If you have ever use revit python shell, it’s different than dynamo, with dynamo just use element.geometry, i finding a solution in revit python shell and it’ using python code not in C#, if i use C# it’s very easy to me.

Thanks


#11

Seriously?.. I mean real help. The user is not using Revit Python Shell… You’ve noticed, right?..

Dimitar’s solution:

Good luck.


#12

Thanks you for your help, i try this code before, but i don’t know why my python shell get error. You can see the picture attached below, please advise me.


#13

Sorry, unfortunately my script doesn’t work anymore, when i use the Convert() method Revit crashes. In your script the error is in line 7, something related with that reference.

I’m using Revit 2014 and the Installer for Autodesk Revit 2014.


#14

Thanks. I found solution for this issue, my code like this :
<div style=“color: #222222;”>
<div class=“IVILX2C-Db-b” style=“color: #888888;”>selection = [ doc.GetElement( elId ) for elId in revit.ActiveUIDocument.Selection.GetElementIds() ]

opt = Options()

for i in selection:
geo = i.get_Geometry(opt)
for a in geo:
geo = a.GetInstanceGeometry()
for g in geo:
if ( g != None) & (g.Faces.Size >0):
print g.ComputeCentroid()</div>
</div>
 


#15

Oh, you need the geometry of family instances, hahaha.