PdcMaterialList.AddComposedMaterial

From External Bemet Wiki
Jump to: navigation, search

Contents

Declaration

AddComposedMaterial(MaterialKind as String,ComposedMaterialType as Integer, Volume as Double, Surface as Double) as PdcMaterial

Description

Returns an new added composed material object.

Notes

This method add an material to the materiallist.

  • The first parameter determines the materialkind.
  • The second parameter is composed material type, with the following options:

0 - Piece
1 - Meter (M)
2 - Kg (KG)
4 - Surface (M2)
5 - Volume (M3)

  • The third parameter can be used to give the volume.
  • The fourth parameter can be used to give the surface.

Code example

Sub AddMaterialType
dim objCalc
dim objMat
dim thickness
dim volume
dim objTable
dim weightfac
dim weight
  set objTable = pdc.Database.OpenTable(pdcCondata,"SGMAT","SG_MATNR")
  if objTable.Locate("SG_MATNR","RVS306") then
    set objCalc = pdc.NewCalculation
    set objMat = objCalc.MaterialList.AddComposedMaterial("RVS306",4,0,0) 'RVS306 added as sheet
    thickness = 20 'mm
    objMat.Description = "PLAAT-" & thickness &  "MM"
    objMat.Length = 1 'm
    objMat.Width = 1 'm
    volume = thickness / 1000 ' volume per m2
    objMat.CostKind = objTable.GetField("SG_KSTSRT")
    weigthfac = objTable.GetField("SG_SGEW")
    weigth = 1000 * volume * weigthfac
    objMat.PricePerUnit =  volume * weigthfac * 1000 * objTable.GetField("SG_PRIJS")
    'objMat.SurfaceFactor = 2 '2 for sheets THIS PROPERTY DOES NOT EXIST!
    objMat.Weight = weigth
    objMat.WeightFact = weigth
    objMat.UseStandardSize = false 'Sheet and block should be false, others are true
    objMat.DefaultSize = "" 'Nothing for sheets
    objMat.Scrap = objTable.GetField("SG_AFP")
    objMat.SurCharge = objTable.GetField("SG_TSLP")
    objMat.GrossPurPrice = objMat.PricePerUnit
    objMat.PurDiscount = 0
 
    objCalc.Save
    set objMat = nothing
    set objCalc = nothing
  end if
  set objTable = nothing
End Sub

Availability

Personal tools
Namespaces
Variants
Actions
PdC Scripting Helpfile
Toolbox