Moldflow Insight Forum
Welcome to Autodesk’s Moldflow Insight Forums. Share your knowledge, ask questions, and explore popular Moldflow Insight topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get Node XYZ Position with Pressure

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
gochoats01
1165 Views, 4 Replies

Get Node XYZ Position with Pressure

Hello,

 

I'm trying to obtain a script that can generate a txt file that contains node xyz position and the node pressure in a certain time step.

 

I already have a VBScript that can generate a node XYZ positions file but i need to add the column that contains node pressure in a certain time step. Can anyone help me or give me a hint about how to add the code to generate that info?

 

This is the code in the file that i have

 

'%RunPerInstance
'@
'@ DESCRIPTION
'@ Extract all Nodal Coordinates to a comma separated text file
'@
'@
'@ SYNTAX
'@ WriteNodalData
'@
'@ PARAMETERS
'@ none
'@
'@ DEPENDENCIES/LIMITATIONS
'@
'@
'@ History
'@ Created DRA 9/8/2006
'@@
Option Explicit
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"

 

Dim StudyDoc, App
Dim FS, TemporaryFolder, TempFolder, Name, lFile
Dim Str, Node, NodeNumber, Coord

 

Set StudyDoc = Synergy.StudyDoc()

 

'Open a File in the users temporary Directory
Set FS = CreateObject("Scripting.FileSystemObject")
TemporaryFolder = 2
Set TempFolder = FS.GetSpecialFolder(TemporaryFolder)
Name = "data.txt"
Set lFile = TempFolder.CreateTextFile(Name, True)

 

' Write File Header
Str = "Node" & "," & "X" & "," & "Y" & "," & "Z" & vbCrLf
lFile.Write Str

 

' Loop through all nodal
Set Node = StudyDoc.GetFirstNode()
While Not Node Is Nothing
NodeNumber = StudyDoc.GetEntityID(Node)
Set Coord = StudyDoc.GetNodeCoord(Node)
Str = NodeNumber & "," & Coord.X & "," & Coord.Y & "," & Coord.Z & vbCRLF
lFile.Write Str
Set Node = StudyDoc.GetNextNode(Node)


Wend

' Close File
lFile.Close

' Notify user where the file is located
MsgBox "Nodal Data Recorded In File" & vbCRLF & TempFolder.Path & "\" & Name

' Open the File in Notepad
Set App = WScript.CreateObject("WScript.Shell")
Dim Command
Command = "notepad.exe " & TempFolder.Path & "\" & Name
App.Run Command

MsgBox "Script Complete"
Wscript.Quit

 

Thank you

-Gerardo

Tags (2)
4 REPLIES 4
Message 2 of 5

 HI @gochoats01,

 

Thanks for sharing your macro and posting your question.

 

There are different ways to achive what you are looking for. The easiest way would be, now that you have the node ID and coordiantes, to export the pressure and to match both results. For doing that, you can export to a Patran file the results of the pressure (Results > Export and Publish > Patran). Moldflow will create a .nod file for each time-step, so you only need to merge the time step you need and the node-coordinate file.

 

Another way would be to use an API command. Here there are two options:

 

  • The first possibility is that you automate this process with the command “SaveResultDataInPatran”. An example is given in the Synergy API Help. (Pressure has Result ID 1180).
  • The second way, and the most complicated, is to access the result dataset using the "GetScalarData" function. (Details of using this can be found in the Synergy API Help).  The Independent Variable specifies which intermediate result you want.

I hope it helps!

 

Cheers,

Javier


______________________________________________________________

If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!


Javier Jubierre
Message 3 of 5

Hi @gochoats01,

 

Thanks for posting in our Insight forum!

 

Did my answer to your post solved your problem? If yes, please accept my reply as solution. If not, let me know and we could go deeper in this topic.

 

Cheers,

Javier 


______________________________________________________________

If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!


Javier Jubierre
Message 4 of 5

Hello Javier,

 

Sorry about my late response, what you described above was ver useful to get this done.

 

Thank you!

-Gerardo

Message 5 of 5

Hello everyone,
I'm with same problem. I tried GetScalarData obtied pressure for node, but can't.
@Javier.Jubierre  you can help me?

 
 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report