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

GDL
About building parametric objects with GDL.

Can't use circle for tube?

LeeJaeYoung
Virtuoso


What command should I use?
I want the circle to follow a path. What should I do?

AC27 on window 11
9 REPLIES 9
Bruce
Advisor

Yes, you can use a circle to run along a path.  TUBE is the correct command to use for this.  

 

E.g.

 

TUBE 2, NSP/4, 1+2,

   ! Define the profile (a circle)
   0, 0, 901,
   frameDia/2, 360, 4001,

   ! Define the path (in this case defined earlier with PUT)
   GET(NSP)

Bruce Walker
www.brucepwalker.com
Barking Dog BIM YouTube
Mindmeister Mindmap
-- since v8.1 --
AC27 5060 INT Full | Windows 11 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb

 

LeeJaeYoung_2-1681058389643.png

i would like to do this

LeeJaeYoung_3-1681058469840.png

But the reality is like this. ^^

 

TUBE 2,8,1+2+16+32,
0,0,901,
0.1,360,4001,

-1, 0,0,0,
0,0,0, 1,
3.230,0,0,1,
3.757,0.150,0,1001,
4.330,0.505,0,1,
4.8757,0.656,0,1001,
8.888,0.656,0,1,
8.888+1,0.656,0,0

 

What's wrong?
I just want to put smooth curves.

AC27 on window 11
julienK
Advocate

center point doesn't allow additional status code. It has to be 900.

 

Last parameter on  each line is  not  status code  like other functions.  Its the  angle of the profile relative to the path.

It should be 0 everywhere

 

TUBE 2,8,1+2+16+32,
0,0,900,
0.1,360,4001,

-1, 0,0,0,
0,0,0, 0,
3.230,0,0,0,
3.757,0.150,0,0,
4.330,0.505,0,0,
4.8757,0.656,0,0,
8.888,0.656,0,0,
8.888+1,0.656,0,0

 

tube.jpg

A TUBE command isn't like a PRISM command.  You must define every coordinate along the path.  When you do curves, the maximum angle you can 'bend' and still keep a smooth transition is 15° - any sharper than that and you will get lines at the bends.

 

The below code will model a rectangular hoop with rounded corners.

		! Lead-in
		PUT -A, 0, 0, 0,
			0, 0, 0, 0,
			A/2-cornerRadius, 0, 0, 0
	
		cornerCentreX = A/2-cornerRadius
		cornerCentreY = B-cornerRadius
	
		! Corner 1
		FOR j = 0 TO 90 STEP stepA
			PUT cornerCentreX+SIN(j)*cornerRadius, cornerRadius-COS(j)*cornerRadius, 0, 0
		NEXT j
	
		PUT A/2, B-cornerRadius, 0, 0
	
		! Corner 2
		FOR j = 0 TO 90 STEP stepA
			PUT cornerCentreX+COS(j)*cornerRadius, cornerCentreY+SIN(j)*cornerRadius, 0, 0
		NEXT j
	
		! Corner 3
		cornerCentreX = -A/2+cornerRadius
		FOR j = 0 TO 90 STEP stepA
			PUT cornerCentreX-SIN(j)*cornerRadius, cornerCentreY+COS(j)*cornerRadius, 0, 0
		NEXT j
	
		! Corner 4
		FOR j = 0 TO 90 STEP stepA
			PUT cornerCentreX-COS(j)*cornerRadius, cornerRadius-SIN(j)*cornerRadius, 0, 0
		NEXT j
	
		! Lead-out
		PUT 0, 0, 0, 0,
			A, 0, 0, 0
	
	
		! Hoop
		TUBE 2, NSP/4, 1+2,
			0, 0, 901,
			frameDia/2, 360, 4001,
			GET(NSP)

 


2023-04-10_10-28-06.jpg
Bruce Walker
www.brucepwalker.com
Barking Dog BIM YouTube
Mindmeister Mindmap
-- since v8.1 --
AC27 5060 INT Full | Windows 11 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb

Isn't this a straight path?
Can't you make a smooth pass like a 3D modeler?

 

LeeJaeYoung_0-1681093022164.png

 

AC27 on window 11

1. Below you said you can't use 1 for the radius, but you used it. I'm a beginner so it's hard to understand the difference.
Can I ask for a little clarification?

2. May I ask you to explain stepA?

(What is the value of stepA?)

AC27 on window 11
Bruce
Advisor

1.  I didn't say you can't use 1 for the radius - that was julienK.  You can't use status codes to create curves like you can with a prism command in the path definition.  You can use status codes to create curves in the profile definition.

 

2.  stepA is a variable I set up to be 15 (i.e. a step of 15 degrees).  If you want a smoother pass through rounded corners, just make this number smaller: but I have found 15 to give a good enough result.  The FOR - TO - NEXT flow control statement can also have a STEP component to it, so instead of counting up by 1, it will count by whatever STEP has been defined.  Check out the GDL reference guide for more info.

 

Bruce Walker
www.brucepwalker.com
Barking Dog BIM YouTube
Mindmeister Mindmap
-- since v8.1 --
AC27 5060 INT Full | Windows 11 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb

Yes, this is a straight path from point to point.  You can't make a 'smooth' pass like you can in Rhino (for example).

 

 

Bruce Walker
www.brucepwalker.com
Barking Dog BIM YouTube
Mindmeister Mindmap
-- since v8.1 --
AC27 5060 INT Full | Windows 11 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb

Example tube ring.

Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de