Create a LightingStyle with a light

By Augusto Goncalves

The sample code below show an example on how create a LightingStyle using VB.NET. The Light is a property of that style, also created and configured on the sample.

Public Sub addLightStyle()

 

  If m_inventorApplication.Documents.Count = 0 _

    Then Exit Sub

 

  If m_inventorApplication.ActiveDocument.DocumentType <> _

    DocumentTypeEnum.kPartDocumentObject Then _

    Exit Sub

 

  Dim pDoc As PartDocument = _

    m_inventorApplication.ActiveDocument

 

  Dim lStyle As LightingStyle

  lStyle = pDoc.LightingStyles.Add("Test_L_Style")

 

  Dim lite1 As Light = lStyle.Lights. _

    Add(LightTypeEnum.kViewSpaceLight)

 

  lite1.Color = m_inventorApplication. _

    TransientObjects.CreateColor(255, 0, 0)

  lite1.Intensity = 1

  lite1.On = True

  lite1.Position = m_inventorApplication. _

    TransientGeometry.CreatePoint(0, 0, 0)

End Sub


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading