Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Novice GDL question - which 3D object type to use?

Jim Allen

Apologies if this has been covered elsewhere, I've been looking at a lot of GDL posts and documentation, and I've both learned a lot and been very confused, probably both in equal measure.


I want to create an object which is in effect a 2D and 3D gradient labelling tool. I want to insert it onto a mesh, and then stretch the length and rotate as required, then go to the 3D window and use a hotspot to anchor the non-base end of the symbol to a point on the mesh to give me the z height difference to calculate the slope, and have the gradient displayed in 2d and/or 3D with options for angle, percentage or slope ratio.


The purpose of this object is twofold, the first is simply to label gradients in 3D. Where I work, most of my sites have slopes and gradients. I often have deal with site gradients and cut and fill, so use terrain modelling on most projects. Designing ramps is a ball-ache, and they are expensive and ugly to construct. If I can design them out, so much the better.


Any slope shallower than 1:20 is a 'gradient path' and doesn't need all the complexity of a ramp.


I like to use meshes in 3D and push and pull the nodes to shape the terrain as part of my design approach. Having a tool like this would actually make the design process a lot easier because I could push and pull my mesh, adjust the label and check compliance. 


I started with the Archicad Slope 25 symbol which I have duplicated and edited. This is a screenshot of the modified object:

Screenshot 2023-01-13 at 10.49.53.png


This is broadly how it's scripted:


Screenshot 2023-01-12 at 16.25.24.png

 So far so good. I can take the values for the polyline and hotspots and translate them to 3D, and hopefully that will work except I'm not sure which script to use.


What I in effect want is to be able to define a 'slab' which will rotate in 3d (or 'tilt') when I move the editing hotspot in the z axis, so it looks something like this:


Screenshot 2023-01-13 at 10.27.20.png

Without the circles and labels obviously.


The 3D text will be in a similar position to the 2D text if things work out - but inclined in the plane of the arrow. I want the 2D and 3D appearance to be ostensibly the same.


There is a lot of information on GDL, but not all of it is clear, simple and comprehensive, and it doesn't seem to tell you what the properties of them all are, and what their limitations are, and what they are best suited to.


