How to set material in a part with excel vba
I've searched everywhere for an example of this, and am coming up zeros. The only thing I've found is this article:
https://www.ptc.com/en/support/article?n=CS148500
... and it doesn't work at all. (The "session" object isn't even instantiated in the example).
Here is what I'm doing:
' Dim statements ' connection stuff ...
... Set oModelDescriptor = oModelDescriptorCreate.Create(ModelType, ModelName, Null) Set oModel = oSession.RetrieveModel(oModelDescriptor)
...
blah blah
...
' do some stuff
All of that ^ works fine, as I can read/set parameters, etc.
I can also read the current material with this:
' get material If oModel.Type = EpfcModelType.EpfcMDL_PART Then Set part = oModel Set material = part.CurrentMaterial .Cells(iRow, colOriginalMaterial).Value = material.Name End If
But I'm not having any luck at all setting a new material. I'm trying something like this, but nadda (oModel is set earlier in the procedure):
' Set material
Dim part As IpfcPart
Dim material As IpfcMaterial
Set part = oModel
Set material = part.RetrieveMaterial("steel.mtl")
part.CurrentMaterial = material
Any help?

