Using the Material Browser, I created a material with some JPEG image and then in code, I applied that material to a face as follow (this works):
# Get the currently selected entity.
selObj = ui.activeSelections.item(0)
# Check to see if it's a face.
if selObj.entity.objectType == fus.BRepFace.classType():
fav = app.favoriteAppearances
wood = fav.itemByName('MyWoodAppearance')
face = fus.BRepFace.cast(selObj.entity)
face.appearance = wood
Now that a selected face has an appearance applied, I use the following to move the appearance 1 cm in the Y direction, but the last line caused an exception. What did I do wrong?
if selObj.entity.objectType == fus.BRepFace.classType():
face = fus.BRepFace.cast(selObj.entity)
texture = face.body.textureMapControl
if texture.objectType == adsk.core.ProjectedTextureMapControl.classType():
texture3D: adsk.core.ProjectedTextureMapControl = texture
# Define a matrix that will move the body 1 cm in the Y direction.
vector = adsk.core.Vector3D.create(0.0, 1.0, 0.0)
transform = adsk.core.Matrix3D.create()
transform.translation = vector
texture3D.transform = transform
s