2017-10-02 05:33 PM
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 actualGuidThis code didn't work :S
2017-10-03 09:27 AM
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 ENDIFRepeat this in the other five object looking for the different 'option' values and setting the correct final GUID.
2017-10-03 11:04 AM
Barry wrote:This is what I have in my script;
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 ENDIFRepeat this in the other five object looking for the different 'option' values and setting the correct final GUID.
Barry.
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 ENDIFIt doesn't seem to work.
t1 = "1" t2 = "2" VALUES "test" t1, t2Edit: Even when I comment out the t1 part of the script, it still migrates to that object. I'm puzzled.
2017-10-03 11:27 AM
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 ENDIFand 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 ENDIFAlso 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.
2017-10-03 12:39 PM
Barry 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
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 ENDIFand 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 ENDIFAlso 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.
2017-10-04 03:05 AM
JGoode wrote:Nothing.
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
2017-10-04 11:21 AM
Barry wrote: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.JGoode wrote:Nothing.
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
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.
2017-10-04 11:44 AM
2017-10-04 11:55 AM
Barry wrote: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.
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.
2017-10-05 05:20 PM