I'm working on a macro to automate the output of my wanted result files. I made an Input box where the user put in the Node ID and the path of the result file. I've tried to place the variables at the wanted positions in the script, but Moldflow ignores the input.
Here is the problematic part of my macro:
Does anybody know how i can solve the problem with those two variables?
UserInput = Inputbox("Call node:") Pfad = Inputbox ("Where do you want to place the resultfile? (z.B.: c:\...\):") SetLocale("en-us") Set Synergy = CreateObject("synergy.Synergy") Synergy.SetUnits "Metric" Set StudyDoc = Synergy.StudyDoc() Set EntList = StudyDoc.CreateEntityList() '* create an empty entity list Set PlotManager = Synergy.PlotManager() Set Plot = PlotManager.CreatePlotByDsID(1180, True) Plot.SetXYPlotShowLegend True Set Viewer = Synergy.Viewer() Set Plot = Viewer.ActivePlot() Set PlotManager = Synergy.PlotManager() Set Plot = PlotManager.FindPlotByName2("Pressure:XY Plot", "Pressure") Set Viewer = Synergy.Viewer() EntList.SelectFromString ("& UserInput &") '* popoulate the entity list Plot.AddXYPlotCurve(EntList) '* plot the curve of entity Viewer.ShowPlot Plot Plot.SaveXYPlotCurveData ("& Pfad")
EntList.SelectFromString ("& UserInput") 'First problem line
Plot.SaveXYPlotCurveData ("& Pfad") 'second problem line
My next problem is that this code just works for pressure on this way. If I want to use the macro for fiber orientation I have to open the wanted result before runnung the macro:
setLocale("en-US") Set Synergy = CreateObject("synergy.Synergy") Synergy.SetUnits "Metric" Set PlotManager = Synergy.PlotManager() Set Viewer = Synergy.Viewer() Set probePlot = Viewer.ActivePlot() Set VectorA = Synergy.CreateVector() Set VectorB = Synergy.CreateVector() VectorA.SetXYZ -4.34, 0, -9.6 'ERSTE VEKTORKOORDINATE (Startpunkt)' VectorB.SetXYZ -4.34, 3, -9.6 'ZWEITE VEKTORKOORDINATE (Endpunkt)' probePlot.AddProbePlotProbeLine VectorA, VectorB' probePlot.SaveXYPlotCurveData "& Pfad" ' probePlot.Regenerate
my first problem, I solved on myself. My fault was a wrong input
EntList.SelectFromString ("& UserInput &") and this is the correct way: EntList.SelectFromString (""& UserInput )
But if someone has an idea for my second problem, it would be very nice if you post it :-)