How I can convert string IDs to Elelment ? I need help


#1

Hallo!
I need help.
How I can convert string IDs to Elelment ?

I found what I needed here


screen:
https://yadi.sk/i/K9EW0XnodVzJ9

but I do not understand why is not working python script:
elemId = Autodesk.Revit.DB.ElementId(idInt)

screen:
https://yadi.sk/i/iUcB2qYCdVzaB

script:
https://yadi.sk/i/UlZWmsyEdVzgm

please, help me.


#2

1


#3

once i published a package called Element-IDs.

it is still available via package manager

there you will find a node called ID.Element

it converts ids to elements and accepts strings as input


#4

My question

but I do not understand why is not working python script:
elemId = Autodesk.Revit.DB.ElementId(idInt)

I looked at your node, but it does not help me

5


#5

Who knows how to do it ?

please example


#6

I use Revit 2015


#7

@Anton Martin

checking your posts i do not see your problem!

for i in ids:
idInt = int(i) # assign i as integer to idInt
elemId = Autodesk.Revit.DB.ElementId(idInt) # create an element Id from integer
elements.append(doc.GetElement(elemId).ToDSType(True)) # append the selected element to a list called elements

it does not matter if it is walls, windows…

maybe you post your full dynamo definition

my guess is, that your variable idInt is not integer


#8

Archive

Revit 2015, Dynamo 0.7.6


#9

@Anton Martin

just insert these two lines in the python header

clr.AddReference(“RevitAPI”)
import Autodesk


#10

I am beginner))

I was just the second day of studying dynamo.

it was enough to string: import Autodesk ))) it working

I do not know it.

Peter, thank you! you really helped

p.s. sorry for my English, I’m from Russia


#11

Peter - I have a list of strings, these strings contain numerical characters that were once Elements IDs. I am looking to use these numbers to select the elements once again. It is related to this topic:

http://dynamobim.com/forums/topic/0-7-5-select-divided-surface-families-only-selects-half-of-the-panels-on-surface/

Any thoughts?

 


#12

Brian,

This is a sketchy proposition. Please read this:


#13

Konrad,

Not sure if you saw the first divided surface post, but this trail leads back to there. The more i try to understand the missing links in the logic (in this case missing element id’s) , the more the different issues arise. All to much to explain on here, but here is a rough take on the process:

  1. revit / dynamo does not see all families (curtain panel pattern based) of a triangular divided surface…except that perhaps it does.

  2. use these nodes (Select Divided Surface Families > Element.ID (‘Clockwork’ package) > Excel.WriteToFile ). Within the new .xlsx, you will find all of the families hosted on the divided surface. Select Divided Surface Families node , within Dynamo, only outputs every other panel.

  3. so now you are left with an .xlsx sheet, with all of the elements id’s, with which you can copy and paste into “Select by IDs” command within Revit. This does work; can select all of the panels. The trick is, how can you use this same data to have Dynamo select the very same panels??


#14

Import the IDs from Excel to Dynamo and then use either Peter’s node mentioned above, alternatively Element.ByID (package Clockwork) or Id to Element (package archi-lab.net) to turn them back into Revit elements.

And I think you should file a bug report for the thing with the missing panels. It sounds very odd.


#15

Andreas - yes, I put together a python node from the info above. That is successful.

The other issue is likely not solely a Dynamo issue, but perhaps has something to do with how Revit generates paneling for the triangle patterns, bent and flat. The Select Divided Surface Families node seems to recognize all panels on a basic rectangle patterned surface. It is just something with the triangle