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

Stick - Stretchy in 3D with 1 3D-Handle

Hmooslechner
Moderator
I programmd a Stick (cylinder) which can be easily rotated from one axis to another by simple grab the end-handle and drag it to the other point.

So it is possible to follow complex 3D-meshes to build stuctures like this:

https://www.dropbox.com/s/ivpy8evdgnvtjqk/3D-Raumgitter%20Torus-Ausschnitt.pln

Picture:

https://www.dropbox.com/s/a3we4kuj0ww9ijt/3D-Raumgitter.jpg

My problem:

If you drag over 180 degrees, the stick flips in 3D to the other side.

You can easily worrkaround by move the thing to the other endpoint and drag the other one, but it sucks.

What do i make wrong?

Code:




gosub 1    ! Einstellungen usw.

gosub 100  ! Hotspots

Gosub "Drehungen"   !!inkl Art des Stabes

end ! ------------------------------------------------------

1: 
	uid = 1
return





100 : !!! ========== Hotspots ein Segment ==========

	!!! ----- x -----
	hotspot  0   ,  y,     z,   uid, x, 1+128 : uid = uid+1    ! base   
	hotspot -1   ,  y,     z,   uid, x, 3     : uid = uid+1    ! ref
	hotspot  x   ,  y,     z,   uid, x, 2     : uid = uid+1    ! move  

	!!! ----- y -----		
	hotspot x   ,   0,      z,   uid, y, 1+128 : uid = uid+1   
	hotspot x   ,  -1,      z,   uid, y, 3     : uid = uid+1
	hotspot x   ,   y,      z,   uid, y, 2     : uid = uid+1  

	!!! ----- z -----		
	hotspot x   ,   y,      0,   uid, z, 1+128 : uid = uid+1   
	hotspot x   ,   y,     -1,   uid, z, 3     : uid = uid+1
	hotspot x   ,   y,      z,   uid, z, 2     : uid = uid+1  


return




"Drehungen":
	h = SQR(x^2+y^2+z^2)
	
	roty 90
	rotx -atn(y/x)
	roty -atn(z/SQR(x^2+y^2))
		material Mat
	
		 if ArtDesStabes = "Zylinder mit Endkugeln" 			gosub "Zylinder mit Endkugeln"
		 if ArtDesStabes = "Endkugel+Endkegel+Zylinder" 		gosub "Endkugel+Endkegel+Zylinder"	
		 if ArtDesStabes = "quadratischer Stab mit Endkugeln" 	gosub "quadratischer Stab mit Endkugeln"		

	del 3
	
	if Endkugeln = 1 then
	  sphere Kugeldurchmesser
		addx x
		addy y
		addz z
		 sphere Kugeldurchmesser
		del 3
	 else
	endif

return  !!!!Ende Drehungen






"Zylinder mit Endkugeln":
		Cylind h, QRadius
return






"Endkugel+Endkegel+Zylinder":
	
	CONE h/3, Verjuengung, QRadius, 90, 90
	addz h/3
		Cylind h/3, QRadius
		addz h/3
		CONE h/3, QRadius, Verjuengung,  90, 90
	del 2
	
return








"quadratischer Stab mit Endkugeln":

addx -QRadius/2
addy -QRadius/2
Block QRadius, QRadius, h
del 2

return

AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
11 REPLIES 11
Erwin Edel
Rockstar
Have you tried using a column instead? it can also be dragged in angles in 3d.
Erwin Edel, Project Lead, Leloup Architecten
www.leloup.nl

ArchiCAD 9-26NED FULL
Windows 10 Pro
Adobe Design Premium CS5
Hmooslechner
Moderator
column stretches not the same way. It does not rotate along the change of the axis, it stretches along z.
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Anonymous
Not applicable
Calculation for angle of vector 00, xy, in floor plan view, is uncomplete.
In trigo, according to xy coords, there are four particular situations, plus four quadrants.

Attached an example of XYZ Tube. If you replace the TUBE command by CYLIND or EXTRUDE,
you need to add two transformations. Result is the same, see 3D script.
Hmooslechner
Moderator
Thank You - a very fine functional Object!

Did You ever try this object - to make it growing - from one 3d-Point to an other - for exampleto follow a complex 3D - Morphline?

This would be a killer-App solving many 3D-modelling problems!

and

Question:

For what is this good for?
	hotspot x*0.5, y*0.5, z*0.5, uid : uid = uid+1   ! half  
Is this just Your programming - standard to get a halfpoint - or does it have to do with the XYZ-Interface?
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Hmooslechner
Moderator
Ok - i See You did that!

Wow!

(http://archilib.od.pagesperso-orange.fr/)
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Hmooslechner
Moderator
I tried to mess around with Your freeform-tube, Mr. Dentan

My first target is to alter his GDL-example to be able to apply every sort of Stick to the 3D-Centerline. (Cylinder, Block, IPE-Steel-Forms ond many other things)

   x2 = (x[k1+1] - x[k1])     !!calculates distances in 3D
   y2 = (y[k1+1] - y[k1])
   z2 = (z[k1+1] - z[k1])

Here the Archicad- compiler thinks - the code is i ok.. ?? !! ??

   h = SQR(x2^2+y2^2+z2^2)
This was the 3D-Diameter..



But here the Interpreter in Archicad finds a Fault !?!

   len2 = sqr(x2^2+y2^2)       ! 2D Axis Length
   len3 = sqr(len2^2+z2^2)    ! 3D Axis Length 
And here too:

   if abs(len2) > EPS then
      zAng = atn(z/len2)
   endif

It told me (translated by me from German):

Operator can not be used at factors from "array" (x[nSeg]) ...

My Question: A factor - calculated from the array (integer) - is different to a factor calculated from a normal Parameter for Archicad - Why?

And how do i change it - that it can be used by -for example: Abs x[nSeg]) and othe roperators?


An other target would be to change the Interface behaviour: In Your GDL, You have to change the number of segments in the normal Dialogue. It would be "nearer to the User" if first there is only one segment visible. In the direction of the only open segment shold be a new interactive hotspot - a little further.

If you drag this hotspot, the next segment should appear - now as endpoint of the next segment - and so on. It would be much faster and smoother - to edit for the user. Im trying..
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Hmooslechner
Moderator
OK - i could solve that by my own.

The problem was appearing by calling a named function into a loop.

The same scripted in the loop - and all was ok.

And - i got solved the problem with the flipping stick by dragging it in the wrong quadrant - with Help from Mr. Dentans GDLs.

I hope that i can solve my target 2 - appearing segment after segment by dragging on the new interactive hotspot...
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Hmooslechner
Moderator
Something to look to get the idea..

www.youtube.com/watch?v=OAIP9C7IinA&feature=youtu.be

and to try:

https://www.dropbox.com/s/t8ffq0a1pekd1ui/3DTubeMultiSequenzB.pln

Its not from me - the most code came from Mr. Dentan, i just playd with it.. he has better objects.

the difference is, that my alterings makes it possible to add any polygon or multiple set of objects to each vector. - to make fences, Walls following the 3D-earth, objects following each line of a roof and so on..

Also it should be possible to multiply the thing within the object and to generate 3D - Meshes with frames...
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Anonymous
Not applicable
Don't expect too much from the "Flexi-Tube XYZ" object.
It was intended to build walls with special cross section along meshes.
It suits my needs, more or less, thus I didn't go further.
Take it as a study case, and fell free to modify it.

For better stuff, take a look at Objective, from Ralph Wessel.