cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Edit Mode for Conveyor Module

Edit Mode for Conveyor Module

Hi, since the Conveyors in the Conveyor Module are able to do a lot of stuff only by dragging around (e.g. connect to other Conveyors, change size) it happens very often that connections (Transfers) are created or droped away accidentally while working on a model.

Normally we are just creating the layout of the conveyor system and after this we implement the logic (e.g. Photo Eyes, Decision Points, Connections).

So I think it would be helpful to have a "switch" to turn on/ off the edit mode of the Conveyors. So if the edit mode is turned off, the layout can´t be changed (accidentally). Nevertheless adding Photoeyes or Decision Points could be allowed in the turned off edit mode.

3 Comments
JordanLJohnson
Autodesk

You can make a button on your toolbar that acts like a switch, disabling layout changes:

int mode = -1;
forobjecttreeunder(model()) {
	if (isclasstype(a, "Conveyor::Conveyor")) {
		if (mode == -1) {
			mode = !switch_protected(a, -1);
		}		
		switch_protected(a, mode);
	}
}

When I did this, I was still able to add and edit decision points and photo eyes, even when I couldn't move the conveyors.

sebastian_hemmannE3JAU
Collaborator

Hi @jordan.johnson, thanks for this information.

Could you please add further information about:

  1. How to turn it off again?
  2. How to add a button to our toolbar?
JordanLJohnson
Autodesk

This code just switches the toggle. It checks the protected flag on the first conveyor it finds, and then sets it to the opposite. That way, you can just click the button again to turn it off.

To add it to the toolbar, go to Global Preferences, to the Customize Toolbar tab, add a new button, and put this code in the code for that button.

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea