VBA SolidsToSimulation

‚VBA Makro um Gruppierte Solids in die Simulation zu übernehmen

Sub SolidsToSimulation()

 Dim I As Long, SS As Esprit.SimulationSolid, G As Esprit.GraphicObject
   
   With Document.Group
       For I = 1 To .Count
           If IsGraphicObject(.Item(I), G) Then
               If G.GraphicObjectType = espSolidModel Then
                   Set SS = Document.Simulation.AddSolidModel("SimSolid", espSimSolidTypeStock, .Item(I))
                   SS.Color = vbBlue
                   SS.Tolerance = 0.1
               End If
           End If
       Next
   End With
   
   Set G = Nothing
   Set SS = Nothing
   
   Document.Refresh

End Sub

Function IsGraphicObject(ByRef InputObject As Object, ByRef ReturnGraphicObject As Esprit.GraphicObject) As Boolean

Set ReturnGraphicObject = Nothing
   On Error Resume Next
   Set ReturnGraphicObject = InputObject
   IsGraphicObject = Not (ReturnGraphicObject Is Nothing)

End Function

Schreibe einen Kommentar