Edit properties with generator? |
Post Reply |
Author | |
Twister
Member Joined: 06.May.2017 Location: Germany Points: 3 |
Post Options
Thanks(0)
Posted: 17.May.2017 at 18:23 |
Hi,
now i played with metaedit+ and the generator and yes it seams to be a software with many features. One thing what i was looking for is: Is it possible with a generator-run to edit the properties of the objects? For example if i want to automatic numerate the object property :name like 'P1', 'P2', 'P3', 'P4'.... for all "Point"-objects. regards Twister
|
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
The generator language is read-only with respect to models. (You can create a new graph by generating MXM and using internal 'fileInPatch: new.mxm' execute, but that won't update existing models.)
There are three good reasons for keeping the MERL generator language read-only: <pontification>
</pontification> So as an example for your case, I'd consider whether you need a :name property at all. Does the user need/want to enter specific names? If not, and assuming your generated output needs to have names for points, simply use a running index, 'P' $++ix. If your users sometimes want to enter names, e.g. just for special points, but you also need to have names for the other points, you can use the running index when the user hasn't supplied a name, e.g. if :name; then :name; else 'P' $++ix endif. If you don't really care what the number is, you could use 'P' oid, which would make life easier if you had to refer to the same Point at several places in the generated code (where a naive $++ix would give a new number). It's also easy enough to make a mapping from each oid to a number, by creating associative variables:
Edited by stevek - 17.May.2017 at 20:24 |
|
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 |