cancel
Showing results for 
Search instead for 
Did you mean: 

PhysicalPropertyTableCollection - Which "part" to use?

Phenom
Phenom

To all

 

Could any one advise me which "part" (CAE or FEM or something else!) one should use when dealing with PhysicalPropertyTableCollection. Doc states CAEPart but I cannot make it work

 

I'd like to loop NX.CAE Physical properties. See test code below

Any ideas/suggestions?

 

Thanks
Regards

 

Dim theFEMPart As CAE.FemPart = CType(theSession.Parts.BaseWork, CAE.FemPart)
Dim physicalPropTableCollec As CAE.PhysicalPropertyTableCollection = theFEMPart.PhysicalPropertyTableCollection

Dim Listofproperties As CAE.PhysicalPropertyTable = physicalPropTableCollec.ToArray

Dim sthepropname As String
Dim itheproplabel As Integer
	
For Each proptable As CAE.PhysicalPropertyTable In Listofproperties
 sthepropname = proptable.Name
 itheproplabel = proptable.Label	
	
 theLw.WriteLine("Name is: " & sthepropname)
 theLw.WriteLine("Label is: " & itheproplabel.ToString)
Next
Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)
5 REPLIES

Re: PhysicalPropertyTableCollection - Which "part" to use?

Siemens Phenom Siemens Phenom
Siemens Phenom

CaePart is the base class for FemPart, SimPart and AssyFemPart. If you code is written to use the CaePart if possible, it should execute if the work part is any type (fem/sim/afm)

 

Two errors in your code:

  1. You had a typo getting the physical property table collection. The class is '

    PhysicalPropertyTableCollection', but the method to get them is 'PhysicalPropertyTables', not 'PhysicalPropertyTableCollection'

  2. You did not instantiate 'Listofproperties' as an array.

 

The following will work:

 

        'Dim theFEMPart As CAE.FemPart = CType(theSession.Parts.BaseWork, CAE.FemPart)
        Dim theCaePart As CAE.CaePart = CType(theSession.Parts.BaseWork, CAE.CaePart)

        'Dim physicalPropTableCollec As CAE.PhysicalPropertyTableCollection = theFEMPart.PhysicalPropertyTableCollection
        Dim physicalPropTableCollec As CAE.PhysicalPropertyTableCollection = theCaePart.PhysicalPropertyTables

        'Dim Listofproperties As CAE.PhysicalPropertyTable = physicalPropTableCollec.ToArray
        Dim Listofproperties() As CAE.PhysicalPropertyTable = physicalPropTableCollec.ToArray

        Dim sthepropname As String
        Dim itheproplabel As Integer

        For Each proptable As CAE.PhysicalPropertyTable In Listofproperties
            sthepropname = proptable.Name
            itheproplabel = proptable.Label

            theLw.WriteLine("Name is: " & sthepropname)
            theLw.WriteLine("Label is: " & itheproplabel.ToString)
        Next

 

or, more tersely:

 

        Dim theCaePart As CAE.CaePart = CType(theSession.Parts.BaseWork, CAE.CaePart)

        For Each proptable As CAE.PhysicalPropertyTable In theCaePart.PhysicalPropertyTables
            theLw.WriteLine("Name is: " & proptable.Name)
            theLw.WriteLine("Label is: " & proptable.Label.ToString)
        Next

Re: PhysicalPropertyTableCollection - Which "part" to use?

Phenom
Phenom

Thanks for that JimB. Much appreciated. First hurdle overcome.

 

Does one need to create a CAE.PropertyTable  to access the (element) thickness of the 2D shell property being access? (the program only deals with 2D properties) I need to add check of the thickness against another (user) input

 

Thanks

Regards

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: PhysicalPropertyTableCollection - Which "part" to use?

Phenom
Phenom

Following seems to do the job 

 

Dim physicalPropTableCollec As CAE.PhysicalPropertyTableCollection = theCAEPart.PhysicalPropertyTables

Dim Listofproperties() As CAE.PhysicalPropertyTable = physicalPropTableCollec.ToArray

For Each thephysicalproptable As CAE.PhysicalPropertyTable In Listofproperties
	Dim proptable As CAE.PropertyTable = thephysicalproptable.PropertyTable

             Dim dThickValueProp As Double = proptable.GetDoublePropertyValue ("element thickness")

Next

 

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: PhysicalPropertyTableCollection - Which "part" to use?

Siemens Phenom Siemens Phenom
Siemens Phenom

This only works if the thickness actually comes from the property table. Shell thickness can be defined in multiple places (physical property, midsurface, mesh associated data, element associated data, laminate definition, etc.)

 

The best way to query an element thickness is to use NXOpen.CAE.ThicknessBuilder.GetElementThickness()

Re: PhysicalPropertyTableCollection - Which "part" to use?

Phenom
Phenom

Thanks JimB for the reminder. The simple code I have written  only consider thickness from the property table

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)