PdcMaterialList.AddComposedMaterial: Difference between revisions
Jump to navigation
Jump to search
Created page with "== Declaration == == Description == == Notes == == Code example == <source lang="vb"> Sub AddMaterialType dim objCalc dim objMat dim thickness dim volume dim objTable ..." |
No edit summary |
||
Line 1: | Line 1: | ||
== Declaration == | == Declaration == | ||
AddComposedMaterial(MaterialKind as String,ComposedMaterialType as Integer, Volume as String, Surface as String) as [[PdcMaterial]] | |||
== Description == | == Description == | ||
Returns an new added composed material object. | |||
== Notes == | == 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 == | == Code example == |
Revision as of 11:11, 21 November 2013
Declaration
AddComposedMaterial(MaterialKind as String,ComposedMaterialType as Integer, Volume as String, Surface as String) 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) '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
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