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
Hmooslechner
Moderator
Thanks for the permission...

Objective seems to be a "very grown up" api-solution - which partly seems to be obsolete after the coming up of the Morph - tool in AC16. What could be the cost of such a thing?

I am not looking for ready solutions. Its a kind of hobby to solve GDL-Problems. Other people solve crossword puzzles, i like to make new objects.
And i like to tell the Archicad-programmers ideas for new versions - on the german forum.

My real profession is teacher on a technical school for practical work - bricklaying, concrete works an now in growing time - archicad for pupils from 15 to 18 years. So i have time...

And i really think Your "Flexi-Tube XYZ" object has some potential!

Today i scripted a new hotspot in it, which allows it, to drag the number of segments without the need of opening the normal dialogebox - it works well but its just a little step to the target 2. d;-)
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Anonymous
Not applicable
I am wondering, how do I stretch angles so as not to disturb the vectors and columns?