Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Solved by Jeff_M. Go to Solution.
No. I inquired about this last month: http://forums.autodesk.com/t5/AutoCAD-Civil-3D-Customization/Removing-Sites/td-p/4687437
Partha has logged it as a change request.
Nooooooooooooooooooooooooo!!!!!!!!!!!!!!!!
This sucks, doesn't appear to have been added after 7 years. Partha indicated it would be addressed in the "coming days.". I guess it should have been "coming decades."
Hey @Christopher.Fugitt , I had some time to play today so I decided to try to get this to work using COM without the COM libraries loaded. This worked without issue:
[CommandMethod("junk")]
public void junk()
{
var str = GetCivilAppString("Land");
dynamic acadApp = Application.AcadApplication;
dynamic aeccApp = acadApp.GetInterfaceObject(str);
dynamic aeccDoc = aeccApp.ActiveDocument;
dynamic sites = aeccDoc.Sites;
try
{
sites.Remove("Site");
}
catch { }
}
/// <summary>
/// module must be "Land", "Pipe", "Roadway", or "Survey"
/// </summary>
/// <param name="module"></param>
/// <returns>AeccApp string</returns>
string GetCivilAppString(string module)
{
var retval = "";
var ucm = HostApplicationServices.Current.UserRegistryProductRootKey;
var lm = "HKEY_LOCAL_MACHINE\\" + ucm;
var hj = Registry.LocalMachine.OpenSubKey(ucm);
var c3d = (string)hj.GetValue("Release");
c3d = c3d.Substring(0, c3d.IndexOf(".", (c3d.IndexOf(".") + 1)));
hj.Close();
retval = "AeccXUi" + module + ".Aecc" + (module == "Land" ? "" : module) + "Application." + c3d;
return retval;
}
Thanks Jeff!
It looks like the .net Site.Erase() does remove the site, but still returns the "eNotApplicable" and removes it from Toolspace. Doing an Audit brings the deleted site back.