cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Tube command Problem

Nader Belal
Mentor
Hi there,

I was trying to make this hand bar for a ladder, using "Tube" command in ArchiCAD 18, as you can see in this image.
The problem that I have got, is that the profile gets skewed in plan, and I have got no clue how to set it right, by rotating it around its center axe.
PS: I have also tried to use Xform, but to no use
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
10 REPLIES 10
Barry Kelly
Moderator
Can you attach the TUBE code you have used for the arm?

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
Nader Belal
Mentor

for __dx = -1 to 1 step 2
	for __n = 1 to 3 step 1
		if __dx = -1 then __m = 4
		if __dx =  1 then __m = 3
		put	nbBIM_pltPos[__m][__n]
	next __n

	add get(3)	: mulx -__dx

	if nbBIM_LadderRail = 1 then
		for __n = 1 to vardim1(nbBIM_railSq)	: put nbBIM_railSq[__n]	: next __n
	else
		for __n = 1 to vardim1(nbBIM_railCir)	: put nbBIM_railCir[__n]: next __n
	endif

	__nProfile = nsp/3

	put	0.0000, 0.0000,-1,						0,
		0.0000, 0.0000, 0.0030,					0,
		0.0000, 0.0000, h1-nbBIM_ProWidth*3.5,	0

	for i = 0 to nbBIM_slpeAngleLft+90 step 360/nbBIM_resol
		put	0.0000,
			(-3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(i)),
			h1-3.5*nbBIM_ProWidth+3*nbBIM_ProWidth*sin(i),
			0
	next i

	put	0,
			-3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(nbBIM_slpeAngleLft+90),
			h1-3.5*nbBIM_ProWidth+3*nbBIM_ProWidth*sin(nbBIM_slpeAngleLft+90),
			0

	for i = nbBIM_slpeAngleLft+90 to 180 step 360/nbBIM_resol
		put	0,
		   -d5-0.44-nbBIM_ProWidth+3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(i),
			h6-ws+3*nbBIM_ProWidth*sin(i),
			0
	next i

	put 0,
		   -d5-0.44-nbBIM_ProWidth+3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(180),
			h6-ws+3*nbBIM_ProWidth*sin(180),
			0

	if nbBIM_RailMount = 1 then
		put	0,	-d5-0.44-nbBIM_ProWidth,-nbBIM_poolDepth+0.0030,0,
			0,	-d5-0.44-nbBIM_ProWidth,-1,0
	else
		for i = 180 to 270 step 360/nbBIM_resol
			put	tan(-nbBIM_angledw)*(-d5-0.44+nbBIM_ProWidth*cos(i)),
			   -d5-0.44+nbBIM_ProWidth*cos(i),
			   -h7-nbBIM_stpsNu*h3-0.1100+nbBIM_ProWidth*sin(i)+nbBIM_ProWidth,nbBIM_angledw
		next i

		put	0,
		   -d5-0.44+nbBIM_ProWidth*cos(270),
		   -h7-nbBIM_stpsNu*h3-0.1100+nbBIM_ProWidth*sin(270)+nbBIM_ProWidth,nbBIM_angledw

		put	0,
			1.0000,
		   -h7-nbBIM_stpsNu*h3-0.1100+nbBIM_ProWidth*sin(270)+nbBIM_ProWidth,
			nbBIM_angledw
	endif

	__mProfile = (nsp-__nProfile*3)*0.25

	xform	1,	-nbBIM_dw/(0.44+d5+nbBIM_ProWidth),	0,	0,
			0,	1,	0,	0,
			0,	0,	1,	0

	tube __nProfile, __mProfile, 1+2,	get(nsp)

	del 3
next __dx
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Barry Kelly
Moderator
Thanks for that.
I was expecting a simple rectangular polygon following the tube path.
But it looks like you have been busy making just about every aspect of it customisable.
You might need to attach the entire object (zip file) if you can so I don't have too try and guess the variable default values.
Or I will try and create a simple tube that follows a similar path when I get a chance later.

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
Barry Kelly
Moderator
For those following along, Moonlight has PM'ed the object to me.
It is the XFORM command that is creating the twist in the side rails.
The only way I can think of to fix this is not to use XFORM to to stretch the rail into the steps, but instead define the actual points in the TUBE path itself.
This will mean calculating the x-distance offset, but it should just be the same proportion of the y-distance.
This image should help to explain.
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
Nader Belal
Mentor
Hi everyone,

Thank you for trying to solve this.

About the xForm, actually that was my last resort that I had , cause when I tried that procedure, the hand rail profiles start twisting around its centre axe (which also happens to be its path), in a similar way that was commented in this topic:

