Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Forward Migration to Multiple Objects. Help.

JGoode
Expert
Hello, I am trying forward migrate to enable an old object to change to a new version of the object. The forward migration works but it will only migrate to the variation of the object. For example I have one object with 6 different options inside, I have made 6 new separate objects and when the migration happens, I want it to choose the right object to migrate to but it isn't currently. When I pick option '4' I want it to pick the 4th object but it is only choosing the first option.
actualGuid = FROM_GUID

if (test = t1) then
	IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then
	
		actualGuid = "6A6F3D13-EA87-41D7-86DD-34A6E0C08B83"
	endif
else
	if (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then
	
		actualGuid = "861BD837-D86A-4752-9462-A564141EA066"
	endif
endif
SETMIGRATIONGUID actualGuid
This code didn't work :S

edit: just tried putting the 2nd part before the first and that didn't work, so it can't be the order of the code.

edit 2: It seems to do it in order of file name, does anyone know how to get this to work?
ArchiCAD 23

Windows 10
11 REPLIES 11
Barry Kelly
Moderator
They all originate from the same object (same GUID) so it is the option parameter you need to check.
I don't know what your parameters are but you will want to do something like this.

IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then

xx = DELETED_PAR_VALUE ("option", option_new)  !!this will check for the original option value and temporarily set it in this new object.

if option_new = 1 then
actualGuid = "6A6F3D13-EA87-41D7-86DD-34A6E0C08B83" 
endif

ENDIF
Repeat this in the other five object looking for the different 'option' values and setting the correct final GUID.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
JGoode
Expert
Barry wrote:
They all originate from the same object (same GUID) so it is the option parameter you need to check.
I don't know what your parameters are but you will want to do something like this.

IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then

xx = DELETED_PAR_VALUE ("option", option_new)  !!this will check for the original option value and temporarily set it in this new object.

if option_new = 1 then
actualGuid = "6A6F3D13-EA87-41D7-86DD-34A6E0C08B83" 
endif

ENDIF
Repeat this in the other five object looking for the different 'option' values and setting the correct final GUID.

Barry.
This is what I have in my script;
actualGuid = FROM_GUID

IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then 
	xx = DELETED_PAR_VALUE ("test", t1)  !!this will check for the original option value and temporarily set it in this new object. 
	
	if t1 = 1 then 
		actualGuid = "6A6F3D13-EA87-41D7-86DD-34A6E0C08B83" 
	endif 
ENDIF

IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then 
	xx = DELETED_PAR_VALUE ("test", t2)  !!this will check for the original option value and temporarily set it in this new object. 
	
	if t2 = 1 then 
		actualGuid = "861BD837-D86A-4752-9462-A564141EA066" 
	endif 
ENDIF
It doesn't seem to work.

my parameters are defined like this
t1 = "1"
t2 = "2"
VALUES "test" t1, t2
Edit: Even when I comment out the t1 part of the script, it still migrates to that object. I'm puzzled.
ArchiCAD 23

Windows 10
Barry Kelly
Moderator
actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A" is your original object which you seem to be finding OK.

You then have 6 other objects (or in this case two test objects).

Each object must have its own migration script looking for the original GUID and then changing it to the GUID of the new separate object.

You just need to test the old object to find the 'test' parameter value and if it is the correct one then migrate it to the new GUID of the new object.
So you only need new GUID for that particular new object in the script (of the new object).
Having the GUID of the other objects is not required - each must have its own script.


So in object one have ...
actualGuid = FROM_GUID 

IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then 
   xx = DELETED_PAR_VALUE ("test", t1)  !!this will check for the original option value and temporarily set it in this new object. 
    
   if t1 = 1 then 
      actualGuid = "6A6F3D13-EA87-41D7-86DD-34A6E0C08B83" 
   endif 
ENDIF
and in object 2 have ...
actualGuid = FROM_GUID 

IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then 
   xx = DELETED_PAR_VALUE ("test", t2)  !!this will check for the original option value and temporarily set it in this new object. 
    
   if t2 = 1 then 
      actualGuid = "861BD837-D86A-4752-9462-A564141EA066" 
   endif 
ENDIF
Also make sure you only have the GUID of the old object in the migration list (not the new object GUID) and also make sure the old object is not in your loaded library, otherwise the migration will not happen.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
JGoode
Expert
Barry wrote:
actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A" is your original object which you seem to be finding OK.

You then have 6 other objects (or in this case two test objects).

Each object must have its own migration script looking for the original GUID and then changing it to the GUID of the new separate object.

You just need to test the old object to find the 'test' parameter value and if it is the correct one then migrate it to the new GUID of the new object.
So you only need new GUID for that particular new object in the script (of the new object).
Having the GUID of the other objects is not required - each must have its own script.


So in object one have ...
actualGuid = FROM_GUID 

IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then 
   xx = DELETED_PAR_VALUE ("test", t1)  !!this will check for the original option value and temporarily set it in this new object. 
    
   if t1 = 1 then 
      actualGuid = "6A6F3D13-EA87-41D7-86DD-34A6E0C08B83" 
   endif 
ENDIF
and in object 2 have ...
actualGuid = FROM_GUID 

IF (actualGuid = "BF01EC6E-D872-48E4-BB8D-A59B1634557A") then 
   xx = DELETED_PAR_VALUE ("test", t2)  !!this will check for the original option value and temporarily set it in this new object. 
    
   if t2 = 1 then 
      actualGuid = "861BD837-D86A-4752-9462-A564141EA066" 
   endif 
ENDIF
Also make sure you only have the GUID of the old object in the migration list (not the new object GUID) and also make sure the old object is not in your loaded library, otherwise the migration will not happen.

Barry.
This is very helpful! Only one last question, what do I put in the original object forward migration script if those 2 have to go in the new objects
ArchiCAD 23

Windows 10
Barry Kelly
Moderator
JGoode wrote:
This is very helpful! Only one last question, what do I put in the original object forward migration script if those 2 have to go in the new objects
Nothing.
You won't have the old original object in your library anymore (you will have deleted it) so there is no need to do anything in its migration scripts.
All you need is its GUID in the script for the new objects, so when you open a file that has an instance of the original object with that old GUID, the new object will replace it.
Only the new object that has the correct 'test' parameter value that matches the original object settings will replace the old object.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
JGoode
Expert
Barry wrote:
JGoode wrote:
This is very helpful! Only one last question, what do I put in the original object forward migration script if those 2 have to go in the new objects
Nothing.
You won't have the old original object in your library anymore (you will have deleted it) so there is no need to do anything in its migration scripts.
All you need is its GUID in the script for the new objects, so when you open a file that has an instance of the original object with that old GUID, the new object will replace it.
Only the new object that has the correct 'test' parameter value that matches the original object settings will replace the old object.

Barry.
I've tried it as you said. Still nothing. Have you tried this previously or is it just 'in theory'? It only picks up the first object and doesn't change to the second at all.
ArchiCAD 23

Windows 10
Barry Kelly
Moderator
I do this quite often (migrating objects) - although I can't say I have split on object into 6 others.

Make sure you delete the original object from your library (after you have the GUID).
If it is still loaded then it will not get replaced by the new objects.

Also make sure the new GUID is not in the migration list.
That should only have the old object GUID - it didn't used to matter but since version 19 or 20 it does and will stop the objects from swapping.

My understanding is when Archicad determines an object is missing (i.e. no longer in the loaded library) it uses the GUID of that missing object (Archicad still has this information in its database) and searches other objects in the loaded library and looks in the migration list for the missing GUID.
If it finds it then it uses the Forward Migration script to do what you want - setting parameters and swapping the object.

Maybe it has something to do with the fact you are splitting one object into many different ones so it is finding the GUID in more than one new object - as I say I have never tried to do this.
But I am 99% certain it should still work.
I would have to test it to be sure or you could attach you test objects (and original object) here in a zip file and I could have a look at them.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
JGoode
Expert
Barry wrote:
I do this quite often (migrating objects) - although I can't say I have split on object into 6 others.

Make sure you delete the original object from your library (after you have the GUID).
If it is still loaded then it will not get replaced by the new objects.

Also make sure the new GUID is not in the migration list.
That should only have the old object GUID - it didn't used to matter but since version 19 or 20 it does and will stop the objects from swapping.

My understanding is when Archicad determines an object is missing (i.e. no longer in the loaded library) it uses the GUID of that missing object (Archicad still has this information in its database) and searches other objects in the loaded library and looks in the migration list for the missing GUID.
If it finds it then it uses the Forward Migration script to do what you want - setting parameters and swapping the object.

Maybe it has something to do with the fact you are splitting one object into many different ones so it is finding the GUID in more than one new object - as I say I have never tried to do this.
But I am 99% certain it should still work.
I would have to test it to be sure or you could attach you test objects (and original object) here in a zip file and I could have a look at them.

Barry.
Well I have only been trying it on a test object with 2 objects rather than 6. I've attached a zip containing the objects. Thanks for your help.
ArchiCAD 23

Windows 10
JGoode
Expert
Thanks for all the help, Barry. It works excellently with my main object! When migrating from ArchiCAD 19 to ArchiCAD 21, is there any need to put anything in the forward migration script in the old object? It seems as though it will work without anything in the forward migration script and just with the old object in the 'Migration' tab in the gdl editor?
ArchiCAD 23

Windows 10