Moved components.

Hello there, I’m learning how to create modules and I got this problem. I set the document width to 60.960mm but all the components are moved to left.

When the source code is created with the helper.py script this structure it looks wrong struct CoZenoWidget : ModuleWidget { CoZenoWidget(CoZeno* module) { setModule(module); setPanel(createPanel(asset::plugin(pluginInstance, “res/coZeno.svg”)));

	addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
	addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
	addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
	addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));

	addParam(createParamCentered<RoundBlackKnob>(mm2px(Vec(28.62, 51.317)), module, CoZeno::FRECUENCY_PARAM));

	addInput(createInputCentered<PJ301MPort>(mm2px(Vec(1.822, 51.322)), module, CoZeno::VC_INPUT));

	addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(15.404, 92.968)), module, CoZeno::OUTPUT2_OUTPUT));
	addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(-2.692, 93.236)), module, CoZeno::OUTPUT1_OUTPUT));
	addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(33.122, 93.241)), module, CoZeno::OUTPUT3_OUTPUT));
	addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(-2.49, 109.818)), module, CoZeno::OUTPUT4_OUTPUT));
	addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(15.406, 109.796)), module, CoZeno::OUTPUT5_OUTPUT));
	addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(33.124, 109.737)), module, CoZeno::OUTPUT6_OUTPUT));

	addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(-4.541, 77.582)), module, CoZeno::LED1_LIGHT));
	addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(3.44, 77.551)), module, CoZeno::LED2_LIGHT));
	addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(11.382, 77.556)), module, CoZeno::LED3_LIGHT));
	addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(19.358, 77.545)), module, CoZeno::LED4_LIGHT));
	addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(27.301, 77.55)), module, CoZeno::LED5_LIGHT));
	addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(35.23, 77.561)), module, CoZeno::LED6_LIGHT));
}

Do you know what am I doing wrong?

Thanks

As I mentioned on Discord. the problem is most likely the helper.py limitation that it does not understand transforms, so it emits the wrong coordinates.

IMO helper.py isn’t sustainable in the long term as you evolve your module.

You can work around the limitation by making sure the components layer and everything in it has no transforms. In Inkscape, this means flattening (ungroup) everything in the components layer (probably including the layer, which is itself a group), then regrouping (recreating the components group/layer).

This gets quite tedious, as does dealing with the code generation, so most people move beyond helper.py and maintain control positioning manually (or develop higher-level layout code).

2 Likes

What @pachde said.

2 Likes

Hello pachde, thank you very much for your answers on Discord and here, I promise to investigate your method. I thought it would be something fairly minor, just changing some settings in Inkscape or something like that, but it require to much changes in my current mental methodologic. I’ll come back to this post very soon.

Thank you again for your company in this road. :grinning:

Happy to help! Thank you.