Tuesday, August 31, 2010

Useful Regular Expressions

  • Select shell (FLOOR) named "Level_8" and all spaces following, up to "Level_9"

    (?s)(^"Level_8.*)(?=^"Level_9)

    Note that (?s) enables multi-line matching, and (?= begins a non-capturing group
  • Match all EL1 walls and reformat with space vertex identifier

    (?s)(^"EL1\s)(\w{1,20}\s)(Wall\s.{1,5}\..{1,9}\.)(.{1,9})(\)"\s{1,20}\=\s)(\w)(.{5,100}SPACE\-)(V\d{1,2})

    Replacement String: \1\6\3\8\5\6\7\8
  • Strip least-significant identifier from Roof / Flr components:

    (^"EL\d\sRoof\s\(.{1,9}\..{1,9})(\..{1,9}\)")
    (^"EL\d\sFlr\s\(.{1,9}\..{1,9})(\..{1,9}\)")

    Replacement String: \1)"

Thursday, August 26, 2010

Detailed Edit Notes

  • Pseudo routine to 'round' geometry points in an .inp file:
    • Read each line of .inp file
    • For each line, check for "Vn = x.yz, y.zx" (polygon vertex point) or " = SPACE" followed by "X = x.yz" or "Y = y.zx" (space insertion coordinate).
    • If vertex point or insertion coordinate is found, then if x.yz or y.zx contains "e", then round to zero, else round to nearest whole number, else write-line unchanged.
    • If vertex or coordinate found, write original line with $ as first char (comment), and followed by updated line in the format Vn = x, y or X = x or Y = y (pad with spaces to maintain formatting).
    • Check for duplicate vertices, e.g.
      V1 = 1, 0
      V2 = 8, 0
      V3 = 8, 0
    • For the above example, "Along vector y = 0, x increases from 1 to 8, with the intermediate point closest to the second value. Therefore, subtract 1 from the second value". The updated vertex list will be as follows:
      V1 = 1, 0
      V2 = 7, 0
      V3 = 8, 0
    • Write generalized logic to handle all permutations. Include checking first vertex against the last for duplication.
    • Write generalized logic to translate all space polygon vertices with insertion azimuth to zero azimuth. Do azimuth translation before rounding.
    • Provide option to round to the nearest whole, half or quarter foot.
  • Make interior wall surface type ADIABATIC by User default, and remove 'NEXT-TO' adjacency dependencies.
    • Apply heat transfer analysis between internal spaces 'by exception' (i.e. 'where necessary') instead of 'by default'.
    • This greatly simplifies the tasks of modifying existing and creating new spaces in detailed edit mode, without sacrificing appreciable accuracy.