MaterialPackage Functions

The material package allows you to work with material data using knowledge functions. You can retrieve a core or a covering material that is applied to a support, apply a core or covering material to a support, or remove the application of a material.

This page discusses:

GetMaterialCore

The GetMaterialCore function allows you to retrieve a core material applied to a support (3D shape).

Core materials applied to finite element model properties and to simulation connection properties of an engineering connection cannot be retrieved.

Signature

GetMaterialCore(Context : VPMReference, Path : String,
MatParam : CATMatReference, MatCnx : CATMatConnection) : Boolean

Arguments

Name Input / Output Required? Type Comment
Context In Yes VPMReference Reference in which the material is applied.
Path In Yes String Path that identifies the support to which the material is applied. You can use the CreatePathString method to retrieve the path of the support.
MatParam Out Yes CATMatReference Core material that is applied to the support.
MatCnx Out Yes CATMatConnection Applied material (connection that models the material application).

ReturnType

Boolean

Example

/* Retrieve the core material of a VPMReference
in this case, the support is the context, hence path="" */

let Context(VPMReference)
let Path(String)
let Material(CATMatReference)
let AppliedMaterial(CATMatConnection)
let returnCode(Boolean)

Path=""
returnCode = GetMaterialCore(Context,Path,Material,AppliedMaterial)

Message(Material.GetAttributeString("PLM_ExternalID"))

GetMaterialCovering

The GetMaterialCovering function allows you to retrieve a covering material applied to a support. The support can be a 3D shape, a representation instance, or a feature of a representation.

Signature

GetMaterialCovering(Context : VPMReference, Path : String,
ListMat : List, ListCnx : List) : Boolean

Arguments

Name Input / Output Required? Type Comment
Context In Yes VPMReference Reference in which the material is applied.
Path In Yes String Path that identifies the support to which the material is applied. You can use the CreatePathString method to retrieve the path of the support.
ListMat Out Yes List List of covering materials that are applied to the support.
ListCnx Out Yes List List of applied materials (list of connections that model the material application).

ReturnType

Boolean

Example

/* Retrieve the covering material of a VPMRepInstance */

let Context(VPMReference)
let Support(VPMRepInstance)
let Path(String)
let ListMat(List)
let ListCnx(List)
let Material(CATMatReference)
let AppliedMaterial(CATMatConnection)
let returnCode(Boolean)

Path = Support.Name()
returnCode = GetMaterialCovering(Context,Path,ListMat,ListCnx)

Material = ListMat.GetItem(1)
AppliedMaterial = ListCnx.GetItem(1)

Message(Material.GetAttributeString("PLM_ExternalID"))

RemoveMaterial

The RemoveMaterial function allows you to remove an applied material.

Signature

RemoveMaterial(MatCnx : CATMatConnection) : Boolean

Arguments

Name Input / Output Required? Type Comment
MatCnx In Yes CATMatConnection Applied material (connection that models the material application).

ReturnType

Boolean

Example

/* Remove an applied material */

let AppliedMaterial(CATMatConnection)
let returnCode(Boolean)

returnCode = RemoveMaterial(AppliedMaterial)

SetMaterialCore

The SetMaterialCore function allows you to apply a core material to a support.

Signature

SetMaterialCore(Context : VPMReference, Path : String,
MatParam : CATMatReference, MatCnx : CATMatConnection) : Boolean

Arguments

Name Input / Output Required? Type Comment
Context In Yes VPMReference Reference in which the material is applied.
Path In Yes String Path that identifies the support to which the material is applied. You can use the CreatePathString method to retrieve the path of the support.
MatParam In Yes CATMatReference Core material to be applied to the support.
MatCnx Out Yes CATMatConnection Applied material (connection that models the material application).

ReturnType

Boolean

Example

/* Apply a core material to a body */

let Context(VPMReference)
let Path(String)
let Material(CATMatReference)
let AppliedMaterial(CATMatConnection)
let returnCode(Boolean)

let listFeatures(List)
let Support(Feature)
let nullInstance(VPMInstance)
let repInstance(VPMRepInstance)

*/ creation of a path string to the support */

listFeatures = repInstance->Query("BodyFeature","x.Name==\"PartBody\"")
support = listFeatures.GetItem(1)
Path = Context->CreatePathString(nullInstance,Support)

*/ set material */

returnCode = SetMaterialCore(Context,Path,Material,AppliedMaterial)

SetMaterialCovering

The SetMaterialCovering function allows you to apply a covering material to a support.

Signature

SetMaterialCovering(Context : VPMReference, Path : String,
MatParam : CATMatReference, MatCnx : CATMatConnection) : Boolean

Arguments

Name Input / Output Required? Type Comment
Context In Yes VPMReference Reference in which the material is applied.
Path In Yes String Path that identifies the support to which the material is applied. You can use the CreatePathString method to retrieve the path of the support.
MatParam In Yes CATMatReference Covering material to be applied to the support.
MatCnx Out Yes CATMatConnection Applied material (connection that models the material application).

ReturnType

Boolean

Example

/* Apply a covering material to a representation instance */

let Context(VPMReference)
let Path(String)
let Material(CATMatReference)
let AppliedMaterial(CATMatConnection)
let repInstance(VPMRepInstance)
let returnCode(Boolean)

Path = repInstance.Name()

returnCode = SetMaterialCovering(Context,Path,Material,AppliedMaterial)