How to place family Instances according to the levels below them in python

We only have the information you’ve given us. When you respond to every update with “tried it, didn’t work, what now?” it doesn’t give us the confidence that you’re actually putting in effort on your end, whether you have or haven’t. You have to understand that this forum is a community of people helping others on their own time, just for the sake of the community. If it doesn’t appear that you’re putting in effort, people are going to get tired of responding. Make sure you’re updating us with what you’ve tried, where you think things are going wrong, and how you’ve at least attempted to address it every time something comes up. Most of use here really do want to help, but we don’t want to do other people’s work for them. That’s all.

The issue with the code (besides the mistype you already fixed) is that I had it setup to work with the end condition of remainingHeight < ShaftHeight for both the secondary shaft element and the final level, while only creating the final level when the values were equal. To fix, we just add another condition to see if the remainingHeight is equal to ShaftHeight or not to determine which shaft object to place.

Python
if remainingHeight <= ShaftHeight:
	
		if remainingHeight != ShaftHeight:
			shafts.append("Shaft2")
		else:
			shafts.append("Shaft1")
			
		name = "Level " + str(i+2) + " (" + str(TotalHeight) +")"
		level = Level.ByElevationAndName(TotalHeight, name)
		levels.append(level)
		
	else:
		shafts.append("Shaft1")
2 Likes