![]() |
Scale in object representation |
Post Reply
|
| Author | |
alev
Contributor
Joined: 08.Oct.2010 Location: Arnhem, NL Points: 19 |
Post Options
Thanks(0)
Quote Reply
Topic: Scale in object representationPosted: 07.Apr.2011 at 14:03 |
|
Hi,
I am generating an MXM file to import into MetaEdit+ and would like to import information about location and size of modeling elements in a diagram. The MetaEdit+ Workbench explains MXM format very well, but I miss information on how to specify size of an element on a diagram. (I assume size has something to do with 'scale' in MXM object representation.) So given x, y, left, right, top, bottom, area info of an element, how is scale calculated? Thank you. Edited by alev - 07.Apr.2011 at 14:04 |
|
![]() |
|
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 07.Apr.2011 at 14:41 |
|
Scale is relative to the default size of the symbol, as defined in Symbol Editor - i.e. the size of a new element of that type in a Diagram. If you omit the scale attribute, you'll get the default size. If you want it twice as wide and three times as tall, use scale="2,3".
If you want a particular absolute height and width, you'll need to know the height and width of the default size, and calculate the desired scale from those. I suppose one way is to make a defaultSize.mxm with a single graph called defaultSize, containing an instance and representation of each object type, with no scale supplied. Import that with "internal 'fileInPatch: defaultSize.mxm' execute", then run a generator on it to find the width and height of each element. You can store those in variables, and use them later when calculating the desired scale values. After the import, you probably want to abandon with "internal 'abandon' execute", to avoid saving the temporary defaultSize graph. /* To get the default sizes and store them in variables */ do graphs where id='defaultSize' { foreach .() { variable 'width' type write width close } } /* To calculate x scale from $myWidth */ math $myWidth ' / ' variable 'width' type read evaluate |
|
![]() |
|
alev
Contributor
Joined: 08.Oct.2010 Location: Arnhem, NL Points: 19 |
Post Options
Thanks(0)
Quote Reply
Posted: 07.Apr.2011 at 15:42 |
|
Steven, thank you. With your suggestion I finished the generator.
Since the default size of the symbol, as defined in Symbol Editor does not change often, I simply read default width and height from an existing model and put those numbers as parameters in the generator. Thanks again for a lightning fast reply! |
|
![]() |
|
Post Reply
|
|
| Tweet |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |