GDL
About building parametric objects with GDL.

GDL Tube loop

ArchDMn
Contributor

I'm working on a small project in GDL, to create a 'picture frame' from a profile swept along a polyline. I have just a rectangle for now but can put in more complex details later. The result responds to parametric width, height and profile thickness and length parameters.

The issue I have run into is that the cross section seems to be randomly sheared at the begin and end of the tube. Any idea why this is happening? Is there a status code or something to automatically close the Tube object? I looked here and did not find any settings to control the begin and end angle of the tube object;

https://gdl.graphisoft.com/reference-guide/shapes-generated-from-polylines

ArchDMn_1-1677558083414.png

 

 

 

 

 

RESOL res
MATERIAL mat
PEN pen_mod

HOTSPOT -a/2, 0, zzyzx
HOTSPOT a/2, 0, zzyzx
HOTSPOT 0, 0, zzyzx

HOTSPOT -a/2, 0, 0
HOTSPOT a/2, 0, 0
HOTSPOT 0, 0, 0

HOTSPOT -a/2-widc, 0, 0
HOTSPOT a/2+widc, 0, 0

ROTZ -90

	GOSUB 100
	TUBE pnum, 8, 0,
	GET (NSP),
	0, 0, 0, 0,
	0, 0, 0, 0,
	0, a/2, 0, 0,
	0, a/2, zzyzx, 0,
	0, -a/2, zzyzx, 0,
	0, -a/2, 0, 0,
	0, 0, 0, 0,
	0, 0, zzyzx, 0

DEL 1

END

100:
	pnum=4
	PUT 0, 0, 0
	PUT C, 0, 0
	PUT C, D, 0
	PUT 0, D, 0
RETURN

 

 

 

 

a= unit width

zzyzx= unit height

C= profile thickness

D= profile length

1 REPLY 1
Barry Kelly
Moderator

The first and last points of the TUBE path are dummy points.

The profile is not actually extended to those points, but they are used to define the start and end angle of the profile.

 

So the second point in the path is really the starting point of the profile.

If you make the first point the negative distance of your third point in relation to the second point, you will effectively be defining a straight line through the first second and third points.

So the start end of your profile will always be perpendicular the the first visible section of the path.

 

The same for the last point, it needs to be a continuation of a straight line from the 3rd last to second last points.

 

So in your case something like this.

 

0, -a/2, 0, 0, !!!dummy point

 

0, 0, 0, 0,

0, a/2, 0, 0,

0, a/2, zzyzx, 0,

0, -a/2, zzyzx, 0,

0, -a/2, 0, 0,

0, 0, 0, 0,

 

0, a/2, 0, 0   !!!dummy point

 

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