Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to draw more than 4 Story and spaces, Default selected tool is rectangle and working tool is Polygon #377

Open
rwadhwa910 opened this issue Mar 16, 2021 · 11 comments

Comments

@rwadhwa910
Copy link

I cannot draw more than 4 stories and when I create a story after the 4th all these gets selected together and at the same time when I try to draw something using Rectangle tool , it does not work instead it uses polygon tool to draw the shape which does not complete a set meaning if I start the polygon tool and end it at the same point, it should complete my drawing but that does not happen.

OS 3.1.0
Windows 10

Screenshot (124)

@Mkellyeng
Copy link
Contributor

Mkellyeng commented Mar 16, 2021

tl;dr the FS file's internal ID counter broke. The file can be repaired, though it's a little time consuming

I've had this issue before, in my experience it occurs when the internal IDs become invalid for some reason

The two causes that I have found are:

  • The internal IDs overflow beyond 16 digits
  • The window deletion bug, in which the window ID is left dangling if object are deleted in a particular order Window Deletion Bug #355

Based on your screenshot, you're looking at the first issue. This can occur if you save and reopen the same file a bunch of times, making changes each time. The root cause seems to be in how the internal IDs for each object are managed.

Essentially, each object is given a unique internal ID. There's a counter that increments by 1, each time a new object is created. However when the file is opened (ie saved, closed, reopened) the counter appends 1, rather than adding 1. So 12+1=121, instead of 12+1=13. I think this is caused by some string/int funkiness

If this happens often enough you'll get more than 16 digits, everything breaks and you have the bizarre set of behaviours you're seeing now

A similar ticket that a colleague of mine raised a while ago, though I'm not sure this was ever actioned. At the time we weren't yet sure why this was happening, but looking back on it, I now believe it to be the internal ID length issue
#302

@Mkellyeng
Copy link
Contributor

If you can share the osm file and the folder that it comes with, I can confirm whether you're dealing with the ID issue. The geometry is saved in "floorplan.json" you can open this up in notepad (or preferably in an online json viewer).
image

If you want to repair the file, look at the IDs. They're probably super long, but all start with the same string of numbers. You can find and replace, say, the first 10 digits of the IDs, and the crazy behaviour should go away

eg: use the notepad++ find and replace tool to replace "1234567890" with "9". That'll shorten the IDs, and should still all be unique.
"ID": "1234567890123456" becomes "ID": "9123456"
"ID": "1234567890123457" becomes "ID": "9123457"
"ID": "1234567890123458" becomes "ID": "9123458"

If you don't want to mess around in the json file, you'll probably have to redo your geometry unfortunately. If so, try to build the geometry without closing/reopening the file too many times, as the ID appending happens when the file is opened. I'm not sure if the OS merge function triggers the ID issue, but it should be safe to save even without merging the geometry (from memory, merging converts the .json into an .osm, but the .json is still saved when you save OS. So you can make all your changes in json, and just merge at the end)

Note that I haven't worked with OS 3.1.0, so my info might be a little out of date. Though I assume it's still all structured this way

@Mathadon
Copy link

This may be solved by setting largestId = +v; in https://github.com/NREL/floorspace.js/blob/develop/src/store/utilities/importFloorplan.js line 116

@rwadhwa910
Copy link
Author

@Mkellyeng I was able to change the floorplan by using your trick but after a file even if my ids are less than 17 digits still I am not able to add the spaces. I have attached a google link where you can find the JSON file.

@rwadhwa910
Copy link
Author

@Mkellyeng
Copy link
Contributor

Mkellyeng commented Apr 14, 2021

I had a go at repairing that file, I'm able to add spaces when testing on the web version (https://nrel.github.io/floorspace.js/), so I expect it'll work in OpenStudio as well

Repaired FloorSpace JSON.zip

I pulled down FS and put in @Mathadon's suggested change, which corrected the ID issue locally. I've pushed it to this repo, however I don't know how often the OpenStudio version of floorspace is updated. So the bug will likely still be present.

Essentially, be careful with how often you Edit, then Save, then Close, then Reopen, then Edit your files

@Calde13
Copy link

Calde13 commented Jan 2, 2023

Hello sir.

¿Could u help me to repair my JSON file? It has shown all the described problems above.

@Calde13
Copy link

Calde13 commented Jan 2, 2023

This may be solved by setting largestId = +v; in https://github.com/NREL/floorspace.js/blob/develop/src/store/utilities/importFloorplan.js line 116

How can I set "largestId = +v;" in OpenStudio?

@rwadhwa910
Copy link
Author

Open the floorplan.json file in the model folder in notepad and follow these steps.

image

If you want to repair the file, look at the IDs. They're probably super long, but all start with the same string of numbers. You can find and replace, say, the first 10 digits of the IDs, and the crazy behaviour should go away

eg: use the notepad++ find and replace tool to replace "1234567890" with "9". That'll shorten the IDs, and should still all be unique.
"ID": "1234567890123456" becomes "ID": "9123456"
"ID": "1234567890123457" becomes "ID": "9123457"
"ID": "1234567890123458" becomes "ID": "9123458"

if you have issues attach the floorplan file and i can look into it.

@Calde13
Copy link

Calde13 commented Jan 3, 2023

Could u show a picture where I can watch where the ID's are inside the json file?

@rwadhwa910
Copy link
Author

image

here it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants