14 Matching Annotations
  1. Mar 2023
    1. The pyCharm remote debug import has to been after the debug is started from pyCharm. Otherwise the imprt will fail and the next call to the function will freeze the application.

      To restart the debug session the active session has to be stoped from pyCharm. Only then can the connecrion function be called again. If the function is called a second time in the same debug session, Revit will freeze

    1. When renaming a view by changing the BuiltInParameter.VIEW_NAME parameter, the corresponding Level will be renamed according to the setting chosen in the corresponding Dialog and documented in the Revit.ini file.

      If the name is changed through the Name property rather than the parameter, the Levels won't be renamed.

  2. Feb 2023
    1. Select your user profile and press F2 to rename. Enter a new name for your user profile (it must match the user name entered in the Registry Editor). Click away and then click Continue to save the changes.

      This may not be possible. Windows doesn't allow to rename the active user folder. Instead restart windows. You will be logged in with a TEMP user setup and folder. Now rename the former user folder to the new name and change the user name again in regedit. With the next startup everything should be setup properly. You will only be logged in correctly if the username defined in regedit matches a folder in the users folder containing all necessary files.

  3. Nov 2022
    1. Checking which application is using a port:Open the command prompt - start >> run >> cmd or start >> All Programs >> Accessories >> Command Prompt.Type netstat -aon | findstr '[port_number]'. Replace the [port_number] with the actual port number that you want to check and hit enter.If the port is being used by any application, then that application's detail will be shown. The number, which is shown at the last column of the list, is the PID  (process ID) of that application. Make note of this.Type tasklist | findstr '[PID]'. Replace the [PID] with the number from the above step and hit enter.You'll be shown the application name that is using your port number.Checking which port is being used by a application:This is exactly the reverse of the above steps.Open the command prompt - start >> run >> cmd or start >> All Programs >> Accessories >> Command Prompt.Type tasklist | findstr '[application_name]'. Replace the [application_name] with the application that you want to check (for example, apache) and hit enter.Make note of the PID (second column) from the details shown.Type netstat -aon | findstr '[PID]'. Replace the [PID] from the above step and hit enter.You'll be shown the application detail and the corresponding port to which it is listening.

    1. Switch between keyboard layouts or input methods You can enter text with different keyboard layouts or input methods by switching between them. There are a few different ways to switch between keyboard layouts or input methods: On a hardware keyboard, press and hold the Windows logo key , and then press the Spacebar to cycle through your input methods. If you have a touchscreen, you can switch your touch keyboard layout by tapping or clicking the keyboard icon, and then tapping or clicking the keyboard layout you want to switch to. Language abbreviation button in the touch keyboard  On the desktop taskbar, tap or click the language abbreviation in the notification area at the far right of the taskbar, and then tap or click the keyboard layout or input method you want to switch to. Language abbreviation button in the desktop taskbar

  4. Mar 2022
    1. Python’s built-in set type has the following characteristics: Sets are unordered. Set elements are unique. Duplicate elements are not allowed. A set itself may be modified, but the elements contained in the set must be of an immutable type.

      Set

    1. Some of our examples show code saved in files, and others — such as the one above — arefrom interactive Python sessions. In such interactive cases, we include the prompts from thePython session such as the triple-arrow (>>>) and triple-dot (...) prompts. You don’t needto type these arrows or dots. Similarly, for operating system shell-commands we will usea dollar prompt ($) for Linux, macOS and other Unixes, or where the particular operatingsystem is unimportant for the task at hand

      Test

    1. When you need the value of an expression, use eval(string): >>> x = eval("2+2") >>> x 4 However, the first step should be to ask yourself if you really need to. Executing code should generally be the position of last resort: It's slow, ugly and dangerous if it can contain user-entered code. You should always look at alternatives first, such as higher order functions, to see if these can better meet your needs.

      eval()

    1. This function can also be used to execute arbitrary code objects (such as those created by compile()). In this case, pass a code object instead of a string. If the code object has been compiled with 'exec' as the mode argument, eval()'s return value will be None. Hints: dynamic execution of statements is supported by the exec() function. The globals() and locals() functions return the current global and local dictionary, respectively, which may be useful to pass around for use by eval() or exec(). If the given source is a string, then leading and trailing spaces and tabs are stripped. See ast.literal_eval() for a function that can safely evaluate strings with expressions containing only literals. Raises an auditing event exec with the code object as the argument. Code compilation events may also be raised.

      eval()

    2. The arguments are a string and optional globals and locals. If provided, globals must be a dictionary. If provided, locals can be any mapping object. The expression argument is parsed and evaluated as a Python expression (technically speaking, a condition list) using the globals and locals dictionaries as global and local namespace. If the globals dictionary is present and does not contain a value for the key __builtins__, a reference to the dictionary of the built-in module builtins is inserted under that key before expression is parsed. That way you can control what builtins are available to the executed code by inserting your own __builtins__ dictionary into globals before passing it to eval(). If the locals dictionary is omitted it defaults to the globals dictionary. If both dictionaries are omitted, the expression is executed with the globals and locals in the environment where eval() is called. Note, eval() does not have access to the nested scopes (non-locals) in the enclosing environment. The return value is the result of the evaluated expression. Syntax errors are reported as exceptions. Example: >>>

      eval()

    3. This function supports dynamic execution of Python code. object must be either a string or a code object. If it is a string, the string is parsed as a suite of Python statements which is then executed (unless a syntax error occurs). 1 If it is a code object, it is simply executed. In all cases, the code that’s executed is expected to be valid as file input (see the section File input in the Reference Manual). Be aware that the nonlocal, yield, and return statements may not be used outside of function definitions even within the context of code passed to the exec() function. The return value is None. In all cases, if the optional parts are omitted, the code is executed in the current scope. If only globals is provided, it must be a dictionary (and not a subclass of dictionary), which will be used for both the global and the local variables. If globals and locals are given, they are used for the global and local variables, respectively. If provided, locals can be any mapping object. Remember that at the module level, globals and locals are the same dictionary. If exec gets two separate objects as globals and locals, the code will be executed as if it were embedded in a class definition. If the globals dictionary does not contain a value for the key __builtins__, a reference to the dictionary of the built-in module builtins is inserted under that key. That way you can control what builtins are available to the executed code by inserting your own __builtins__ dictionary into globals before passing it to exec(). Raises an auditing event exec with the code object as the argument. Code compilation events may also be raised.

      exec()

    1. Storing data in a DataStorage element is very easy. You can follow these steps to write your own data to a DataStorage element: Create a new DataStorage using static method Create of DataStorage class. Create a Schema. Create an Entity which contains data you want to save. Set entity to the created DataStorage. To read data from DataStorage you need to: Find DataStorage in the project (using FilteredElementCollector). Get the entity from the retrieved DataStorage. Read data from the Entity.

      Set Up DataStorage to save ExtensibleStorage Entities inside a Revit Document idependently from Revit Elements