I have a gurney Transport Group that has a lot of members and the gurneys are arranged in a huge line such that staff are walking really far to get some of the gurneys. I would prefer to have all the gurneys in one spot (occupying the same space).
I have a gurney Transport Group that has a lot of members and the gurneys are arranged in a huge line such that staff are walking really far to get some of the gurneys. I would prefer to have all the gurneys in one spot (occupying the same space).
The following code will set the offsets of all the group members such that they're all on top of each other, just change the name of the group to match the group you want to adjust:
treenode group = Gurneys; for(int j = 1; j <= nrop(group); j++) { treenode member = outobject(group, j); setvarnum(member, "XOffset", -(xsize(member) + 0.1) * (j - 1)); setvarnum(member, "YOffset", 0); set(spatialsx(group), xsize(member) + 0.1); setvarnum(group, "FloorLength", xsize(member) + 0.1); } reset();
In that same spirit, is there an option to layout the gurneys kinda like we do with the waiting room layout?
Thanks,
You can drag the individual gurneys to where you want them and that sets their offset x and y values from the group object.
Yes that works great. I feel pretty stupid. Thanks.
I just realized my script needed some rework in order to work for staff, equipment and transport groups, so here's the updated script:
// Specify the name of resource group for which you want to arrange its members treenode group = Gurneys; // Specify the grid pattern for resource placement (number of rows and columns in grid) int numRows = 6; // the number of resources along the group's x-axis (i.e. rows) int numCols = 4; // the number of resources along the group's y-axis (i.e. columns) // Specify the spacing around each resource member double paddingX = 0.2; // spacing in the x direction double paddingY = 0.2; // spacing in the y direction int objType = 1; if(getobjecttype(group) == OBJECT_StaffGroup) objType = 2; // Compare the number of grid spots with the total number of members in the group, // and display any errors or warning accordingly. int totSpots = numRows * numCols; int totMembers = nrop(group); if(totSpots > totMembers) { msg("Error", "The numRows * numCols is greater than the total number of members in the group", 1); return 0; } else if(totSpots < totMembers) { msg("Warning", "The numRows * numCols is less than the total number of members in the group. Extra members will be placed in the first/last spot.", 1); } // Set up local variables for the grid placement code below treenode curMember = outobject(group,1); double sizeX = xsize(curMember); // the xsize of the first member in group will be the assumed xsize of all members double sizeY = ysize(curMember); // the ysize of the first member in group will be the assumed ysize of all members double groupX = ((sizeX + paddingX) * numRows) - paddingX; double groupY = ((sizeY + paddingY) * numCols) - paddingY; double curX = 0; double curY = 0; // Set the size of the group object and its floor based on assumed x,y size of members and the desired grid pattern set(spatialsx(group), groupX); set(spatialsy(group), groupY); setvarnum(group, "FloorLength", groupX + 2*paddingX); setvarnum(group, "FloorWidth", groupY + 2*paddingY); setvarnum(group, "FloorX", -paddingX); setvarnum(group, "FloorY", paddingY); int totCount = 1; // Nested for-loop for setting the appropriate X,Y offsets of each member for(int col = 1; col <= numCols; col++) { for(int row = 1; row <= numRows; row++) { if(objType == 1) { curX = (row-1) * (sizeX + paddingX); curY = (col-1) * (sizeY + paddingY) - 0.5*groupY + 0.5*sizeY; setvarnum(curMember, "XOffset", curX - (sizeX + 0.1) * (totCount - 1) - 0.1); setvarnum(curMember, "YOffset", curY); } else { curX = (row-1) * (sizeX + paddingX); curY = (col-1) * (-sizeY - paddingY); setvarnum(curMember, "XOffset", curX - 0.05); setvarnum(curMember, "YOffset", curY + sizeY * (totCount - 1) + 0.05); } totCount++; curMember = outobject(group,totCount); } } // A while-loop for setting the X,Y offset of any additional members to that of the last member in the grid while(objectexists(curMember)) { if(objType == 1) { setvarnum(curMember, "XOffset", curX - (sizeX + 0.1) * (totCount - 1) - 0.1); setvarnum(curMember, "YOffset", curY); } else { setvarnum(curMember, "XOffset", curX - 0.05); setvarnum(curMember, "YOffset", curY + sizeY * (totCount - 1) + 0.05); } totCount++; curMember = outobject(group,totCount); } // Reset the model in order to update the locations of the members based on the previously defined X,Y offsets reset();
I modified Matthew's script to arrange the resource members of a group into any x,y grid pattern you may want. Here's an example of automatically arranging the 24 gurneys of a group into a 6 X 4 grid pattern with a gap of 0.2 meters around each of the gurneys.
Here's the script:
// Specify the name of resource group for which you want to arrange its members treenode group = Gurneys; // Specify the grid pattern for resource placement (number of rows and columns in grid) int numRows = 6; // the number of resources along the group's x-axis (i.e. rows) int numCols = 4; // the number of resources along the group's y-axis (i.e. columns) // Specify the spacing around each resource member double paddingX = 0.2; // spacing in the x direction double paddingY = 0.2; // spacing in the y direction // Compare the number of grid spots with the total number of members in the group, // and display any errors or warning accordingly. int totSpots = numRows * numCols; int totMembers = nrop(group); if(totSpots > totMembers) { msg("Error", "The numRows * numCols is greater than the total number of members in the group", 1); return 0; } else if(totSpots < totMembers) { msg("Warning", "The numRows * numCols is less than the total number of members in the group. Extra members will be placed in first spot.", 1); } // Set up local variables for the grid placement code below treenode curMember = outobject(group,1); double sizeX = xsize(curMember); // the xsize of the first member in group will be the assumed xsize of all members double sizeY = ysize(curMember); // the ysize of the first member in group will be the assumed ysize of all members double groupX = ((sizeX + paddingX) * numRows) - paddingX; double groupY = ((sizeY + paddingY) * numCols) - paddingY; double curX = 0; double curY = 0; // Set the size of the group object and its floor based on assumed x,y size of members and the desired grid pattern set(spatialsx(group), groupX); set(spatialsy(group), groupY); setvarnum(group, "FloorLength", groupX + 2*paddingX); setvarnum(group, "FloorWidth", groupY + 2*paddingY); setvarnum(group, "FloorX", -paddingX); setvarnum(group, "FloorY", paddingY); int totCount = 1; // Nested for-loop for setting the appropriate X,Y offsets of each member for(int col = 1; col <= numCols; col++) { for(int row = 1; row <= numRows; row++) { curX = (row-1) * (sizeX + paddingX); curY = (col-1) * (sizeY + paddingY) - 0.5*groupY + 0.5*sizeY; setvarnum(curMember, "XOffset", curX - (sizeX + 0.1) * (totCount - 1) - 0.1); setvarnum(curMember, "YOffset", curY); totCount++; curMember = outobject(group,totCount); } } // A while-loop for setting the X,Y offset of any additional members to that of the last member in the grid while(objectexists(curMember)) { setvarnum(curMember, "XOffset", curX - (sizeX + 0.1) * (totCount - 1) - 0.1); setvarnum(curMember, "YOffset", curY); totCount++; curMember = outobject(group,totCount); } // Reset the model in order to update the locations of the members based on the previously defined X,Y offsets reset();
4 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved