SolidWorksMakroprogrammierung

Methode · Feature

GetMaterialPropertyValues2-Methode (Feature)

Liefert Farbe und Darstellungswerte eines Features in einer oder mehreren Konfigurationen.

Syntax

Function GetMaterialPropertyValues2( _
   ByVal Config_opt As Long, _
   ByVal Config_names As Variant _
) As Variant
vWerte = swFeat.GetMaterialPropertyValues2(swThisConfiguration, Empty)

Parameter

Config_optLongByVal
Für welche Konfigurationen, ein Wert aus swInConfigurationOpts_e, etwa swThisConfiguration (1) oder swAllConfiguration (2).
Config_namesVariantByVal
Nur bei swSpecifyConfiguration: ein Array mit Namen von Konfigurationen, sonst Empty.

Rückgabewert

Ein Array mit 9 Zahlen pro Konfiguration. Die Werte stehen in dieser Reihenfolge: R, G, B, Umgebung, Streuung, Glanz, Glanzgröße, Transparenz, Leuchten. Alle liegen zwischen 0 und 1.

Beispiel

' swFeat ist ein Feature, etwa aus SelectionMgr.GetSelectedObject6 oder ModelDoc2.FirstFeature.
Dim vWerte As Variant
vWerte = swFeat.GetMaterialPropertyValues2(swThisConfiguration, Empty)
If vWerte(0) = -1 Then
    Debug.Print "Keine eigene Farbe"
Else
    Debug.Print "RGB " & vWerte(0) * 255 & ", " & vWerte(1) * 255 & ", " & vWerte(2) * 255
End If

Bemerkungen

-1 bedeutet, dass der Wert für das Feature nicht gesetzt ist. Bei swThisConfiguration und swAllConfiguration wird Config_names ignoriert.

Siehe auch

Verfügbarkeit

SOLIDWORKS 2004

Englisches Original: IFeature::GetMaterialPropertyValues2 in der SOLIDWORKS API-Hilfe ↗ (dort mit dem .NET-Namen)

Fragen zu diesem Befehl oder ein Befehl fehlt? Frag im Discord.