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: 

GetRenderStyle

1 REPLY 1
Reply
Message 1 of 2
Anonymous
573 Views, 1 Reply

GetRenderStyle

Anonymous
Not applicable
Hi

I am trying to develop some code to read the current feature face render style, and change the face render style if required. I have managed to get the SetRenderStyle method to work, but cannot get the GetRenderStyle to work. Attached is my code, What do I need to add to read the current RenderStyle?

Sub Faces()
Dim oPartDoc As Inventor.PartDocument
Dim newRS As RenderStyle
Dim oldRS As RenderStyle

Set oPartDoc = ThisApplication.ActiveDocument
Set newRS = oPartDoc.RenderStyles.Item("Gray")

Dim oFeature As Object
Dim oFace As Inventor.Face

For Each oFeature In oPartDoc.ComponentDefinition.Features

If oFeature.Name = "MyFeature" Then

For Each oFace In oFeature.Faces
Call oFace.SetRenderStyle(kOverrideRenderStyle, newRS)
Next oFace

End If

Next oFeature

End Sub
0 Likes

GetRenderStyle

Hi

I am trying to develop some code to read the current feature face render style, and change the face render style if required. I have managed to get the SetRenderStyle method to work, but cannot get the GetRenderStyle to work. Attached is my code, What do I need to add to read the current RenderStyle?

Sub Faces()
Dim oPartDoc As Inventor.PartDocument
Dim newRS As RenderStyle
Dim oldRS As RenderStyle

Set oPartDoc = ThisApplication.ActiveDocument
Set newRS = oPartDoc.RenderStyles.Item("Gray")

Dim oFeature As Object
Dim oFace As Inventor.Face

For Each oFeature In oPartDoc.ComponentDefinition.Features

If oFeature.Name = "MyFeature" Then

For Each oFace In oFeature.Faces
Call oFace.SetRenderStyle(kOverrideRenderStyle, newRS)
Next oFace

End If

Next oFeature

End Sub
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Relplying to own topic.

Solved it. Solution for reference:

Sub Faces()
Dim oPartDoc As Inventor.PartDocument
Dim newRS As RenderStyle
Dim oldRS As RenderStyle

Set oPartDoc = ThisApplication.ActiveDocument
Set newRS = oPartDoc.RenderStyles.Item("Copper (New/Polished)")

Dim oFeature As Object
Dim oFace As Inventor.Face

For Each oFeature In oPartDoc.ComponentDefinition.Features

If oFeature.Name = "VP1" Then

For Each oFace In oFeature.Faces
Set oldRS = oFace.GetRenderStyle(kOverrideRenderStyle)
If oldRS.Name = "Gray" Then
Call oFace.SetRenderStyle(kOverrideRenderStyle, newRS)
End If
Next oFace

End If

Next oFeature

End Sub

Relplying to own topic.

Solved it. Solution for reference:

Sub Faces()
Dim oPartDoc As Inventor.PartDocument
Dim newRS As RenderStyle
Dim oldRS As RenderStyle

Set oPartDoc = ThisApplication.ActiveDocument
Set newRS = oPartDoc.RenderStyles.Item("Copper (New/Polished)")

Dim oFeature As Object
Dim oFace As Inventor.Face

For Each oFeature In oPartDoc.ComponentDefinition.Features

If oFeature.Name = "VP1" Then

For Each oFace In oFeature.Faces
Set oldRS = oFace.GetRenderStyle(kOverrideRenderStyle)
If oldRS.Name = "Gray" Then
Call oFace.SetRenderStyle(kOverrideRenderStyle, newRS)
End If
Next oFace

End If

Next oFeature

End Sub

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

Post to forums  

Autodesk Design & Make Report