API select to faces


#1

We could call an API one side of a square to change the color to that face from console? We may also associate a constant value to a square?


#2

I’m unsure what you are asking for. Can you elaborate? Maybe add some images that illustrate what you want?


#3

I have designed a cube in SketchUp and I want you by Ruby console to change color their faces , make one side is invisible …


#4

When you say “invisible” - you mean erasing it? Or applying a transparent material?
Is the “invisible” face arbitrary, or does it has to be a specific one?

Do you have some code already? If so, can you show us what you got?


#5

If transparent. I have no code , sorry. The idea was to make a 3D model to upload to the web . And on the web change its properties


#6

The following statements can get you started:

face = Sketchup.active_model.selection.first
new_material = Sketchup.active_model.materials.add()
new_material.alpha = 0.50
face.material = new_material

Before entering them at the console, you have to use Sketchup’s built-in select tool to select the desired face. The code above assumes that you selected the front material of a face. There are two sides to a face, and it specifically uses “.material” method, which is the front side. The code does not determine if the side facing the user is front or back. The code also does not attempt to duplicate any texture and apply transparency. If the material is the default material, then the material object is nil and there is no texture to copy. The transparency is set to 50% with the third statement.

After saying that, I don’t understand your statement:

And on the web change its properties

What exactly does that mean? Are you going to create a model with Sketchup, put it on a web page, and somehow modify a face’s transparency?


#8

La idea era subir la ONU modelo 3D a la web, por example Como Una edificio. Y Una Vez En La web Poder Elegir Una planta, o visualizar Unas Plantas si y de otras no. Y como no sabía como hacerlo quería probar con un cuadrado. Porque puedo subir un modelo de 3D warehouse pero nose como hacer para interactuar con esa imagen, es decir, cambiar transparencia, color…etc