Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rotate Appearance on a face by 90 degrees

1 REPLY 1
Reply
Message 1 of 2
hozz__
478 Views, 1 Reply

Rotate Appearance on a face by 90 degrees

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

 

1 REPLY 1
Message 2 of 2
chandra.shekar.g
in reply to: hozz__

@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,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report