Hi,
I tried to change the font properties (e.g. color, size, font) of the model objects generated by my script, however I am unable to find a way to do that.
This is what I get at the moment:
These objects are created with
var lang = Context.getSelectedLanguage(); var model = group.CreateModel(Constants.MT_EEPC, MODEL_NAME, lang); var group = ArisData.getSelectedGroups()[0]; var obj_definition = group.CreateObjDef(Constants.OT_FUNC, content, lang); symbol[0] = Constants.ST_FUNC; model.createObjOcc(symbol[0], obj_definition, 0, 0, true);
I assume this is the most basic way to create such objects.
Could anyone please
- Point me to the relevant documentation (ARIS Business Architect 7.2)
- Tell me where I need to change the font properties (at model / group / object definition / object occurence level)
- and/or post some code that shows how to change the font properties?
Any help is greatly appreciated!
Thank you!
Laurent
Hi,
Just ran across the solution when I was searching for something completely different!
These are the few lines that you need if you want a black text color:
var lang = Context.getSelectedLanguage(); var db = ArisData.getActiveDatabase(); var fontStyle = db.createFontStyle("Custom Font Style", lang, true); fontStyle.Font(lang).setColor(0);
or, if you want to build upon the current font style:
var lang = Context.getSelectedLanguage(); var db = ArisData.getActiveDatabase(); var fontStyle = db.defaultFontStyle(); fontStyle.Font(lang).setColor(0);
Hope this helps someone else then! :)
Have a nice day
Laurent
Laurent,
I came across your discussion about the font colors, and you seem very knowledgeable when it comes to programming.
I am just starting to write scripts in ARIS, and I was wondering if you could point me in the right direction to where I could get the most help on this topic (whether it be books, websites, etc).
Thank you in advance!
Chris
Hi Chris,
In fact, I am not very experienced with ARIS and I only worked with ARIS for 2 weeks when posting this.
However, this pretty much sums up how I managed to learn ARIS scripting:
- I already knew a little bit of JavaScript
- Use this forum, browse the threads in this group (Reports & Macros in ARIS)
Here are some posts I found particularly helpful:
Reports and macros in ARIS
How to import values through Excel?
Anyone knows how to create a new object from scratch and assign attributes to it?
ARIS scripting tutorials - The script documentation that is included in Business Architect 7.2: see
(in the main menu of the application) Help → ARIS Script - A lot of trial and error ;)
Hope this helps!
Laurent
Hi Mr. Laurent Seiler,
Good morning. I am an ARIS Administrator and I would like to seek your help in creating a script that will automatically apply a specific Template to a directory of models.
I know that you can apply a template to a model one by one (Right click on the model, Format--> Apply Template). However, we have thousands of models in one directory and I was wondering if there is an easier way to do this?
Thank you and hoping to hear from you.
Thanks, Paula De Guzman
Hello Paula,
It is actually possible to apply a template on many models at one time. You can either select the models from a single group n ARIS Explorer if you have this structure. Or if the models are spred out in different groups, use the Find functionality to locate them. Thereafter you can apply the Template on the result by selecting them all and right-mouse click --> Apply template.
I hope this tip can help you to achive what you need to do.
Regards / Harry
Hi Paula,
I'm sorry, I have never done something like that. However, I would try something like this:
// Get selected database var db = ArisData.getActiveDatabase(); // Get all models. Constant documented in Help > ARIS Script > // Methods for reports and semanticchecks > Constants > FindConstants var all_models = db.Find(Constants.SEARCH_MODEL); // Get some template and modify it as you wish. Function found in // Help > ARIS Script > Methods for reports and semanticchecks > Objects > Model var base_template = all_models[0].getTemplate(); // ..... change properties. Don't know how to do that ...... // For each model, apply template for (int i = 0; i < all_models.length; i++) { // Apply template. Function found in Help > ARIS Script > // Methods for reports and semanticchecks > Objects > Model all_models[i].setTemplate(base_template); }
I have not tried this, and I don't know if it works at all, but you could try and report back :)
Bye,
Laurent