https://archicad-talk.graphisoft.com/viewtopic.php?f=6&t=51395&hilit=tube
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Barry Kelly
Moderator
Seems a definite problem with the tube twisting.
I think I have got the path correct (maybe not - it's pretty hard to follow).
	put	0.0000, 0.0000,-1,						0,
		0.0000, 0.0000, 0.0030,					0,
		0.0000, 0.0000, h1-nbBIM_ProWidth*3.5,	0


	for i = 0 to nbBIM_slpeAngleLft+90 step 360/nbBIM_resol
		put	(((w2-w1)/2)*(-3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(i)))/(-d5-0.44-nbBIM_ProWidth),
			(-3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(i)),
			h1-3.5*nbBIM_ProWidth+3*nbBIM_ProWidth*sin(i),
			0
!!!!		put	0.0000,
!!!!			(-3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(i)),
!!!!			h1-3.5*nbBIM_ProWidth+3*nbBIM_ProWidth*sin(i),
!!!!			0
	next i

	put	((w2-w1)/2)*(-3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(nbBIM_slpeAngleLft+90))/(-d5-0.44-nbBIM_ProWidth),
			-3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(nbBIM_slpeAngleLft+90),
			h1-3.5*nbBIM_ProWidth+3*nbBIM_ProWidth*sin(nbBIM_slpeAngleLft+90),
			0
!!!!	put	0,
!!!!			-3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(nbBIM_slpeAngleLft+90),
!!!!			h1-3.5*nbBIM_ProWidth+3*nbBIM_ProWidth*sin(nbBIM_slpeAngleLft+90),
!!!!			0

	for i = nbBIM_slpeAngleLft+90 to 180 step 360/nbBIM_resol
		put	((w2-w1)/2),
		   -d5-0.44-nbBIM_ProWidth+3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(i),
			h6-ws+3*nbBIM_ProWidth*sin(i),
			0
!!!!		put	0,
!!!!		   -d5-0.44-nbBIM_ProWidth+3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(i),
!!!!			h6-ws+3*nbBIM_ProWidth*sin(i),
!!!!			0
	next i

	put ((w2-w1)/2),
		   -d5-0.44-nbBIM_ProWidth+3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(180),
			h6-ws+3*nbBIM_ProWidth*sin(180),
			0
!!!!	put 0,
!!!!		   -d5-0.44-nbBIM_ProWidth+3*nbBIM_ProWidth+3*nbBIM_ProWidth*cos(180),
!!!!			h6-ws+3*nbBIM_ProWidth*sin(180),
!!!!			0

	if nbBIM_RailMount = 1 then
		put	((w2-w1)/2),	-d5-0.44-nbBIM_ProWidth,-nbBIM_poolDepth+0.0030,0,
			0,	-d5-0.44-nbBIM_ProWidth,-nbBIM_poolDepth-1,0
!!!!		put	0,	-d5-0.44-nbBIM_ProWidth,-nbBIM_poolDepth+0.0030,0,
!!!!			0,	-d5-0.44-nbBIM_ProWidth,-1,0
	else
		for i = 180 to 270 step 360/nbBIM_resol
			put	tan(-nbBIM_angledw)*(-d5-0.44+nbBIM_ProWidth*cos(i)),
			   -d5-0.44+nbBIM_ProWidth*cos(i),
			   -h7-nbBIM_stpsNu*h3-0.1100+nbBIM_ProWidth*sin(i)+nbBIM_ProWidth,nbBIM_angledw
		next i

		put	0,
		   -d5-0.44+nbBIM_ProWidth*cos(270),
		   -h7-nbBIM_stpsNu*h3-0.1100+nbBIM_ProWidth*sin(270)+nbBIM_ProWidth,nbBIM_angledw

		put	0,
			1.0000,
		   -h7-nbBIM_stpsNu*h3-0.1100+nbBIM_ProWidth*sin(270)+nbBIM_ProWidth,
			nbBIM_angledw
	endif

	__mProfile = (nsp-__nProfile*3)*0.25

!!!!	xform	1,	-nbBIM_dw/(0.44+d5+nbBIM_ProWidth),	0,	0,
!!!!			0,	1,	0,	0,
!!!!			0,	0,	1,	0

	tube __nProfile, __mProfile, 1+2+64,	get(nsp)
I have multiple commented out your nodes and added what i think is the path.
And I have commented out the XFORM.

There are not rotations in the tube nodes so I am not sure where the rotation is coming from.

If I get a chance I will try with something simpler.
Just for my own curiosity if nothing else.

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
Nader Belal
Mentor
The only conclusion that I got for this twist using Tube is that (and correct me if I´m wrong)

The Tube command is based on a vector math algorithm deep inside of ArchiCAD's source code and it depends on many factors:
1- The origin of the coordinate system in relation to path's node 1.
2- If the path passes through one side of the axe of the coordinate system to another (from +ve to negative).

If I could know the algorithm, may be we would be able to overcome it.

Or an spread sheet that calculate the counter twist for us will do
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Nader Belal
Mentor
Can any one pass me the shear cartesian equations for XY plane ??

Idea:
If I sheared the base of the profile in the opposite direction of the tube profile, then I can bypass the file twisting all together.
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Nader Belal
Mentor
Here are the results of shearing the profile in plan before apply the xform transformation.
Although it appears promising but ...
Definitely there is a correlation between Tube command, the path it takes when crossing path axis
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.