NREL / floorspace.js

Other
66 stars 35 forks source link

Import Library not working #291

Closed macumber closed 6 years ago

macumber commented 6 years ago

When starting a new floorplan I am attempting to seed the floorplan with space types and other objects from our current model. I am starting the app with the following commands sent to the embedded editor:

1) window.api.setConfig({"initialGridSize":15,"initialNorthAxis":0,"online":true,"showImportExport":false,"showMapDialogOnStart":true,"units":"ft"}
);

2) window.api.init();

2a) Press "Create New Floorplan" button

3) window.api.importLibrary(JSON.stringify({"building_units":[],"construction_sets":[],"space_types":[{"color":"#AA0000","handle":"{0fd0e18c-4b62-4a14-982f-e2e3b414e6c1}","id":"1","name":"Red Type"},{"color":"#800000","handle":"{83f2ae37-17c8-4136-b0cb-c5676aac7066}","id":"2","name":"Green Type"},{"color":"#0000FF","handle":"{3505e94c-b834-4704-8578-466464dc3f93}","id":"3","name":"Blue Type"}],"stories":[{"color":"#8B008B","handle":"{7d461efa-98af-4454-8671-06e273158559}","id":"4","name":"Story 1"}],"thermal_zones":[]}
));

3a) Press "Create New Floorplan" button

I have tried the previous code pushing the "Create New Floorplan" button at both step 2a and 3a. In both cases, I do not see the expected space type objects available in the assignments tab. Ideally, I would like this import library to work (e.g. objects persisted into the model) if the user presses the button at either 2a or 3a, otherwise I would have to add code that waits until the user presses the button.

macumber commented 6 years ago

@ljbrackney the symptom here is that your space types, etc don't show up in your floorplan the first time you create it. If you switch tabs and come back, your space types will be merged in

bgschiller commented 6 years ago

Maybe I'm misunderstanding the problem, but I'm seeing that it works in either order. So if I do:

  1. window.api.setConfig({ "initialGridSize":15," initialNorthAxis":0, "online":true, "showImportExport":false, "showMapDialogOnStart":true, "units":"ip" });
  2. window.api.init();
  3. click the "Create New Floorplan" button
  4. window.api.importLibrary(JSON.stringify({ "building_units":[], "construction_sets":[], "space_types": [{ "color":"#AA0000", "handle": "{0fd0e18c-4b62-4a14-982f-e2e3b414e6c1}", "id":"1", "name":"Red Type" }, { "color":"#800000" ,"handle":"{83f2ae37-17c8-4136-b0cb-c5676aac7066}", "id":"2", "name":"Green Type" }, { "color":"#0000FF", "handle":"{3505e94c-b834-4704-8578-466464dc3f93}", "id":"3", "name":"Blue Type" }], "stories":[{ "color":"#8B008B", "handle":"{7d461efa-98af-4454-8671-06e273158559}", "id":"4", "name":"Story 1" }], "thermal_zones":[] }));

Then I have the three space types in my library.

And if I swap the order of steps 3 and 4, I also have the space types in my library. What am I doing wrong?

macumber commented 6 years ago

@bgschiller I am still seeing this, can we do a screen share on Wednesday?

bgschiller commented 6 years ago

Yep, definitely.