Global name 'CreateViaOffset' is not defined

Hi,
I’m trying to use the CreateViaOffset method in order to offset the CurveLoop of a Face.
Since I’m using Python and not C#, I’m having a hard time understanding which library class contains this method.
In C# it’s explicit, but in Python it’s not clear to me.

I’ve looked at:
CreateViaOffset Class
C# example of implementation

Can you help me understand how to find this kind of information?
Thank you

@AH_Yafim, Have you got anything already started then people can help direct you in the right direction.

Though to start you off have a look at the following examples on this github page.

1 Like

Hi,
Thank you for directing me to that page.
I am familiar with doc.Create, but specifically for CreateViaOffset that doesn’t work.

I’m trying to use this line in a Transaction:
temp = CurveLoop.CreateViaOffset( faceLoop, 1, XYZ(0,0,1) )

the error I get is:
TypeError: expected CurveLoop, got builtin_function_or_method

So I’m not really sure what I’m doing wrong here.

Thank you :slight_smile:

Was the variable ‘faceLoop’ defined in the code or is in an input? If the former can you post that section of code, or better yet the whole thing. If the later can you post an image of your graph leading into the python node with the previews expanded?

1 Like

Sure.
I’m not using a graph in Dynamo, I’m using direct Python code with pyRevit.
In any case sorry for not posting before :

def getCeilingGeometry(element):
	largestFace = []
	area = 0
	geoElement = element.get_Geometry(Options())
	for geo in geoElement:
		for face in geo.Faces:
			if (face.Area > area):
				largestFace = face
		faceLoop = largestFace.GetEdgesAsCurveLoops

		t = Transaction(doc, "Create Loop Offset")
		t.Start()
		temp = CurveLoop.CreateViaOffset( faceLoop, 1, XYZ(0,0,1) )
		print(temp)
		t.Commit()

:slight_smile:

1 Like

I believe the line containing faceLoop = largestFace.GetEdgesAsCurveLoops is wrong.
You forgot the parenthese and thus an error is thrown.
It should be this.

faceLoop = largestFace.GetEdgesAsCurveLoops()

You’re using a method, but calling it as a property.

3 Likes