Software Use > Scripting

Adding material to project

(1/3) > >>

oseresta:
1. If I add any new material or a laminate. How can I make the new material or laminate definition available to my existing projects ?
2. I am creating a project thru excel VBA, I want to make certain material available to this project. How can I do that ?

Thanks

Omprakash

oseresta:
Can any one from Hypersizer please respond to the above question.

Phil:
Omprakash,

I apologize for the delay, our Object Model expert is out of town at a training class and has not had a chance to answer this question yet. I will pass along to him that you are awaiting an answer.

Phil

Ryan:
In the COM API there is actually no notion of assigning projects to groups. You directly assign materials to groups using the VariableMaterial property of the Group class.

In VBA, create a dynamic string array. Put the laminate keys (strings) in the array, assign the array to VariableMaterial, and save.

    ' Print laminate keys
    Dim oLam As HyperSizer.Laminate
    Dim oLamCol As HyperSizer.LaminateCol
   
    Set oLamCol = oHs.Laminates
    For Each oLam In oLamCol
        Debug.Print oLam.key, oLam.MaterialName
    Next oLam
   
    ' Create string array of laminate keys
    Dim strVarMaterial() As String
    ReDim strVarMaterial(1 To 2)
    strVarMaterial(1) = "20016"
    strVarMaterial(2) = "20055"
   
    ' Assign string array to VariableMaterial
    oGroup.VariableMaterial(vpdTopFace_ThicknessMaterial, hmtLaminate) = strVarMaterial
    oGroup.Save

oseresta:
Hi

I am getting this error

Run-time error '-2147188733 (80048003)'

Unhandled Error, Application Error in Group::VariableMaterial[PropertyLet]()

Line#12, Error # 13, Type Mismatch

    Dim strVarMaterial() As String
    ReDim strVarMaterial(1)
   
    strVarMaterial(0) = HS.Laminates.Item(3).Key
    MsgBox (strVarMaterial(0))
    Dim oProjCol As ProjectCol, oGroupCol As GroupCol
    Set oProjCol = HS.Projects
    Set oProj = oProjCol.Item("project01")
    Set oGroupCol = oProj.Groups
    Set oGroup = oGroupCol.Item(2)
    MsgBox (oGroupCol.Item(2).GroupName)
    oGroup.VariableMaterial(vpdTopFace_ThicknessMaterial, hmtLaminate) = strVarMaterial [In this line the debugger shows error]
    oGroup.Save

Thanks for your help

Navigation

[0] Message Index

[#] Next page

Go to full version