Print Page | Close Window

Scale in object representation

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: https://www.metacase.com/forums/forum_posts.asp?TID=205
Printed Date: 27.Mar.2026 at 00:26
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: Scale in object representation
Posted By: alev
Subject: Scale in object representation
Date Posted: 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.



Replies:
Posted By: stevek
Date 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


Posted By: alev
Date 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!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.05 - http://www.webwizforums.com
Copyright ©2001-2022 Web Wiz Ltd. - https://www.webwiz.net