Forward Migration

This topic contains 15 replies, has 5 voices, and was last updated by  Péter Baksa 6 months, 1 week ago.

  • Author
    Posts
  • #3480

    James Goode
    Participant

    I am trying to be able to migrate one object and a lot of variations of that object from 19 to 21 using 2 different objects, one specific to 19 and one specific to 21. I can’t seem to get it to work at all. At the moment all I have is;

    actualGuid = FROM_GUID
    if actualGuid = “27D27CB8-5923-458A-80FA-6A8EC6B78CFF-CD32FA39-611C-47A7-A038-153F79AB5332” then
    actualGuid = “27D27CB8-5923-458A-80FA-6A8EC6B78CFF}-{ABCDACD1-CE3F-CA4F-9195-B15EB1DAFA5F”
    endif
    SETMIGRATIONGUID actualGuid

    All it does it change the GUID of the original object (19) to the new object (21) but only if the actual GUID in the code above is exactly the same as the new object (21). I don’t know how to make this work.

    Thanks

  • #3484

    Barry Kelly
    Participant

    As far as I can see that should work – that is basically the script I use.
    But as mentioned in Archicad-talk …

    However make sure you have the old GUID in the ‘Migration’ list – that is a different button to the ‘Forward Migration’ script. Do not have the new GUID in that list.

    Also make sure you do not have the old object in you loaded libraries. If you do the swap will not happen.

    Barry.

    Versions 6.5 to 22
    Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
    Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit

  • #3489

    Gergely Fehér
    Keymaster

    James,

    FROM_GUID always stores the main ID of your library parts – so “27D27CB8-5923-458A-80FA-6A8EC6B78CFF-CD32FA39-611C-47A7-A038-153F79AB5332” seems a bit too long, I think only the first half will be your old ID. The new main ID should be different – but in your sample it’s the same, so first change the main ID of yout object, then change the script to follow up this change from the old main ID to the new one.

    Gergely Fehér
    Team Leader, Library Team
    GRAPHISOFT SE

  • #3490

    Barry Kelly
    Participant

    As I look closer I also see your new ID has brackets in the middle – }-{
    I didn’t notice the length of the ID (yes it is too long) but I think it is the last part that is the object ID.
    Isn’t the first part the subtype?

    I always get my IDs from the MIGRATION list.
    Press the ‘NEW’ button and then ‘Browse for Migrated Object’ to get the ID.
    I also browse for the new object ID there but be sure to delete it after you copy and paste it.
    Leave the old object IDs that you want to migrate in that list.

    Barry.

    Attachments:

    Versions 6.5 to 22
    Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
    Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit

  • #3492

    James Goode
    Participant

    Thanks very much, I had to pull the GUID from the Migration list as using the second half of the sub-type guid didn’t work. All working now. 🙂

  • #4712

    James Murray
    Participant

    I have basic migration (replacement) working, but I can’t figure out how to get parameter values to transfer to new parameters. I have two simple objects, where the old one (AC21) uses the parameter ‘aSurf’ and the new one (AC22) uses the parameter ‘bSurf’. The new one doesn’t have the ‘aSurf’ parameter. Here’s the whole script:

    
    !! Main guid of old placed version of object
    actualGUID = FROM_GUID
    
    _startID =	'2BA958FF-7CD1-FF4F-BD14-865C49035B48' ! old version
    _endID =	'4B5E33FD-B9DA-514D-AA20-7ECD437126D0'	! new version
    GOSUB 100
    
    !! switch object
    SETMIGRATIONGUID actualGUID
    
    END ! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    100:
    IF actualGUID = _startID THEN
    	rrr = STORED_PAR_VALUE ("aSurf", aSurf_val) ! get value from old
    		bSurf = aSurf_val
    		PARAMETERS bSurf = bSurf ! apply to new
    
    	actualGUID = _endID
    ENDIF
    
    RETURN
  • #4713

    James Murray
    Participant

    Sorry, I hit Submit too quickly. After migration, the placed new object in the migrated project has the default ‘bSurf’ value, not the different ‘aSurf’ value as the project was saved.

  • #4714

    Péter Baksa
    Participant

    Hi,

    If I understand right, you are placing a new element in the new AC version. Element defaults aren’t migrated this way, only placed elements. The settings dialog doesn’t store the parameters of the default object, just reads the actual default values from the library. Favorites I think should be migrated.

    Péter Baksa
    Software Engineer, Library Team
    GRAPHISOFT SE

  • #4716

    James Murray
    Participant

    I have a PLN from AC21 with a placed old object. When I open this in AC22 and load the new library, the placed object is migrated to become the new version. But I am trying to get the new parameter ‘bSurf’ to contain the value of the old parameter ‘aSurf’; instead bSurf has the value of the new object’s default. In other words, the value is not migrated.

  • #4718

    Barry Kelly
    Participant

    I use DELETED_PAR_VALUE – that works for me.

    So …

    IF actualGUID = _startID THEN
    	rrr = DELETED_PAR_VALUE ("aSurf", aSurf_val) ! get value from old
    		bSurf = aSurf_val
    		PARAMETERS bSurf = bSurf ! apply to new
    
    	actualGUID = _endID
    ENDIF

    Barry.

    Versions 6.5 to 22
    Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
    Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit

  • #4719

    James Murray
    Participant

    OK, you need to turn AutoMigration off. What’s AutoMigration? Who knows, the manual is silent. Yes, I found the sole mention of it of AC-t, after I solved my own problem by chance. This Homebrew Computer Club stuff gets tiresome, tbh.

    Thanks for the help, Barry and Peter.

  • #4720

    Barry Kelly
    Participant

    It is all a bit of a mystery.
    In the GDL manual STORED_PAR_VALUE and DELETED_PAR_VALUE seem to do exactly the same thing.
    I figured I should use DELETED_PAR_VALUE if the parameter no longer exists in the new object, but I am guessing it doesn’t matter.

    I can find no reference as to what AutoMigration does, either here in the GDL Center or the Help Center.
    Or if it is there it is just hard to find.

    I have always had AutoMigration turned off, so would never noticed it is a problem.

    Also, I find it is easiest to use the ‘Migration’ section to find out the GUID of your new object.
    You need the GUID of any old objects here – just don’t forget to delete the current object GUID once you have found out what it is and pasted to the migration script.
    Otherwise the object will simply not migrate, and there will be no error messages to say why.

    Barry.

    Versions 6.5 to 22
    Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
    Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit

  • #4721

    Péter Baksa
    Participant

    Let’s quote that mention from AC-Talk here too, maybe it will be easier to find.

    Automigration is a special type for migration: it simply does an ID change, without running migration scripts. It is useful to eliminate migrations from new elements, and create step-by-step migration logic through many versions.
    _________________
    Gergely Fehér
    Team Leader, Library Team
    GRAPHISOFT SE

    Péter Baksa
    Software Engineer, Library Team
    GRAPHISOFT SE

  • #4722

    Barry Kelly
    Participant

    Automigration is a special type for migration: it simply does an ID change, without running migration scripts. It is useful to eliminate migrations from new elements, and create step-by-step migration logic through many versions.

    So to clarify, if we just want to migrate objects with no parameter changes, we just add the old object GUID to the list and turn on AutoMigration.
    It will ignore anything in the migration script.

    Here is the link to the actual post Peter has quoted from Greg.
    I had forgotten I was even a part of that conversation. (insert embarrassed face emoji here).

    https://archicad-talk.graphisoft.com/viewtopic.php?f=6&t=58220&p=274105&hilit=automigration#p274105

    Thanks Peter and Greg.

    Barry.

    Versions 6.5 to 22
    Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
    Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit

  • #4723

    James Murray
    Participant

    With Auto on, if the script is ignored, how does it know what new object to migrate the listed item to?

  • #4725

    Péter Baksa
    Participant

    The migration is always run in the newer version of AC, on the new object. The old one doesn’t know anything about the new one. Old libpart GUIDs are listed in the migration table. When a library is loaded, all libparts’ migration tables are read and checked against placed objects.
    Backward migration happens when saving as previous version .pln: the parameter list is saved with the GUID in the migration table listed at that version.
    Some information about migration can be shown: in the Library Developer Menu select Log the Migration Process (then re-open the non-migrated file).

    Péter Baksa
    Software Engineer, Library Team
    GRAPHISOFT SE

You must be logged in to reply to this topic.