Help please - vbs scripts

Help please - vbs scripts

oak
Participant Participant
1,633 Views
5 Replies
Message 1 of 6

Help please - vbs scripts

oak
Participant
Participant

Hi


I am trying to write a script - to write out some of the input and output paramaers from analysis - but I do not want to extract them from a log file -  I want Moldflow vbs to write out a text file (or dipslay on screen) the values that I am looking for.  I am trying to do this based on T CODES. can someone please help me and show me how to do this - using three things as an example :
1) Aggregate cooling option in cooling analysis (10000 Thermoplastics injection molding solver parameters (Midplane))

2) The tme at which a particular anlaysis started and ended

3) The version of software that was used.

 

Any help would be greatly appreciated.

 

Thanks

0 Likes
Accepted solutions (1)
1,634 Views
5 Replies
Replies (5)
Message 2 of 6

bernor_mf
Advisor
Advisor

Hi,

regarding:
3) The version of software that was used.

 

'%RunPerInstance
'@ DESCRIPTION
SetLocale("en-us")
Dim SynergyGetter, Synergy
On Error Resume Next
Set SynergyGetter = GetObject(CreateObject("WScript.Shell").ExpandEnvironmentStrings("%SAInstance%"))
On Error GoTo 0
If (Not IsEmpty(SynergyGetter)) Then
	Set Synergy = SynergyGetter.GetSASynergy
Else
	Set Synergy = CreateObject("synergy.Synergy")
End If
Synergy.SetUnits "Metric"
SynVersion = Synergy.Version()
SynBuild = Synergy.Build()
MsgBox  " Version: " & SynVersion & " Build: " & SynBuild,,"Information"

Now, this will be for Synergy. For Insight solver, I could not find object.

 

For solver, you probably need to read analysis log file.

You can save log file in text format, for easier search.

Where is Analysis Log saved to be used by Moldflow API

2) The time at which a particular anlaysis started and ended

> Easiest to get from analysis log file, I think.

Else, you need to work with Job Manager object, and review analysis jobs and store start and end time.

This is already in analysis log...

 

Adding this article from the AKN (Autodesk Knowledege Network) as reference:

How to find Moldflow API documentation and reference

Hope this helps.

Regards,

Berndt

( If my comments are accepted, provide "Kudos" as appreciation. If your request is answered/resolved, please click the "Accept as Solution" button. Thanks.)
0 Likes
Message 3 of 6

oak
Participant
Participant

Thank you very much for responding - but the issue is that I don't want to use the log file, because some of the thinsg that Iwant to inquire on - are not included in the log file - for example - if I want to know what mold temp conv criterion was used for cool, or howhat was the max number of temperature iterations (limit) in fill etc - these parameter  values ar  not included in the log file - but they are stored nevertheless with the study file.

 

I can write macros to assign values tto these parameters - but what I cannot figure out is how to inquire on - what values were used (macros to print currnet value - not assign new one) - any help / pointers would be appreciated.

 

Thanks

0 Likes
Message 4 of 6

bernor_mf
Advisor
Advisor
Accepted solution

Hi,

I created an example how to get data:

 

SetLocale("en-us")
Set Synergy = CreateObject("synergy.Synergy")
Synergy.SetUnits "METRIC"

Set PropED = Synergy.PropertyEditor()
' 10000 Thermoplastics injection molding solver parameters (Midplane)
Set Prop = PropED.FindProperty(10000, 1)

TcodeID = 539 ' 539 Use aggregated mesh solver
'Data type boolean as integer, which means = 0 not used, 1 used

Set DVec = Prop.FieldValues(TcodeID)
If DVec.Val(0) = 1 Then
	Text = DVec.Val(0) & " Use aggregated mesh solver "
Else
	Text = DVec.Val(0) & " Use aggregated mesh solver : is off "
End If

MsgBox "TcodeID: " & TcodeID & " = " & DVec.Val(0) & vbCrlf & Text ,,"Information" 

Hope this helps.

Happy coding! Smiley Happy

Regards,

Berndt

( If my comments are accepted, provide "Kudos" as appreciation. If your request is answered/resolved, please click the "Accept as Solution" button. Thanks.)
0 Likes
Message 5 of 6

oak
Participant
Participant

Thank you thank you thank you!!!

0 Likes
Message 6 of 6

Anonymous
Not applicable

Hi,

 

I tried the solution for Synergy 2016 but I am getting an error. I am new to MF scripting. Can you point out anything that I could be doing wrong?

 

Option Explicit
SetLocale("en-us")
Dim Synergy
Set Synergy = CreateObject("synergy.Synergy")
Synergy.SetUnits "METRIC"
Dim Prop, DVec, TcodeID, PropED, Text
Set PropED = Synergy.PropertyEditor()
' 10000 Thermoplastics injection molding solver parameters (Midplane)
Set Prop = PropED.FindProperty(10000, 1)

TcodeID = 539 ' 539 Use aggregated mesh solver
'Data type boolean as integer, which means = 0 not used, 1 used

Set DVec = Prop.FieldValues(TcodeID)
If DVec.Val(0) = 1 Then
Text = DVec.Val(0) & " Use aggregated mesh solver "
Else
Text = DVec.Val(0) & " Use aggregated mesh solver : is off "
End If

MsgBox "TcodeID: " & TcodeID & " = " & DVec.Val(0) & vbCrlf & Text ,,"Information"

0 Likes