コード例 #1
0
        // constructors
        public PyRevitClone(string clonePath, string name = null)
        {
            // clone path could be any path inside or outside the clonePath
            // find the clone root first
            var _clonePath = FindValidClonePathAbove(clonePath);

            if (_clonePath is null)
            {
                _clonePath = FindValidClonePathBelow(clonePath);
                if (_clonePath is null)
                {
                    throw new PyRevitException(
                              string.Format("Path does not point to a valid clone \"{0}\"", clonePath)
                              );
                }
            }

            ClonePath = _clonePath.NormalizeAsPath();

            if (name != null)
            {
                if (!reservedNames.Contains(name))
                {
                    Name = name;
                }
                else
                {
                    throw new PyRevitException(string.Format("Name \"{0}\" is reserved.", name));
                }
            }
            else
            {
                Name = string.Format("Unnamed-{0}", ClonePath.GenerateMD5Hash().GetHashShort());
            }
        }
コード例 #2
0
        /// <inheritdoc/>
        protected override void AssureDocumentListeningToDebugEvents(IDebuggableFunction debuggable)
        {
#if FALSE
            ITopLevelExecutable executable = debuggable.Executable;
            ClonePath           clonePath  = GetClonePathForExecutable(executable);
            var editor = AssociatedEnvoy.Edit(clonePath, typeof(Design.VIDiagramControl));
            if (editor != null)
            {
                var document = editor.Document as Design.VIDocument;
                if (document != null)
                {
                    // Getting the debuggable will make sure it has signed up for debug events.
                    document.GetDebuggableFunction(clonePath);
                }
            }
#endif
        }
コード例 #3
0
 public override int GetHashCode()
 {
     return(ClonePath.GetHashCode());
 }