Should I use a PRISM for this, or can I use an EXTRUDE instead? I just want to translate the 2d xy coordinates to 3D (because it seems easiest and I'm very new at this, and still a bit of a GDL idiot) and have the geometry update itself when I move the 3d hotspot.


Alternatively - is there a better option available that I have missed. Aligning the 3d text will require some head-scratching, but one thing at a time.


Any help and guidance would be greatly appreciated!

Archicad 25 UKI | OS X 11.7 Big Sur

Not a bad suggestion at all, but it has no 3d labelling, no ability to have the gradient defined by a 3d hotspot, the shape isn't really an arrow, and it has no 3d label!


It's a lot more complicated, so I'm not going to be able to decode the script easily.


Great idea though!

Archicad 25 UKI | OS X 11.7 Big Sur

working fine no problem, prism is the most simply solution, have a nice day

simple prisma.png

Jim Allen

I'm really struggling with this.


I can create the 2d geometry and text and hotspot, but I just can't script hotspot 2 so I can move it in the Z direction.

This is what I'm trying to do:


Screenshot 2023-01-16 at 18.15.25.png

Calculating the angle/gradient is easy enough, but I can't work out how to get what I have labelled as Hotspot E to be editable in the Z direction, and then I would have to read the Z coordinate to create the text value and 3d text rotation angle.


I really don't want to script the 3d geometry nodes by calculating them all. That's more mathematics than I have done for over 40 years, and I can do without that cognitive stress!


I'm not angling for someone to write the whole script for me, I won't learn much that way. 


This is what my 3d script looks like:

	HOTSPOT 0,0,0,unID :	unID=unID+1

	HOTSPOT 0,0, 0,		unID,	a,	1+128+256 :unID=unID+1 !base
	HOTSPOT a,0,0,		unID,	a,	2 :unID=unID+1		!moving
	HOTSPOT -1,0,0,		unID,	a,	3 :unID=unID+1	!reference

LIN_ 0,0,0,	A,0,0
HOTLINE 0,0,0,	A,0,0, unID :unID=unID+1

!extrude  6,      1+2+4+16+32+64+128,      
!       0, 		0,     	0, 
!       B/2, 		-B/2, 	1,
!       A-(B/2),	-B/2, 	1, 
!	A,		0,	1,
!       A-(B/2),	B/2, 	1, 
!	B/2,		B/2,	-1

!PRISM_  6,      0.005,      
!       0, 		0,     	15, 
!       B/2, 		-B/2, 	15,
!       A-(B/2),	-B/2, 	15, 
!	A,		0,	15,
!       A-(B/2),	B/2, 	15, 
!	B/2,		B/2,	15

!PRISM_ 	7, 	0.01,
!		0,	0,		15,
!		B/2, 	B/2, 	15,
!		A-B/2, 	-B/2, 	15,
!		A, 	0, 		15,
!		A-B/2,	B/2, 	15,
!		B/2, 	B/2, 	15,
!		0, 	0, 		15

!poly  6,          
!       0, 		0,
!       B/2, 		-B/2,
!       A-(B/2),	-B/2,
!	A,		0,
!       A-(B/2),	B/2,
!	B/2,		B/2

!SLAB  6,      0.005,      
!       0, 		0,     	0, 
!       B/2, 		-B/2, 	0,
!       A-(B/2),	-B/2, 	0, 
!	A,		0,	0,
!       A-(B/2),	B/2, 	0, 
!	B/2,		B/2,	0

!TUBE{2} surf_3d, surf_3d, surf_3d,				!define surfaces
!	6, 			1, 		1+2+16+32,	!no of nodes in xy, no of nodes to extrude, mask
!        0, 		0,     	0, 	surf_3d,	
!        B/2, 		-B/2, 	0, 	surf_3d,
!        A-(B/2),	-B/2, 	0,  	surf_3d,
!	 A,		0,	0, 	surf_3d,
!        A-(B/2),	B/2, 	0,  	surf_3d,
!        B/2,		B/2,	0, 	surf_3d,
!        0,		0,	0.01, 	0

!SWEEP	6,	1,	0,	1,	1+2+4+16+32,
!       0, 		0,		0,
!       B/2, 		-B/2,	0,
!       A-(B/2),	-B/2,	0,
!	A,		0,		0,
!        A-(B/2),	B/2,	0,
!	B/2,		B/2,	0,
!	0,		0,	0	

CROOF_ surf_3d, surf_3d, surf_3d,				!define surfaces
		7,										!no of nodes in xy
		0, 			0,							!direction vector start
		A,			0,							!direction vector end
		0,										!height of defining edge at bottom
		90,										!angle perp to bottom
		0.005,						 			!extruded thickness
        0, 		0,     	0, 	15,	
        B/2, 		-B/2, 	0, 	15,
        A-(B/2),	-B/2, 	0,  	15,
	A,		0,	0, 	15,
        A-(B/2),	B/2, 	0,  	15,
	B/2,		B/2,	0, 	15,
        0,		0,	0.01, 	-1

Addz 0.0055
Addx A/2
	ROTY 0	
    style "3D_text_style"
    pen tpen
 	material tpen_3d
	leveltxt = txt_prefix + " " + txt_suffix		! add prefix to 3d text
	txtwidth = STW (leveltxt)/1000	
	pen   tpen_3d
    text  0, 0, txt_prefix + " " + Grad_type   	! draw text in 3D

I make no apologies for showing the 3d geometry options I have tried. Most work, but they are based on the incorrect assumption that I can drag the second hotspot in the z axis, and the geometry will 'look after itself'.


This may well be wrong, but I can't tell because I can't drag the hotspot in the z axis!


Archicad 25 UKI | OS X 11.7 Big Sur

ok , i got the whole idea, sorry for don't understand in the past , let me help you, give me a time please

You need kinda simple trigonometry

basic slope 


AC 22, 24 | Win 10


The math for your 3 hotspots if you wish to go that way;


x =  ( ramp_length ) * cos ( angle_off_horizontal )           ! cosΘ = A / H

y = ( ramp_length ) * sin ( angle_off_horizontal )             ! sinΘ = O / H

z =  ( ramp_length ) * tan ( ramp_slope )                          ! tanΘ = O / A


Since you are wanting to insert x, y and z then use that to get your slope and rotate your object you can start with the following;


ramp_length = sqr ( x^2 + y^2 )               ! pythagoras

ramp_slope = atn ( z / ramp_length )     ! tanΘ = O / A rearranged

angle_off_horizontal = atn ( y / x )         ! tanΘ = O / A rearranged





ps. You will need a hotspot for each axis you wish to move along. When stacked on top of each other, they will act as one with the correct math.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

@Jim Allen If you are struggling with your Hotspots, have you considered preceding them using the ROT / ROT2 and ADD / ADD2 commands to simplify their placement & values e.g. in 3D use ADD a, b/2, 0 and ROTy 90 to set up your 3D Z hotspot using the same syntax as A, or shorter coding can be achieved omitting the ROTy & putting the right values in for the Z hotspot values. I find removing complex value entries from the Hotspot values reduces not-so-obvious user typo errors.

Apple iMac macOS Ventura / AC26UKI (most recent builds)



A few suggestions to help simplify your moving hotspot code:


1. Rather than trying to increment the unique IDs (unID), just hard code them. You could use 101, 102 and 103 so they correspond to the types of moving hotspots you need here. This would eliminate the unID as a variable and the :unID=unID+1 from your code.


 2. Your hotspot should be moving in the Z direction, so your coding should be using the 3rd Hotspot variable (Hotspot x, y, Z, unID, paramReference, flag).


This will probably be the hardest part of the coding, but once you get it working it will be a great reference for the other 3D aspects of your object: the 3D hotspot will show you where the end of the slab and 3D text need to be.


Thanks for adding your signature.



David Maudlin / Architect

Digital Architecture

AC26 USA • iMac 27" 4.0GHz Quad-core i7 | 24 gb ram • MacBook Pro 2.8GHz | 16 gb ram • OSX10.15.7

do you want the 3d label measure same distance in plan view even if it's rotated?


That object is really helpful  - thanks a lot!


I've been working through it and although it's simple in the sense of few lines of script - I don't really understand it!


For example, this I kind of understand: 


	hotspot 0, 0, 0

	hotspot 0, 0, ZZYZX, hsID=hsID+1, A, 1+128
	hotspot A, 0, ZZYZX, hsID=hsID+1, A, 2
	hotspot -1, 0, ZZYZX, hsID=hsID+1, A, 3


You have scripted the zzyzx as the z coordinate. I'm not sure how this relates to the object origin. Is it the default z coordinate of the initial object position?


This section I guess places the second hotpot which is movable in the z direction:



	hotspot A, 0, 0, hsID=hsID+1, ZZYZX, 1+128
	hotspot A, 0, ZZYZX, hsID=hsID+1, ZZYZX, 2
	hotspot A, 0, -1, hsID=hsID+1, ZZYZX, 3



My script was only using a single hotspot, and when I thought I was trying to drag a second one to change the Z height, I was just moving the length node of the first hotspot. Your script makes a lot of sense, and that was what was the biggest barrier - thanks!


I managed to replace the PROJECT script with separate 2d geometry. That allows me to have different labels in 2d and 3d.


I've added the script for the 3d text, which works, but the position in 3d is wrong. 


This is where it currently is:

Screenshot 2023-01-17 at 16.20.16.png

The text anchor is centre/centre, at A/2 but the z point is the same as the base hotspot. I'll need to use some trigonometry to elevate it with an ADDZ.   


The plane subroutine is new to me because I have never looked up the PUT commands.


	roty -ang

	put 0, 0, si
	put 0.5*B, 0.5*B, si
	put trueA-0.5*B, 0.5*B, si
	put trueA, 0, si
	put trueA-0.5*B, -0.5*B, si
	put 0.5*B, -0.5*B, si
	put 0, 0, si
	poly_ nsp/3, get(nsp)

	del 1



I understand that the roty command rotates the drawing plane for creating the geometry, and that each put command creates a node defining a shape coplanar to xy.


The bit I don't understand is poly_ nsp/3, get(nsp) 


I understand the POLY_ command, but I don't understand what nsp is, and what the GET command does. It's not a defined variable, and it seems to be used before it gets any data. It doesn't of course, otherwise it wouldn't work, but it does - which has really confused me!


Thanks very much for your help, it has made all the difference! 

Archicad 25 UKI | OS X 11.7 Big Sur

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!