SolidWorksMakroprogrammierung

Methode · Surface

AddTrimmingLoop2-Methode (Surface)

Fügt einer neuen Surface eine Begrenzungsschleife aus UV-Kurven hinzu, um daraus eine begrenzte Fläche zu machen.

Syntax

Function AddTrimmingLoop2( _
   ByVal NCrvs As Long, _
   ByVal VOrder As Variant, _
   ByVal VDim As Variant, _
   ByVal VPeriodic As Variant, _
   ByVal VNumKnots As Variant, _
   ByVal VNumCtrlPoints As Variant, _
   ByVal VKnots As Variant, _
   ByVal VCtrlPointDbls As Variant, _
   ByVal UvRange As Variant _
) As Boolean
bErfolg = swSurf.AddTrimmingLoop2(4, nOrdnung, nDim, nPeriodisch, nKnoten, nPunkte, dKnoten, dPunkte, dBereich)

Parameter

NCrvsLongByVal
Anzahl der Kurven der Schleife. So viele Einträge haben auch die nächsten fünf Arrays.
VOrderVariantByVal
Long-Array: Ordnung jeder Kurve, mindestens 2 (2 ist eine Gerade).
VDimVariantByVal

Long-Array: Dimension der Kontrollpunkte jeder Kurve.

  • 2: U, V
  • 3: U, V und Gewicht
  • Ist der erste Wert negativ (-2, -3), erwartet der Befehl 3D-Kurven mit X, Y, Z (und Gewicht).
VPeriodicVariantByVal
Long-Array: 1 für periodisch, 0 für nicht periodisch.
VNumKnotsVariantByVal
Long-Array: Anzahl der Knoten jeder Kurve. Bei nicht periodischen Kurven Kontrollpunkte plus Ordnung.
VNumCtrlPointsVariantByVal
Long-Array: Anzahl der Kontrollpunkte jeder Kurve, mindestens so viele wie die Ordnung.
VKnotsVariantByVal
Double-Array mit den Knoten aller Kurven hintereinander.
VCtrlPointDblsVariantByVal
Double-Array mit den Koordinaten aller Kontrollpunkte hintereinander.
UvRangeVariantByVal
Double-Array: U von, U bis, V von, V bis.

Rückgabewert

True, wenn die Schleife hinzugefügt wurde, sonst False.

Beispiel

' swBody ist ein neuer temporärer Körper, etwa aus PartDoc.CreateNewBody.
Dim swSurf As SldWorks.Surface
Dim dUrsprung(2) As Double, dNormale(2) As Double
Dim nOrd(3) As Long, nDim(3) As Long, nPer(3) As Long, nKn(3) As Long, nPkt(3) As Long
Dim dKn(15) As Double, dPkt(15) As Double, dBereich(3) As Double
Dim vEcken As Variant
Dim i As Long
dNormale(2) = 1
Set swSurf = swBody.CreatePlanarSurface(dUrsprung, dNormale)
For i = 0 To 3
    nOrd(i) = 2: nDim(i) = 2: nPer(i) = 0: nKn(i) = 4: nPkt(i) = 2
    dKn(4 * i) = 0: dKn(4 * i + 1) = 0: dKn(4 * i + 2) = 1: dKn(4 * i + 3) = 1
Next i
' Ecken als U, V: (0,0) → (1,0) → (1,1) → (0,1) → (0,0), je Kurve Anfang und Ende
vEcken = Array(0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0)
For i = 0 To 15
    dPkt(i) = vEcken(i)
Next i
dBereich(1) = 1: dBereich(3) = 1
If swSurf.AddTrimmingLoop2(4, nOrd, nDim, nPer, nKn, nPkt, dKn, dPkt, dBereich) Then
    swBody.CreateTrimmedSurface
End If

Bemerkungen

Die Surface entsteht vorher mit Body2.CreatePlanarSurface oder Body2.CreateRevolutionSurface. Danach machst du aus Surface und Schleifen mit Body2.CreateTrimmedSurface eine begrenzte Fläche und aus mehreren solchen Flächen mit Body2.CreateBodyFromSurfaces einen Körper. Die Hilfe empfiehlt ausdrücklich, sich vorher mit B-Splines, Knoten und ihrer Vielfachheit zu beschäftigen. Ohne UV-Bereich gibst du Nothing in den Einträgen von UvRange an.

Siehe auch

Verfügbarkeit

SOLIDWORKS 2001Plus

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

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