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

Copy Parameters to another parameters

Anonymous
Not applicable
Hi Everyone,

I wonder how I could copy my Parameter "Article_no" to "FM_SerialNumber"
And I wish to have same information in Both even if I fill in "FM_SerialNumber" it should effekt "Article_no".


I know this is not the way, and this is not the way...
Article_no = FM_SerialNumber
FM_SerialNumber = Article_no
Do anyone understands what I want?
6 REPLIES 6
Barry Kelly
Moderator
How about ...
if GLOB_MODPAR_NAME = "Article_no" then
FM_SerialNumber = Article_no
PARAMETERS FM_SerialNumber = FM_SerialNumber
endif

if GLOB_MODPAR_NAME = "FM_SerialNumber" then
Article_no = FM_SerialNumber 
PARAMETERS Article_no = Article_no
endif
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
Anonymous
Not applicable
Barry wrote:
How about ...
if GLOB_MODPAR_NAME = "Article_no" then
FM_SerialNumber = Article_no
PARAMETERS FM_SerialNumber = FM_SerialNumber
endif

if GLOB_MODPAR_NAME = "FM_SerialNumber" then
Article_no = FM_SerialNumber 
PARAMETERS Article_no = Article_no
endif
Barry.
Well Barry I could hug you right now! Thanks alot!

What should I read to become a master of GLD?
Gergely Feher
Graphisoft
Graphisoft
It' better to use it in the following form:
if GLOB_MODPAR_NAME = "param1" then
    param2 = param1
    parameters param2 = param2
else
    param1 = param2
    parameters param1 = param1
endif
This method forces the linking of parameters - if any other parameters changed by another function or addon.

To read more about GDL, you should check GDL Center at gdl.graphisoft.com.
_________________
Gergely Fehér
Team Leader, Library Team
GRAPHISOFT SE
Barry Kelly
Moderator
Gergely wrote:
It' better to use it in the following form:
if GLOB_MODPAR_NAME = "param1" then
    param2 = param1
    parameters param2 = param2
else
    param1 = param2
    parameters param1 = param1
endif
This method forces the linking of parameters - if any other parameters changed by another function or addon.

Is this really better?
This would mean if I adjust param3, param4, param5, etc., then param1 is always going to be forced to equal param2 (which it should already be).
Params 3, 4, 5, etc., probably have nothing to do with the other two so why make the script perform more computations than it needs to every time any parameter is changed?
I know we are talking nano-seconds in computing time but is there really a need to do it?


As for learning GDL the reference manual (and now GDL Centre) are fine ut lack examples.
I still find the GDL Cookbook by David Nicholson-Cole is quite good - although a little out-dated now.
It explains things quite well and has example objects you can make.
Google it or search in this forum for links.

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
Gergely Feher
Graphisoft
Graphisoft
Barry,

I think that the "if GLOB_MODPAR_NAME then ... else ... endif" method is much better, as in my mind the most important role of parameter script is to keep the consistency between an objects parameters. Without forcing parameter linking, you can have problems with changing parameters with multiple selection or parameter transfer.

About the speed I don't think that my method is slower than yours, as in your solution there is always 2 string comparisons in the 2 "if GLOB_MODPAR_NAME ..." lines - and string comparisons are a quite slow thing in any programming languages.

If you have any questions about a specific topic, please send your requests to us via the GDL center's forum or by mail - we try to answer as many problems as possible in the Tips&Tricks section of the site.
_________________
Gergely Fehér
Team Leader, Library Team
GRAPHISOFT SE
Nader Belal
Mentor
Barry wrote:
Gergely wrote:
It' better to use it in the following form:
if GLOB_MODPAR_NAME = "param1" then
    param2 = param1
    parameters param2 = param2
else
    param1 = param2
    parameters param1 = param1
endif
This method forces the linking of parameters - if any other parameters changed by another function or addon.
Hi to all,

First I want to thank everyone here, without you I wouldn't have grasped the GLOB_MODPAR_NAME

Second, for the people who will ask theirselves how to apply the same idea for more than 2 parameters, just follow the same block and repeat for every parameter you want to link
Capture.JPG
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.