SolidWorksMakroprogrammierung

Enumeration · SwConst

swSlotMateConstraintOptions_e-Enumeration

Wo eine Nutverknüpfung die Komponente in der Nut hält: frei beweglich, mittig, in festem Abstand oder in Prozent der Nutlänge.

Bibliothek SwConst · 4 Werte · im Code direkt mit Namen verwendbar, zum Beispiel swSlotMateConstraintOption_Free

Syntax

Enum swSlotMateConstraintOptions_e
    swSlotMateConstraintOption_Free     = 0
    swSlotMateConstraintOption_Centered = 1
    swSlotMateConstraintOption_Distance = 2
    swSlotMateConstraintOption_Percent  = 3
End Enum

Werte

KonstanteWertBedeutung
swSlotMateConstraintOption_Free0Frei. Die Komponente kann sich in der Nut frei bewegen.
swSlotMateConstraintOption_Centered1Mittig. Die Komponente sitzt in der Mitte der Nut.
swSlotMateConstraintOption_Distance2Abstand. Die Achse der Komponente liegt in einem festen Abstand vom Ende der Nut, angegeben in SlotMateFeatureData.Distance.
swSlotMateConstraintOption_Percent3Prozent. Die Achse der Komponente liegt in einem Abstand vom Ende der Nut, angegeben als Anteil der Nutlänge in SlotMateFeatureData.Percent.

Beispiel

' swModel ist die aktive Baugruppe, swFeat eine Nutverknüpfung (Feature).
Dim swSlot As SldWorks.SlotMateFeatureData
Set swSlot = swFeat.GetDefinition
swSlot.Constraint = swSlotMateConstraintOption_Distance
swSlot.Distance = 0.015   ' 15 mm vom Ende der Nut
If False = swFeat.ModifyDefinition(swSlot, swModel, Nothing) Then
    Debug.Print "Verknüpfung nicht geändert"
End If

Bemerkungen

Den Wert setzt und liest du mit SlotMateFeatureData.Constraint. SlotMateFeatureData.Distance gilt nur bei swSlotMateConstraintOption_Distance, SlotMateFeatureData.Percent nur bei swSlotMateConstraintOption_Percent. Von welchem Ende der Nut aus gemessen wird, drehst du mit SlotMateFeatureData.FlipDirection um.

Verknüpft die Nutverknüpfung zwei Nuten miteinander, sind nur swSlotMateConstraintOption_Free und swSlotMateConstraintOption_Centered erlaubt. Eine neue Nutverknüpfung legst du mit AssemblyDoc.CreateMateData und swMateSLOT aus swMateType_e an.

Verwendet von

Siehe auch

Englisches Original: swSlotMateConstraintOptions_e in der SOLIDWORKS API-Hilfe ↗

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