internal static IBlockEntity InsertCore(DSCoordinateSystem contextCoordinateSystem, string blockName) { string kMethodName = "DSBlock.ByCoordinateSystem "; if (null == contextCoordinateSystem) { throw new ArgumentNullException("contextCoordinateSystem"); } if (contextCoordinateSystem.IsSheared) { throw new ArgumentException(string.Format(Properties.Resources.Sheared, "contextCoordinateSystem"), "contextCoordinateSystem"); } if (string.IsNullOrEmpty(blockName)) { throw new ArgumentException(string.Format(Properties.Resources.InvalidInput, blockName, kMethodName), "blockName"); } IBlockHelper helper = HostFactory.Factory.GetBlockHelper(); if (null == helper) { throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName)); } if (!helper.BlockExistsInCurrentDocument(blockName)) { throw new System.ArgumentException(string.Format(Properties.Resources.DoesNotExist, "DSBlock : " + blockName)); } IBlockEntity entity = helper.InsertBlockFromCurrentDocument(contextCoordinateSystem.CSEntity, blockName); if (null == entity) { throw new System.Exception(string.Format(Properties.Resources.OperationFailed, kMethodName)); } return(entity); }