ToProtoType() vs Convert(), Inquiry on get_

python
api

#1

I haven’t heard of Convert() before, just saw it in this forums when I was searching for a way to convert revit geometry to dynamo geometry (edges to be specific)

	room_bound_box = room.get_Geometry(Options())
	
	face_list = []
	edge_list = []
	for geom_obj in room_bound_box:
	# the .Faces property returns a FaceArray
	# so we'll have to loop through the array
	# before using ToProtoType
		for face in geom_obj.Faces:
			# ToProtoType
			face_list.append(face.Convert())
			
		for edge in geom_obj.Edges:
			edge_list.append(edge.Convert())

I was having trouble converting the edge using edge.ToProtoType(), what’s weird was that face.ToProtoType() worked just fine.

Why did edge.ToProtoType() not work while on faces it worked?

Why isn’t there any documentation on this?
When should I use one or the other? (i.e. Convert() vs ToProtoType())


I’m also trying to get a deeper understanding of get_<property> syntax.
Based on my googling, seems like special C# syntax. And based on my observation (although I’m not sure), they only work indexers??? (although they don’t behave like indexers?, I’m not really sure).
For example (from the CHM):

public GeometryElement this[
 	Options options
 ] { get; }

or

public BoundingBoxXYZ this[
	View A_0
] { get; }

I was wondering why this was even necessary. Why not just use the properties as is?


#2

Hey @Der_Jon,

Have you been through this?

https://github.com/DynamoDS/Dynamo/wiki/Python-0.6.3-to-0.7.x-Migration#revitapi

Might be able to answer some of your questions :slight_smile:


#3

Yes. I haven’t read anything about Convert() though.