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

How to control texture angle on element created by EXTRUDE

Anonymous
Not applicable
I create element by command EXTRUDE
But texture on top surface of the created element has wrong direction.

Even if I create texture on the runtime and assign angle by 0,
the material placed on the any other angle.
The code is:

angle = 0
define texture "owntile" "texture_wood.jpg",1,1,256, angle

define material "tilemat" 21,
0.7,0.7,1,
0.15,0.95,0,0.0,
0,0,
ind(fill,"fillAttribute_1"),1,
ind(texture,"owntile")
material tilemat

count = GoodwinGDLPointsCount
for i=1 to count
PUT GoodwinGDLPoints[1]/1000,GoodwinGDLPoints[2]/1000,GoodwinGDLPoints[3]
next i
if count<>0 then
EXTRUDE count,0,0,0.04, 1+2+4+16+32,
GET(NSP)
endif

!points are placed on parameter array.
12 REPLIES 12
Anonymous
Not applicable
This seems to work for me.

All you need to do is declare an angle parameter called "angle" and then use this code:
define texture "owntile" "texture_wood.jpg",1,1,256,angle 

define material "tilemat" 21, 
0.7,0.7,1, 
0.15,0.95,0,0.0, 
0,0, 
ind(fill,"fillAttribute_1"),1, 
ind(texture,"owntile") 
material tilemat 
Then insert the object, in 3D view click the object and set the angle parameter to any angle you want

In my test i had a crpism_ with tilemat as texture and the angle changed once I set it from 0 to 90
Anonymous
Not applicable
No.
I create figure by GDL command EXTRUDE in my object.
I need to control true texture angle without using any ARCHICAD menu command.

It's important. I'm need to set value to variable 'angle' with addons directly in 2d window to object.
Anonymous
Not applicable
Not quite sure what you are trying to do.

I added an example with an extrude and an angle parameter that can be set through UI or then through the parameter window (All paramaters v custom settings).

Is that any help?
Anonymous
Not applicable
It example showes my trouble).
When 'angle' is 0, direction of texture - unpredictably (red arrow).
I have to make the texture direction in 3d coincide with the direction of hatching in 2d (green arrow).
needed_angle.jpg
Anonymous
Not applicable
But there is an angle between the 0 and the red line. Let's call it phi.

You measure how much phi is. The dirty and quick way to measure this is to add in several values for "angle" and see what angle value makes it line up with your red arrow.
This value is then your phi.

Then in your code that angle2 = angle - phi

and angle2 is your new angle variable that you call in your texture definition. That is the angle the texture will have to make sure that it lines up with the green line.

So based on your picture your code would roughly be:

angle2=angle-135
define texture "owntile" "texture_wood.jpg",1,1,256,angle2 

define material "tilemat" 21, 
0.7,0.7,1, 
0.15,0.95,0,0.0, 
0,0, 
ind(fill,"fillAttribute_1"),1, 
ind(texture,"owntile") 
material tilemat 
Note:You can then still change the angle of the texture by changing the "angle"-value and it should line up with your green arrow. The 135 is just an educated guess for phi based on your drawing
phi.png
Anonymous
Not applicable
No(.
But I do not know phi...
The texture placed how it want.

My figure is created dynamicly by coordinates writed to object by my addons from texture.

https://www.youtube.com/watch?v=Y3kn_M9Mtn4
Anonymous
Not applicable
phi will be static. The offset between the angle and the green line will be constant.

So measure it once and it should work. The direction that the hatches are drawn will be guided by the "angle" parameter.

As long as your offset ("phi") is correct your texture should follow the hatch pattern.
Anonymous
Not applicable
The problem is that I need to create a template for the BIM area objects.
For example for a laminate or a terrace board.
It is necessary to do without measuring the angles.

I noticed that the texture lies perpendicular to any side of the contour.
The angle could be obtained from the points of this side.
But how ARCHICAD chooses this side of the texture binding for EXTRUDE I do not know (.

In short, it is necessary that as in hatching in 2d:
set the angle from 0 and go texture there).
Anonymous
Not applicable
My guess would be that the texture would be perpendicular to the longest side of the extrude.

But the sides of the contour are stored in an array right?

So you can call those points and do some math.

You could calculate the longest side (sqrt((x2-x1)^2+(y2-y1)^2)

and then you can calculate the angle of that side with a horizontal line which will give you phi.

angleInDegrees = arctan(y2-y1 / x2-x1) * 180 / PI