AnsweredAssumed Answered

Simulation data probe macro

Question asked by George K. on Jan 12, 2015
Latest reply on Dec 22, 2015 by Michael Nebel

EDIT: I have moved this from Simulation to API and have added some detail to the post so it is clearer what I'm trying to do.

 

I am trying to make a macro that will probe a face (defined by a split line, so as to make it a distinct controlled area that I can probe all of the element) for the first, second and third principal stresses as well as the strain energy density. I attempted to simply record the macro but it didn't pick up on what I was doing. All I was attempting to do was once I had run the simulation record macro that would select a result plot, second button click on the plot, go through probe (or "list selected", as that is what I was effectively selecting in the probe option anyway) and save a csv for the face I am interested in, then move onto the next result plot and repeat until I had exported the data for the plots I have mentioned. When I attempted to record this it gave me a macro with only a few lines of code which I think only recognised me clicking on the face, not the probing of the faces and the exporting of csv files.

 

Sub main()

 

 

Set swApp = _

Application.SldWorks

 

 

Set Part = swApp.ActiveDoc

boolstatus = Part.Extension.SelectByID2("", "FACE", 2.36469774600323E-03, 8.58908409014703E-03, 1.00000999998429E-02, True, 0, Nothing, 0)

Part.ClearSelection2 True

Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2("", "FACE", 2.73839242295537E-03, 8.61402378137655E-03, 0.010000099999786, True, 0, Nothing, 0)

Part.ClearSelection2 True

Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2("", "FACE", 2.4164657299508E-03, 8.52676618163173E-03, 1.00000999999565E-02, True, 0, Nothing, 0)

Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2("", "FACE", 0.002399477940358, 8.61948923898126E-03, 1.00000999998429E-02, True, 0, Nothing, 0)

Part.ClearSelection2 True

End Sub

 

 

Is it possible to record a macro to do this task, or do I need more advanced programming skills to do this?

 

Thanks.

Outcomes