License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Adding multiple Objects to GSM Object?

MikeRaats_FOX
Participant

Hi, I am trying to create a new light switch object that works with my Electrical Legend ( I know there is one created in archicad, but it doesnt work the way I would like) I am trying to create one object that can switch between 1, 2, 3 & 4 switches. I have created the. '1 switch' but cannot work out how to add the others in.

I have attached a screen grab on another object I have that shows what I am trying to achieve, any help would be greatly appreciated.

 

Screenshot 2023-08-31 at 9.09.23 am.png

AC 26 - 5003 INT-FULL (Apple Silicone)
Maco OS Ventura 13.4 | MacBook Pro 2022 | 16Gb
4 REPLIES 4
Barry Kelly
Moderator

If you want multiple choices, then it is not a matter of just saving a selection to create an object.

You will need to get into scripting.

You can use FRAGMENTs if there are just a few options - one fragment for each 2D symbol, you can have up to 16 fragments.

But if there are going to be many then you will need to start using sub-routines for each type.

 

If you can script in GDL, you should know what I am talking about.

If you can't script in GDL, prepare to put in a fair few hours to learn.

 

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

Add parameter in "Parameters" as in the snip attached.
Add below line to your "Parameter" script:

 

VALUES "switchType" "1 Switch", "2 Switch", "3 Switch", "4 Switch"


From here in 2D and 3D script you can use gosub

GOSUB switchType
END

"1 Switch":
!your code
RETURN

"2 Switch":
!your code
RETURN

 

Screenshot 2023-08-31 162525.jpg

 

Screenshot 2023-08-31 163143.jpg

  

baixiaodong
Booster

Friend: This is my appropriate editing based on the built-in switch of AC, according to Chinese standards, which may meet your requirements for your reference

MF BIM
Enthusiast

Hi @MikeRaats_FOX ,

 

Adding to all the replies, you could also do an ENUM style scripting.

 

1. Using an integer type parameter that we'll call "type_Switch"

 

2. In Main script, we create the variables to integers and use an array to label them easily

 

SWITCH_1 = 1
SWITCH_2 = 2
SWITCH_3 = 3
SWITCH_4 = 4

dim name_SWITCH[4]
	name_SWITCH[1] = "Name of switch 1"
	name_SWITCH[2] = "Name of switch 2"
	name_SWITCH[3] = "Name of switch 3"
	name_SWITCH[4] = "Name of switch 4"

 

 

3. In Parameter script, we link the integers to the labels

 

values{2} "type_Switch"	SWITCH_1, name_SWITCH[SWITCH_1],
						SWITCH_2, name_SWITCH[SWITCH_2],
						SWITCH_3, name_SWITCH[SWITCH_3],
						SWITCH_4, name_SWITCH[SWITCH_4]

 

 

4. In the 2D and/or 3D scripts, we go to the part of the code according to the value of the type_Switch parameter :

 

gosub 10000 + type_Switch ! adding 10000 to give the switch choices a unique ID

end

10001: ! 10000 + SWITCH_1
    ! Code for 1st switch
return

10002: ! 10000 + SWITCH_2
    ! Code for 2nd switch
return

...

 

 

https://mfbim.fr | https://youtube.com/@mfbim | https://bsky.app/profile/mfbim.fr
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro