How to use DPF in WB Project Page Scripting Console?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 442
250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
✭✭✭✭
edited April 17 in Structures

How to use DPF in WB Project Page Scripting Console?

Comments

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 442
    250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
    ✭✭✭✭
    edited April 17

    You need to import all the relevant libraries for DPF. Below is an example code (tested with 2024R1)

    import clr
    import os
    import sys
    import Ansys
    
    def DPFAddReference(reference_name):
        try:
            clr.AddReference(reference_name);
            return
        except:
            print(reference_name + " reflection was not generated.")
    
    def importPlugins():
    
        DPFAddReference("Ans.Utilities")
        DPFAddReference("CS_DataProcessing")
    
        from Ans.DataProcessing import DataProcessingCore
        from Ans.DataProcessing.load import GeneratePluginDll
        DataProcessingCore.Initialization()
    
        DPFAddReference("Ans_Dpf_Native_dll_cs")
        DPFAddReference("Ans_Dpf_FEMutils_dll_cs")
        DPFAddReference("meshOperatorsCore_dll_cs")
        DPFAddReference("mapdlOperatorsCore_dll_cs")
        DPFAddReference("Ans_Dpf_Math_dll_cs")
        DPFAddReference("Ans_Dpf_Hdf5_dll_cs")
        DPFAddReference("Ans_Dpf_PointCloudSearch_dll_cs")
        DPFAddReference("Ans_Dpf_Mechanical_dll_cs")
        DPFAddReference("Ans_Dpf_MechanicalResults_dll_cs")
    
    importPlugins()
    
    import Ans.DataProcessing as dpf
    rst_path = r"\Path\to\file.rst"
    model = dpf.Model(rst_path)
    print(model.ResultInfo.AnalysisType)