Hallo,
ich kann bisher den Fehler in meinem Code nicht erkennen. Hat jemand eine Idee, was hier fehlt?
Ich bekomme den Fehler "Laufzeitfehler 445 - Objekt unterstützt diese Aktion nicht" in folgender Zeile:
Set oLights = oRootProduct.GetItem("CATRscRenderingLightVBExt")
Hier ist der Code, eigentlich ein use case:
' Main
Sub CATMain()
' Get the documents collection
Dim oCollection As Documents
Set oCollection = CATIA.Documents
' test if no document is open
If 0=oCollection.Count Then
msgbox "A product document must be active to execute this macro.", vbOKOnly, "Switch Off Lights"
Exit Sub
End If
' Get material library
Dim oProductDocument As Document
Set oProductDocument = CATIA.ActiveDocument
' test if the active document is a product
If 0=InStr(oProductDocument.Name, ".CATProduct") Then
msgbox "A product document must be active to execute this macro.", vbOKOnly, "Switch Off Lights"
Exit Sub
End If
' Accessing the Root Product
Dim oRootProduct As Product
Set oRootProduct = oProductDocument.Product
' Accessing the collection of rendering lights
Dim oLights As RenderingLights
Set oLights = oRootProduct.GetItem("CATRscRenderingLightVBExt")
' Declarations
Dim I As Int
Dim oLight As RenderingLight
' Ligths loop
For I=1 To oLights.Count
Set oLight = oLights.Item(I)
oLight.ActiveStatus = 0
Next
End Sub
Vielen Dank
Mike
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP