We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-11-23 11:14 PM - last edited on 2024-09-26 01:32 PM by Doreena Deng
So I have made some modifications to some objects used across our office.
I have used the forward migration to migrate the object to the newer version with a new guid and to trigger a param to be turned on to allow a legacy part of the code to remain running, so as not to unintentionally break instances of the object that have already been placed in projects.
Below is a copy of the migration script I am using
The issue I have is that this then turns that parameter on in favourites saved within our template that utilise this object - which I don't want. And to reverse this I would have to open up every project that was created with that template and manually modify the favourite.
Is there a way to identify when the migration script is being run on a Favourites, so I can skip that part of the code?
Thanks,
Scott
actualGUID = FROM_GUID
! ==============================================================================
! Subroutines
! ==============================================================================
_startID = "2913993A-47ED-4789-9C9F-98EBB2D2315E" !! FTA Generic Label_23
_endID = "767AAD6E-D907-4DA2-84E5-165B3F42C5E2"
gosub "migrationstepname_FWM_FTA Generic Label_23"
setmigrationguid actualGUID
end !!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!
!!! migrationstepname
"migrationstepname_FWM_FTA Generic Label_23":
if actualGuid = _startID then
parameters cut_fill_legacy = 1 ! maintain reading of the cut fill on objects for older jobs
actualGuid = _endID
endif
return
Solved! Go to Solution.
2023-12-08 03:07 PM
Hi,
favorites and not yet placed element can be distinguished by their GLOB_INTGUID, which is either "" or "{00000000-0000-0000-0000-000000000000}".
However I am not sure it works in fwm script for placed objects.
2023-12-11 02:36 AM
Thanks so much Peter, that is exactly what I needed. That works perfectly. 😊
I add this line to my forward migration script:
if GLOB_INTGUID = "" then
parameters cut_fill_legacy = 0
endif
So my full migration script looks like this now:
actualGUID = FROM_GUID
! ==============================================================================
! Subroutines
! ==============================================================================
_startID = "2913993A-47ED-4789-9C9F-98EBB2D2315E" !! FTA Generic Label_23
_endID = "767AAD6E-D907-4DA2-84E5-165B3F42C5E2"
gosub "migrationstepname_FWM_FTA Generic Label_23"
setmigrationguid actualGUID
!! SET THE LEGACY PARAMETERS FOR FAVOURITES TO BE OFF
if GLOB_INTGUID = "" then
parameters cut_fill_legacy = 0
endif
end !!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!
!!! migrationstepname
"migrationstepname_FWM_FTA Generic Label_23":
if actualGuid = _startID then
parameters cut_fill_legacy = 1 ! maintain reading of the cut fill on objects for older jobs
actualGuid = _endID
endif
return
2023-11-24 03:15 AM
I have done a similar thing, a boolean parameter in my migrated objects to say it has been migrated, and will continue using the old code until that boolean is turned off.
But in answer to your question, all favourites saved before the migration of the objects do not have that parameter.
When the object is migrated, the favourite will also use the migration script to update the object used, and so will set that migration boolean to be on.
Not much you can do about it, except as you noted, update your favourites.
I have not found a way to determine the object is being place by a favourite.
The kind of good news is, you don't need to edit each favourite one by one in every file you open.
You have to do it once, in your template (or any other file).
Then you can import the favourites on-masse or just the ones you want from that template file.
Probably good to import all favourites from your template so you know you have the latest favourites in your files.
Barry.
2023-11-25 12:16 AM
The only thing somewhat related to favorites is GLOB_PREVIEW_MODE (with value = 3), but I doubt it will help in this case...
You might try, tho. ¯\_(ツ)_/¯
2023-11-26 11:51 PM
Thanks for your responses guys. That's what I suspected. I considered the GLOB_PREVIEW_MODE, maybe I can hack something to remove those param flags when the object is placed using that.
2023-12-08 03:07 PM
Hi,
favorites and not yet placed element can be distinguished by their GLOB_INTGUID, which is either "" or "{00000000-0000-0000-0000-000000000000}".
However I am not sure it works in fwm script for placed objects.
2023-12-11 02:36 AM
Thanks so much Peter, that is exactly what I needed. That works perfectly. 😊
I add this line to my forward migration script:
if GLOB_INTGUID = "" then
parameters cut_fill_legacy = 0
endif
So my full migration script looks like this now:
actualGUID = FROM_GUID
! ==============================================================================
! Subroutines
! ==============================================================================
_startID = "2913993A-47ED-4789-9C9F-98EBB2D2315E" !! FTA Generic Label_23
_endID = "767AAD6E-D907-4DA2-84E5-165B3F42C5E2"
gosub "migrationstepname_FWM_FTA Generic Label_23"
setmigrationguid actualGUID
!! SET THE LEGACY PARAMETERS FOR FAVOURITES TO BE OFF
if GLOB_INTGUID = "" then
parameters cut_fill_legacy = 0
endif
end !!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!
!!! migrationstepname
"migrationstepname_FWM_FTA Generic Label_23":
if actualGuid = _startID then
parameters cut_fill_legacy = 1 ! maintain reading of the cut fill on objects for older jobs
actualGuid = _endID
endif
return