Stop Waiting Room drawing floor when its ports are closed

Stop Waiting Room drawing floor when its ports are closed

visakh_sakulan
Not applicable
69 Views
5 Replies
Message 1 of 6

Stop Waiting Room drawing floor when its ports are closed

visakh_sakulan
Not applicable

[ FlexSim HC 5.0.12 ]

closeport.fsmcloseport.png

In the model when the input port of the waiting room is closed the floor area and a red box appears. how to remove that?

0 Likes
Accepted solutions (1)
70 Views
5 Replies
Replies (5)
Message 2 of 6

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

The draw code of the waiting room draws the floor and red box whenever the input ports are closed. There's not an easy way to tell it not to draw the floor without writing custom draw code.

I would recommend you not even use this method of closing and opening ports to perform batching and instead use the method in this answer.

If you really want to override the draw code here's the draw code from the object without the drawfloor part, you should be able to paste this into the object's draw trigger:

//////////////////////////////////// CODE HEADER //////////////////////////////////////////////////////////////////////
treenode current = ownerobject(c);
treenode view = parnode(1);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


fglPushMatrix();
drawtomodelscale(current);
fglDisable(GL_TEXTURE_2D);
double r = get(rank(color(current),1));
double g = get(rank(color(current),2));
double b = get(rank(color(current),3));
double rotation = 0;
int nrofbays = content(getvarnode(current, "contenttable"));

//size of chair graphic
double chairWidth = 0.713;
double chairDepth = 0.645;
double chairHeight = 1.07;

for(int bay = 1; bay <= nrofbays; bay++)
{
	double bayloc = get(rank(getvarnode(current, "locationtable"), bay));
	treenode curBayNode = rank(getvarnode(current, "sizetable"), bay);
	double baysize = get(curBayNode);
	int nroflevels = content(rank(getvarnode(current, "contenttable"), bay));
	double deltax = 0;
	double deltay = 0;
	
	for(int level = 1; level <= nroflevels; level++)
	{
		// Each row in the sizetable is a bay and is a head node of yet another table with a row
		// for each level of the bay, and two column. In the first column is the height of the
		// level (i.e. length of the bay's "Position") and the second column contains the orientation
		// of the graphic at that position.
		double levelsize = gettablenum(curBayNode, level, 1);
		int orientation = gettablenum(curBayNode, level, 2);
		double levelloc = gettablenum(getvarnode(current, "locationtable"), bay, level);
		// Subtract leveloc from ysize to correct for opposite y direction in object's coordinate system,
		// and subtract levelsize to correct for level size.
		levelloc = (ysize(current) - levelloc) - levelsize;


		// Determine the deltax,deltay vectors from the origin of each cell (i.e. position) to the
		// front-left corner of the graphic (i.e. chair). The origin of the cell is the top-left
		// corner of the cell when viewed from a model top view where model positive x is to the right
		// and positive y is up. However the deltay vector's positive direction would be down.
		// The 0.04 and 0.02 adjustments to deltax/deltay that are used below are necessary because
		// the chair shape in the 3DS file is shifted 0.02 meters to the right size of the chair,
		// and 0.04 meters to the front of the chair.
		switch(orientation)
		{
			case ORIENTATION_RIGHT: // 3 1
			{
				deltax = chairDepth - 0.04; 
				deltay = (levelsize-chairWidth) - 0.02;
				rotation = -90;
				break;
			}
			case ORIENTATION_FORWARD: // 1 2
			{
				deltax = 0 - 0.02;
				deltay = (levelsize-chairDepth) + 0.04;
				rotation = 0;
				break;
			}
			case ORIENTATION_LEFT: // 2 3
			{
				deltax = 0 + 0.04;
				deltay = levelsize + 0.02;
				rotation = 90;
				break;
			}
			case ORIENTATION_BACKWARD: // 4
			{
				deltax = chairWidth + 0.02;
				deltay = levelsize - 0.04;
				rotation = 180;
				break;
			}
		}


		fglPushMatrix();
		fglTranslate(bayloc + deltax, 0, levelloc + deltay); // flexsim x, -z, y
		fglRotate(rotation, 0,1,0);
		// I don't know the origin of the following x,z,y scale factors. They're a little off from the sx,sy,sz
		// of the actual graphic in the model (as used above), but thought I ought to keep the scale of
		// the graphic in the model unchanged because it fits the patients fairly well.
		fglScale(0.75, 0.97, 0.68); 
		fglColor(r,g,b);
		drawobject(view, getvarnum(current, "CurShapeIndex"), 0);
		fglPopMatrix();
	}
}


fglPopMatrix();
fglEnable(GL_TEXTURE_2D);


return 1;


Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 3 of 6

arunTTT2P
Participant
Participant

Hi Mathew,

Can we use drawobjectfloor() command?

Regards,

Arun KR

0 Likes
Message 4 of 6

Matthew_Gillespie
Autodesk
Autodesk

You could use it in an object's on draw trigger, but most objects on HC already have it in their draw code and have a Show Floor checkbox.



Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 5 of 6

cliff_king
Not applicable

@Visakh Sakulan It's an oversight on our part to not let the user easily turn off the red band around the perimeter of the floor display on locations that have closed inputs. I don't know if you know or not, but we provide switches in File > Global Preferences > Environment to turn on/off this sort of display for Off Schedule and Kept resources. We just need to include locations as well as resources. We will do this in the next release of the software!

Message 6 of 6

visakh_sakulan
Not applicable

@cliff.king Thank you for the information.

0 Likes