How to use a TextureMap Object on the face

How to use a TextureMap Object on the face

AlexShtol
Participant Participant
638 Views
5 Replies
Message 1 of 6

How to use a TextureMap Object on the face

AlexShtol
Participant
Participant

How to use a TextureMap Object on the face. There is no detailed information in Help API. 

 

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition
Set oCompDef = oDoc.ComponentDefinition
Dim oBody As SurfaceBody
Set oBody = oCompDef.SurfaceBodies.Item(1)
Dim oFace As Face

For i = 1 To oBody.Faces.Count
Set oFace = oBody.Faces.Item(i)

Next

Dim oTextureMap As TextureMap
Set oTextureMap = oFace.TextureMaps.Item(1)    /The program gives an error (Object variable not set (Error 91)

Object variable or With block variable not set)

 



0 Likes
Accepted solutions (1)
639 Views
5 Replies
Replies (5)
Message 2 of 6

t_hascj
Autodesk
Autodesk

Hi AlexShtol,

Are you sure that in TextureMaps is not null?

Try to add this code before.

If (oFace.TextureMaps Is Nothing)
	Dim oTextureMap As TextureMap
	Set oTextureMap = oFace.TextureMaps.Item(1)
End If



Thanks,
Jaroslav

0 Likes
Message 3 of 6

AlexShtol
Participant
Participant

Maybe I misunderstand what a Texture map is. For example, a detail that has faces with different textures. How to access the texture object.

question2.jpg

 

Thanks for the help

0 Likes
Message 4 of 6

t_hascj
Autodesk
Autodesk
Accepted solution

Hi AlexShtol,

How you applied the texture on faces?

1. By appearrance, then TextureMaps is null(nothing). You need to get Appearance of face, if you want information about texture. Look at http://help-staging.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-6C856740-04CF-4601-88FA-863C0A9604... how to get information about texture from Asset object.

2. By Decal feature, then TextureMaps return texture/s. Look at https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2014... how to add decal.

Thanks,
Jaroslav

Message 5 of 6

AlexShtol
Participant
Participant

Thank you very much. You helped me a lot.

0 Likes
Message 6 of 6

Maxim-CADman77
Advisor
Advisor

When somebody's answer leads your to a solution it is recommended to mark that answer as a solution (then others who are willing to help wouldn't spend time reading the no-actual threads)... 

The best bet is to share final (fixed) edition of the code.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes