First time here? Check our help page!
3

Is there a way to use the space to diagram feature of OpenStudio from command line?

Is there a way to use to use "from Diagram to space" feature of OpenStudio from command line?

bb_designer's avatar
51
bb_designer
asked 2020-08-11 21:00:22 -0600
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2020-08-15 14:37:47 -0600
edit flag offensive 0 remove flag close merge delete

Comments

Your question reads space to digram, which would be possible, but I assume you are asking the reverse, how to go from a digram to spaces. If that isn't the case let me know and I'll modify the answer.

David Goldwasser's avatar David Goldwasser (2020-08-12 10:28:38 -0600) edit
add a comment see more comments

1 Answer

3

The answer is yes, but the specific solution depends on what you are asking to do. If you want to know how tobring a previously made FloorSpaceJS plan into an OpenStudio model with the command line, you can use the Merge FloorspaceJS with Model measure.

The FloorSpaceJS file that is taken as an input to this measure could have been made in the OpenStudio Application or in another deployment such as this web development deployment.

If you are asking about using a command line to create and alter FloorSpaceJS files, it is in the end a JSON file and someone could develop methods to generate or alter them with a command line, but I'm not sure if anyone has.

If you question wasn't able FloorSpaceJS and you were looking for something more like the digram to spaces in the SketchUp plugin, there are also some options. OpenStudio has a native function space = OpenStudio::Model::Space.fromFloorPrint(point3dVector, height, model) that results in a single space. The openstudio-extension gem, included with OpenStudio, has methods that build on this to convert a collection of polygons representing the building into a multi-story model such as makeSapcesFromPolygons method. This can be run multiple times when different stories in the building have unique floor plans, similar to how spaces from diagrams can be run multiple times in the SketchUp plugin.

David Goldwasser's avatar
20.4k
David Goldwasser
answered 2020-08-12 10:27:58 -0600, updated 2020-08-12 10:29:15 -0600
edit flag offensive 0 remove flag delete link

Comments

Sorry that was unclear, I wanted to automate the process of creating 3d space from 2d diagram. For example when we draw 2d polygon in sketchup and use create spaces from diagram function, we get a 3d space for the given 2d polygon. I want to repeat this for multiple 2d polygons.

bb_designer's avatar bb_designer (2020-08-12 12:09:29 -0600) edit

In that case, the portion of David's answer you need is the one about OpenStudio::Model::Space.fromFloorPrint(point3dVector, height, model)

Julien Marrec's avatar Julien Marrec (2020-08-12 15:42:40 -0600) edit

Hi David and Jullien, First of all thanks for your reply. I went through the function, and found that the function space.fromfloorprint takes model as an argument. How do I construct the model object which the function is expecting. If you could direct me towards an example code it would be a great help. Also it was quite unclear what the point3dvector argument mean. Thanks in advance

bb_designer's avatar bb_designer (2020-08-12 16:48:35 -0600) edit

Well, the model argument is your openstudio model. So either you load an existing model (see my helper here), or just create a new one model = OpenStudio::Model::Model.new. A Point3dVector is a vector of Point3d representing your floor plan.

pts = OpenStudio::Point3dVector.new;

pts << OpenStudio::Point3d.new(0, 0, 0)
pts << OpenStudio::Point3d.new(0, 1, 0)
pts << OpenStudio::Point3d.new(1, 1, 0)
pts << OpenStudio::Point3d.new(1, 0, 0)
Julien Marrec's avatar Julien Marrec (2020-08-22 15:07:26 -0600) edit

To see a fully working example, see this measure which creates a simple shoebox model: https://github.com/NREL/openstudio-mo...

Julien Marrec's avatar Julien Marrec (2020-08-22 15:08:48 -0600) edit
add a comment see more comments