We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.
SOLVED!

Forward Migration Script & Favourites

scottjm
Advisor

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

 

 

 

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe
2 ACCEPTED SOLUTIONS

Accepted Solutions
Solution
Peter Baksa
Graphisoft
Graphisoft

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.

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

View solution in original post

Solution
scottjm
Advisor

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

 

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe

View solution in original post

5 REPLIES 5
Barry Kelly
Moderator

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.

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
runxel
Legend

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. ¯\_(ツ)_/¯

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
scottjm
Advisor

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.

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe
Solution
Peter Baksa
Graphisoft
Graphisoft

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.

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
Solution
scottjm
Advisor

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

 

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!