- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm doing some C# to some model customization. In the ModelParameters Object there is supposed to be an "Item" property as per the documentation. Using VS2017 and have added the Inventor reference. as a workaround I'm looping through, but that seems odd,. code is below.
// start with the pipe file
System.IO.File.Copy(sTemplatePath + "Pipe.ipt", ProjectPath + "Pipe_" + sFileName + ".ipt");
Ready = false;
cSE.oIPartDoc = (PartDocument)cSE.oIDocs.Open(ProjectPath + "Pipe_" + sFileName + ".ipt");
if (!Ready)
{
Thread.Sleep(250);
}
//now update the parameters
cSE.oIPartCompDef = cSE.oIPartDoc.ComponentDefinition;
cSE.oIModelParameters = cSE.oIPartDoc.ComponentDefinition.Parameters.ModelParameters;
foreach (ModelParameter modelParameter in cSE.oIModelParameters)
{
string name = modelParameter.Name;
switch (name)
{
case "Length":
modelParameter.Value = dScrewLength * cSE.IV;
break;
case "OutsideDia":
modelParameter.Value = dPipeOD * cSE.IV;
break;
case "InsideDia":
modelParameter.Value = dPipeID * cSE.IV;
break;
}
}
cSE.oIPartDoc.Update();
Solved! Go to Solution.