Hallo Ingo,
danke für deine Antwort.
Die genannten Befehle habe ich mirschon näher angesehen, aber aus irgend einem Grund komme ich auf keinen grünen Zweig.
Denke mir fehlt noch irgend ein Object im Syntax oder Ähnliches!
Soweit bin ich bisher:
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swComp As SldWorks.Component2
Dim Part As Object
Dim c As String
Dim d As String
Dim TeilName As String
Dim retval As Boolean
Dim boolstatus As Boolean
Dim SelMgr As Object
Dim longstatus As Long, longwarnings As Long
Dim Skizzenpunkt As Boolean
Dim Normteil As Boolean
Dim BGname As String
Dim faces As Variant
Dim swMate As SldWorks.Mate2
'------------------------------------------------------------------------------
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
BGname = Part.GetTitle
c = StrReverse(BGname) ' dreht string um um und löscht Dateibezeichnung
d = Mid(c, InStr(c, ".") + 1)
BGname = StrReverse(d)
Set swSelMgr = Part.SelectionManager
For i = 1 To swSelMgr.GetSelectedObjectCount
If swSelMgr.GetSelectedObjectType(i) = swSelEXTSKETCHPOINTS _
Or swSelMgr.GetSelectedObjectType(i) = swSelVERTICES _
Or swSelMgr.GetSelectedObjectType(i) = swSelSKETCHPOINTS Then
Skizzenpunkt = True
k = i
Set swpunktcomp = swSelMgr.GetSelectedObjectsComponent3(k, 0)
Else
j = i
Set swcomp11 = swSelMgr.GetSelectedObjectsComponent3(j, 0)
TeilName = "Punkt1@Positionierskizze@" + swcomp11.Name + "@" + BGname
Normteil = True
End If
Next
swSelMgr.DeSelect (j) 'delselektiert das Normteil, damit nicht 3 Auswahlen existieren
If (Skizzenpunkt = False And Normteil = False) Then
MsgBox "Bitte einen Positionierpunkt auf dem Bauteil und ein Normteil wählen!"
End
End If
If i > 3 Then
MsgBox "Zu viele Auswahlen, bitte nur einen Punkt und ein Normteil auswählen!"
End
End If
'
'
' boolstatus = Part.Extension.SelectByID2(TeilName, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
'
' Set Feature = Part.AddMate2(0, -1, False, 0.02464807137666, 0, 0, 1, 1, 0.5235987755983, 0.5235987755983, 0.5235987755983, longstatus)
Part.ClearSelection2 True
retval = Part.EditRebuild3()
'----------------------------------------------------------------
Dim FeatureData As Object
Dim featureName As String
Dim subFeatureName As String
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
Set Feature = Part.FirstFeature
While Not Feature Is Nothing
featureName = Feature.Name ' Get the name of the feature
typ = Feature.GetType
If typ = 33 Then
GoTo 10
End If
Set Feature = Feature.GetNextFeature()
Wend
10
Set subfeat = Feature.GetFirstSubFeature
While Not subfeat Is Nothing
subFeatureName = subfeat.Name
Dim swMateEnt(2) As SldWorks.MateEntity2
boolstatus = Part.Extension.SelectByID2(subFeatureName, "MATEGROUPS", 0, 0, 0, True, 0, Nothing, 0)
Part.ActivateSelectedFeature
Set swMate = subfeat.GetSpecificFeature2
For i = 0 To 1
Set swMateEnt(i) = swMate.MateEntity(i)
Set swComp = swMateEnt(i).ReferenceComponent
'MsgBox swComp.Name2
If swComp.Name2 = swcomp11.Name Then
GoTo 11
End If
Next i
Set subfeat = subfeat.GetNextSubFeature
Wend
11
'????????????????????????????????????????????????????
'????????????????????????????????????????????????????
End Sub
Vielleicht hast du ja ne Idee,
Gruß Sebastian
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP