Hi everyone!
I have a problem with face coloring. Here is code for example
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
ent.clear!
#wall
f0 = []
f0[0] = [26.074643, -28.518705, 0.000000]
f0[1] = [26.074643, -51.189309, 0.000000]
f0[2] = [26.074643, -51.189309, 9.842520]
f0[3] = [26.074643, -28.518705, 9.842520]
face0 = ent.add_face(f0)
cfn0 = Sketchup::Color.new "Yellow"
cfn0.alpha = 10
face0.material = cfn0
face0.back_material = cfn0
#hole 1
f0in1 = []
f0in1[0] = [26.074643, -31.118771, 7.004593]
f0in1[1] = [26.074643, -34.120739, 7.004593]
f0in1[2] = [26.074643, -34.120739, 1.000656]
f0in1[3] = [26.074643, -31.118771, 1.000656]
face0in1 = ent.add_face(f0in1)
ent.erase_entities(face0in1)
#hole 2
f0in2 = []
f0in2[0] = [26.074643, -35.219820, 7.004593]
f0in2[1] = [26.074643, -38.221789, 7.004593]
f0in2[2] = [26.074643, -38.221789, 1.000656]
f0in2[3] = [26.074643, -35.219820, 1.000656]
face0in2 = ent.add_face(f0in2)
ent.erase_entities(face0in2)
#hole 3
f0in3 = []
f0in3[0] = [26.074643, -39.320870, 7.004593]
f0in3[1] = [26.074643, -42.322839, 7.004593]
f0in3[2] = [26.074643, -42.322839, 1.000656]
f0in3[3] = [26.074643, -39.320870, 1.000656]
face0in3 = ent.add_face(f0in3)
ent.erase_entities(face0in3)
#red frame
f1 = []
f1[0] = [26.074643, -34.058239, 6.942093]
f1[1] = [26.074643, -31.181271, 6.942093]
f1[2] = [26.074643, -31.181271, 1.063156]
f1[3] = [26.074643, -30.889276, 1.063156]
f1[4] = [26.074643, -30.889276, 7.234088]
f1[5] = [26.074643, -34.350234, 7.234088]
f1[6] = [26.074643, -34.350234, 1.063156]
f1[7] = [26.074643, -34.058239, 1.063156]
face1 = ent.add_face(f1)
cfn1 = Sketchup::Color.new "Red"
cfn1.alpha = 10
face1.material = cfn1
face1.back_material = cfn1
#inner green frame
f2 = []
f2[0] = [26.074643, -31.118771, 7.004593]
f2[1] = [26.074643, -31.118771, 1.000656]
f2[2] = [26.074643, -34.120739, 1.000656]
f2[3] = [26.074643, -34.120739, 7.004593]
face2 = ent.add_face(f2)
cfn2 = Sketchup::Color.new "Green"
cfn2.alpha = 10
face2.material = cfn2
face2.back_material = cfn2
#window hole
f2in = []
f2in[0] = [26.074643, -31.181271, 6.942093]
f2in[1] = [26.074643, -34.058239, 6.942093]
f2in[2] = [26.074643, -34.058239, 1.063156]
f2in[3] = [26.074643, -31.181271, 1.063156]
face2in = ent.add_face(f2in)
ent.erase_entities(face2in)
As you can see from the code first face is colored in yellow. But after all operations it starts to be colored in green, as last face with a hole. (picture is added)
What is the problem? Has everyone had already this problem?
Thanks, for your answers!