GDL
About building parametric objects with GDL.
SOLVED!

Saved GDL object has script that differs from original

BenjiDev
Enthusiast

Hello, 

I have created a very simple GDL object. It currently only contains a 2D script that allows the user to modify a couple of points using hotspots:

 

FOR i=1 TO VARDIM1(points) STEP 1
	_id = i * 6

	HOTSPOT2  points[i][1],  0, 		  i+0, points[i][2], 1 + 128 	! BASE
	HOTSPOT2  points[i][1],  0, 		  i+1, points[i][2], 3	     	! REFERENCE
	HOTSPOT2  points[i][1], points[i][2], i+2, points[i][2], 2		 	! MOVING

	HOTSPOT2  0,  			points[i][2], i+3, points[i][1], 1 + 128 	! BASE
	HOTSPOT2  0,  			points[i][2], i+4, points[i][1], 3	     	! REFERENCE
	HOTSPOT2  points[i][1], points[i][2], i+5, points[i][1], 2		 	! MOVING
	
	IF i < VARDIM1(points) THEN
		LINE2 points[i][1], points[i][2], points[i+1][1], points[i+1][2]
	ENDIF
NEXT i

 

In Action:

BenjiDev_0-1655506185874.png

Then i save the object to disk File -> Libraries and Objects -> Save Selection as... -> Object

(Selecting browse instead of embedded library)

 

When opening the saved .gsm file again the 2D script has changed (compared to the code that I posted above):

 

!
!   Name     : test.gsm
!   Date     : Saturday, June 18, 2022
!   Version  : 25.00
!   Written by Archicad 
!

mul2     A/13.599278, B/5.216145
add2     29.01578502415, -36.78886568381
drawindex      10
pen     penAttribute_1
set line_type lineTypeAttribute_1
add2     -30.01578502415, 35.78886568381
DIM	tmp_points[3][2]
        tmp_points[1][1] =            1
        tmp_points[1][2] =            1
        tmp_points[2][1] = 4.205397216681
        tmp_points[2][2] = 6.216144840519
        tmp_points[3][1] = 14.59927750822
        tmp_points[3][2] = 1.3551285825
call    "road",
    PARAMETERS A =            1, B =            1, ZZYZX =            1,
        AC_show2DHotspotsIn3D =      1, ac_bottomlevel =            1,
        ac_toplevel =            0, points = tmp_points
del          1

 

How can i tell Archicad not to mess with the scripts (2D in this case) when the object is saved to disk?

 

Thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Solution
BenjiDev
Enthusiast

I found the solution to instead move the GSM object from the embedded library to a folder on the disk using the Libraries and Objects dialog under "File".

View solution in original post

Solution
Barry Kelly
Moderator

Yes, you have saved an already existing object as an object, so what you will find in that 'saved' object, it will be 'CALL'ing your original object.

 

Yes, you just need to go to the Library Manager and save a copy of you object from the embedded library to an external folder.

Or when you initially create the GDL and 'save' for the first time, you can choose to brows for a folder to save it in rather than the embedded library.

That folder will need to be a loaded library folder for you to be able to use the object.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

View solution in original post

4 REPLIES 4
Solution
BenjiDev
Enthusiast

I found the solution to instead move the GSM object from the embedded library to a folder on the disk using the Libraries and Objects dialog under "File".

Karl Ottenstein
Moderator

Is this 2D script replacement when saving to the embedded library reproducible?  The script you show is an auto-script typically generated by dragging 2D content into the 2D script window of the object... but definitely a bug if anything causes your own scripts to be replaced.

 

One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB

I think with my first approach the object was just saved "stupidly", almost like a picture of it was taken and serialized without saving any "logic". I guess you maybe want this in some cases? But i managed to solve it with in my other reply

Solution
Barry Kelly
Moderator

Yes, you have saved an already existing object as an object, so what you will find in that 'saved' object, it will be 'CALL'ing your original object.

 

Yes, you just need to go to the Library Manager and save a copy of you object from the embedded library to an external folder.

Or when you initially create the GDL and 'save' for the first time, you can choose to brows for a folder to save it in rather than the embedded library.

That folder will need to be a loaded library folder for you to be able to use the object.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11