pyRevit icon indicating copy to clipboard operation
pyRevit copied to clipboard

Errors in exported hatch pattern files (.pat)

Open todd-moon opened this issue 2 years ago • 1 comments

Describe the bug Error 1: Exported .PAT files do not correctly follow the rules for hatch pattern definitions. There is no comma generated between the fifth and sixth terms in each line of the definition, so the two terms are concatenated into a meaningless number which includes two decimal points. AutoCAD and Revit reject the files when trying to import because they are syntactically incorrect.

Error 2: File naming convention of the exported file does not match the pattern definition name. The export process appears to alter the pattern name when making the file. It appears that hyphens are removed from the file name. Once upon a time this caused a problem in AutoCAD when creating a custom pattern by importing a file from a PAT file (if the file name and the pattern name defintion did not match exactly, it caused an error.) I am unsure if this is still an issue in current versions of AutoCAD, as I very rarely use it for production these days. Revit does not seem to care what the file name is.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Make Pattern'
  2. Click on 'Export PAT file'
  3. Open the generated PAT file
  4. See error

Expected behavior A functional pattern definition file that can be imported into AutoCAD or Revit.

Screenshots Screenshot shows an exported file and illustrates the two noted errors.

The highlighted markup shows where there should be a comma. Also, compare the file name shown at the top and the name of the pattern definition within the file itself (line 9). The hyphen has been removed in the file name and the words are concatenated together into "BrickNorman". The pattern name is defined as "Brick-Norman".

Screenshot 2022-10-01 090055

Desktop (please complete the following information):

  • OS: Windows 10
  • pyRevit Version 4.8.11.22103+0000-wip
  • pyRevit Environment:
  • "C:\Users\Todd>pyrevit env ==> Registered Clones (full git repos) ==> Registered Clones (deployed from archive/image) master | Deploy: "basepublic" | Branch: "master" | Version: "4.8.10.22040+1743" | Path: "C:\Users\Todd\AppData\Roaming\pyRevit-Master" ==> Attachments Unnamed-363FBF8 | Product: "Autodesk Revit 2023" | Engine: IPY277 (277) | Path: "C:\Program Files\pyRevit-Master" | AllUsers Unnamed-363FBF8 | Product: "Autodesk Revit 2022" | Engine: IPY277 (277) | Path: "C:\Program Files\pyRevit-Master" | AllUsers Unnamed-363FBF8 | Product: "Autodesk Revit 2021" | Engine: IPY277 (277) | Path: "C:\Program Files\pyRevit-Master" | AllUsers Unnamed-363FBF8 | Product: "Autodesk Revit 2020" | Engine: IPY277 (277) | Path: "C:\Program Files\pyRevit-Master" | AllUsers Unnamed-363FBF8 | Product: "Autodesk Revit 2019" | Engine: IPY277 (277) | Path: "C:\Program Files\pyRevit-Master" | AllUsers ==> Installed Extensions ==> Default Extension Search Path C:\Users\Todd\AppData\Roaming\pyRevit\Extensions ==> Extension Search Paths ==> Extension Sources - Default https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json ==> Extension Sources - Additional ==> Installed Revits Autodesk Revit 2023 | Version: 23.0.11.19 | Build: 20220503_1030(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2023" Autodesk Revit 2022 | Version: 22.1.30.34 | Build: 20220520_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2022" Autodesk Revit 2021 | Version: 21.1.70.21 | Build: 20220517_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2021" Autodesk Revit 2020 | Version: 20.2.90.12 | Build: 20220517_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2020" Autodesk Revit 2019 | Version: 19.2.60.3 | Build: 20220224_1700(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2019" ==> Running Revit Instances Error: Object reference not set to an instance of an object. Run with "--debug" option to see debug messages" pyrevit env

Additional context I have not attempted to generate any "drafting" type hatch pattern files, so, I do not know if this bug is unique to model pattern definition files when exported as PAT files.

todd-moon avatar Oct 01 '22 16:10 todd-moon

@eirannejad

Seems to be stemming from #1480 when the additional PAT_SEPARATOR was removed. pat_grid.shift is not coming in as two values and the floats are not separated. I think this was changed somewhere else.

AnomisSolis avatar Oct 05 '22 22:10 AnomisSolis

Same as https://github.com/eirannejad/pyRevit/issues/1610

eirannejad avatar Jan 02 '23 20:01 eirannejad

Proposed fix with pr #1792

alexdaversa avatar Apr 07 '23 15:04 alexdaversa

Fixed by @alexdaversa in #1792 See wip release in the action section

jmcouffin avatar Apr 08 '23 09:04 jmcouffin