I found this code example that is supposed to handle rotating an appearance override image by 90 degrees, but I experience 2 problems with it...
1. There is no asset of type "kAssetValueTextureType"
2. An Asset value of type kAssetValueTypeColor" exists, but it has no connected texture
As a result the code fails to run as expected...it's a material and image from a custom material library if that helps.
How else might I need to access the asset properties in order to rotate it? Or is there something else missing in my code?
Sub RotateTextureOfAppearanceOnFace(oFace As Face) oWrite.WriteLine(vbTab & vbTab & Now & "RotateTextureOfAppearanceOnFace(oFace As Face)") Dim oAppearance As Asset oAppearance = oFace.Appearance Dim oNewAppearance As Asset oNewAppearance = oAppearance.Duplicate Dim oAssetValue As AssetValue Dim oValue As AssetValue Dim oTextureAssetValue As TextureAssetValue Dim oRotationValue As FloatAssetValue Dim oAssetTexture As AssetTexture Dim oColorAssetValue As TextureColorValue ' find a texture and rotate the texture by 90 degrees. For Each oAssetValue In oNewAppearance If oAssetValue.ValueType = kAssetValueTextureType Then If InStr(1, LCase(oAssetValue.Name), "color") Then oTextureAssetValue = oAssetValue oRotationValue = oTextureAssetValue.Value("texture_WAngle") '(23) / Angle oRotationValue.Value = 0 '90 ' This should be a defect that the Double value is not in radians. End If ElseIf oAssetValue.ValueType = kAssetValueTypeColor Then Dim oColorAssetValue As ColorAssetValue oColorAssetValue = oAssetValue If oColorAssetValue.HasConnectedTexture Then MsgBox("ColorAssetValue: " & oAssetValue.Name) oAssetTexture = oColorAssetValue.ConnectedTexture oRotationValue = oAssetTexture.Item("texture_WAngle") '(23) / Angle oRotationValue.Value = 90 ' This should be a defect that the Double value is not in radians. End If End If Next ' override the appearance oFace.Appearance = oNewAppearance End Sub
Any help is greatly appreciated
@hozz__ ,
Hoping that suggestions in the below link may be helpful.
https://adndevblog.typepad.com/manufacturing/2015/11/texture-rotation-in-the-inventor-api.html
Thanks and regards,
Can't find what you're looking for? Ask the community or share your knowledge.