Good morning CAMduct API programmers.
I am trying to create an addin for CAMduct that uses the ContentManager.LoadItem Method.
Can anyone provide me with a line of code or two just to get one bit of straight rectangular duct into a job?
I have gone to the SDK and tried using the examples but I think I'm missing something.
Any help is greatly appreciated.
Code snippet below: (FabricationAPI.dll has been loaded to references)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Fabrication;
using System.Xml.Linq;
using Autodesk.Fabrication.Content;
namespace Itemload
{
public class Class1
{ /// <summary>
/// Loads an Item from disk and updates properties.
// </summary>
/// <param name="path">The path to the item on disk, including the item name i.e. path/item.itm</param>
/// <param name="alias">The alias property to update on the loaded item</param>
/// <param name="orderNumber">The order property to update on the loaded item</param>
/// <param name="notes">The notes property to update on the loaded item</param>
/// <returns>True if the item was loaded and updated, false if not.</returns>
public static bool LoadItemAndUpdateProperties(string path, string alias, string orderNumber, string notes)
{
bool updated = false;
using (var itm = ContentManager.LoadItem("C:\\Users\\Public\\Documents\\Autodesk\\Fabrication 2020\\Metric Content\\V7.06\\Items\\HVAC\\Generic\\Rectangular\\Straight(Coil).ITM"))
{
if (itm != null)
{
itm.Alias = alias;
itm.Order = orderNumber;
itm.Notes = notes;
if (ContentManager.SaveItem(itm).Status == ResultStatus.Succeeded)
updated = true;
}
}
return updated;
}
}
}