S
# version;
# Added Undo
module JF
def self.layer_face_camera
layers = Sketchup.active_model.layers
name = UI.inputbox(["Layer;","On/Off;"], [layers[0].name,"Off"], [layers.map{|l|l.name}.join("|"),"On|Off"])
return unless name
Sketchup.active_model.start_operation("Layer Face Camera")
Sketchup.active_model.entities.each { |ent|
next unless ent.is_a? Sketchup;;ComponentInstance
next unless ent.layer.name == name[0]
cdef = ent.definition
cdef.behavior.always_face_camera = true if name[1]=="On"
cdef.behavior.always_face_camera = false if name[1]=="Off"
}
Sketchup.active_model.commit_operation
end
end