Hallo Sylvio.
ich hoffe, daß Dir folgende Zeilen helfen.
Gruß
Marco
Klassenmodul "clsPick" mit folgendem Code erstellen
'--------------------------------------------------------------------
' Declare the event objects
Private WithEvents oInteractEvents As InteractionEvents
Private WithEvents oMouseEvents As MouseEvents
Private bStillSelecting As Boolean
Private PickPkt As Point
Public Function Pick() As Point
bStillSelecting = True
' Create an InteractionEvents object.
Set oInteractEvents = ThisApplication.CommandManager.CreateInteractionEvents
Set oMouseEvents = oInteractEvents.MouseEvents
' Start the InteractionEvents object.
oInteractEvents.Start
' Loop until a selection is made.
Do While bStillSelecting
DoEvents
Loop
' Stop the InteractionEvents object.
oInteractEvents.Stop
Set Pick = PickPkt
' Clean up.
Set oInteractEvents = Nothing
Set oMouseEvents = Nothing
End Function
Private Sub oMouseEvents_OnMouseClick(ByVal Button As Inventor.MouseButtonEnum, ByVal ShiftKeys As Inventor.ShiftStateEnum, ByVal ModelPosition As Inventor.Point, ByVal ViewPosition As Inventor.Point2d, ByVal View As Inventor.View)
Set PickPkt = ModelPosition
bStillSelecting = False
End Sub
'---------------------------------------------------------------------
Folgendes Programm fügt das erste skizzierte Symbol ein.
Sub Aufkleber()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSketchedSymbolDef As SketchedSymbolDefinition
Dim oSketch As DrawingSketch
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oActiveSheet As Sheet
Set oActiveSheet = oDrawDoc.ActiveSheet
Dim oPick As New clsPick
Dim oPickPoint As Inventor.Point
Set oPickPoint = oPick.Pick
Set oSketchedSymbol = oSheet.SketchedSymbols.Add(oDrawDoc.SketchedSymbolDefinitions.Item(1), oTG.CreatePoint2d(oPickPoint.x, oPickPoint.y))
End Sub
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP