The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Topics specific to the scripting and development of Library Parts and Libraries using Param-O or the Geometric Description Language – GDL. (Example: How do you use “REQUEST” GDL commands?)

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, Gordana Radonic, nbalogh, mnguyen, gkmethy, rmasaki, Akos Somorjai, Csilla Mai, Peter Baksa

User avatar
By MetalFingerz
#324450
Hello,

I am encountering a display issue while using the SWEEP command. Compared to a simple BRICK one, if I am to make a straight extrusion, there is some kind of shading appearing on the faces. However, the base profile is strictly a square and the extrusion is totally vertical with no twist

I tried changing the status codes or the mask but to no effect. Here is the picture of a BRICK (left) and a SWEEP (right)
Capture d’écran (82).png
Capture d’écran (82).png (247.12 KiB) Viewed 313 times

And both codes
Code: Select all
BRICK LA, LA, HT
Code: Select all
SWEEP	4, 2, 0, 1, 1+2+4+16+32,
			0, 0, 0,
			L, 0, 0,
			L, L, 0,
			0, L, 0,	
			0, 0, 0,
			0, 0, HT
This does not seem to be an issue while rendering so it's probably just a display issue
#324453
If You add 64*j7 to the mask value then the result is "square"

j1=1! base surface is present,
j2=1! top surface is present,
j3=1! side surface is present,
j5=1! base edges are visible,
j6=1! top edges are visible,
j7=1! cross-section edges are visible, surface is articulated.
mask = j1 + 2*j2 + 4*j3 + 16*j5 + 32*j6 + 64*j7
!mask=1+2+4+16+32
L=1
HT=3
SWEEP 4, 2, 0, 1, mask,

0, 0, 0,
L, 0, 0,
L, L, 0,
0, L, 0,
0, 0, 0,
0, 0, HT
#324520
Pertti Pääsky wrote: Sat Apr 10, 2021 5:52 pm If You add 64*j7 to the mask value then the result is "square"

j1=1! base surface is present,
j2=1! top surface is present,
j3=1! side surface is present,
j5=1! base edges are visible,
j6=1! top edges are visible,
j7=1! cross-section edges are visible, surface is articulated.
mask = j1 + 2*j2 + 4*j3 + 16*j5 + 32*j6 + 64*j7
!mask=1+2+4+16+32
L=1
HT=3
SWEEP 4, 2, 0, 1, mask,

0, 0, 0,
L, 0, 0,
L, L, 0,
0, L, 0,
0, 0, 0,
0, 0, HT
Hello Pertti,

Thanks for the reply. The 64 code appears to fix the smoothing effect however now there are diagonal lines on all side surfaces instead :(
Capture d’écran (84).png
Capture d’écran (84).png (38.59 KiB) Viewed 257 times
I tried most combinations for the mask and also changed the twisting values but I do not see any improvement. I'm guessing there is no other choice to have either the smoothing effect or the diagonal lines ?

Just for info, the reason I would like to use the SWEEP instead of a simple BRICK is that I need to parametrically change the top for both Z (delta from ZZYZX) and X (delta from sweep origin) values and that the top would need to still be cut perpendicularly to the side faces.

I tried using EXTRUDE for that but the top was always horizontally cut which was not the desired effect. Maybe I'm not using the proper command and it would be better to use a BRICK and then have some trigonometry to recalculate the base angle dynamically :x
#324528
Pertti Pääsky wrote: Mon Apr 12, 2021 11:24 am Ok, there is still one command, "RULED". Why don´t You try it?
Because I do not necessarily know the coordinates of the top polygon. If it's only vertical, it's easy but if it's inclined it's not any more. Which is why it was easier to use SWEEP as I could only specify deltas from known values.

But I'll try to do it with BRICK and trigonometry. It seems that's it's the best alternative visually speaking. Thanks for the help.
#324547
-Still, You could try this formula:
If You define the top surface by 3 points, You get point S height easily.
You can play with the attached object, it is interactive.
Code: Select all
!this formula calculates sz height of a point S(sx,sy) on a plane P1,P2,P3
!3d program

dim Point[][]
			Point[1][1]=1.0
			Point[2][1]=1.0
			Point[3][1]=5.0
			Point[1][2]=1.0
			Point[2][2]=5.0
			Point[3][2]=3.0
			Point[1][3]=1.0
			Point[2][3]=2.1
			Point[3][3]=1.5
sx=2
sy=3

			add Point[1][1],Point[1][2],Point[1][3]:sphere.1:del 1
			add Point[2][1],Point[2][2],Point[2][3]:sphere.1:del 1
			add Point[3][1],Point[3][2],Point[3][3]:sphere.1:del 1
			
			lin_ Point[1][1],Point[1][2],Point[1][3],Point[2][1],Point[2][2],Point[2][3]
			lin_ Point[2][1],Point[2][2],Point[2][3],Point[3][1],Point[3][2],Point[3][3]
			lin_ Point[3][1],Point[3][2],Point[3][3],Point[1][1],Point[1][2],Point[1][3]
						

			dx1=Point[1][1]-Point[3][1]
			dy1=Point[1][2]-Point[3][2]
			dz1=Point[1][3]-Point[3][3]
			
			dx2=Point[2][1]-Point[3][1]
			dy2=Point[2][2]-Point[3][2]
			dz2=Point[2][3]-Point[3][3]
				
			s1=dy1*dz2-dz1*dy2
			s2=dz1*dx2-dx1*dz2
			s3=dx1*dy2-dy1*dx2
			
			d=-s1*Point[3][1]-s2*Point[3][2]-s3*Point[3][3]
			sz=(-s1*sx-s2*sy-d)/s3	

			add sx,sy,sz:sphere.15:del 1
Attachments
(1.65 KiB) Downloaded 1 time
#324549
MetalFingerz wrote: Mon Apr 12, 2021 10:53 am Just for info, the reason I would like to use the SWEEP instead of a simple BRICK is that I need to parametrically change the top for both Z (delta from ZZYZX) and X (delta from sweep origin) values and that the top would need to still be cut perpendicularly to the side faces.

I tried using EXTRUDE for that but the top was always horizontally cut which was not the desired effect. Maybe I'm not using the proper command and it would be better to use a BRICK and then have some trigonometry to recalculate the base angle dynamically :x
I would have a look at TUBE.
It uses the same profile along the path.
You just need to remember that the first and last points on the path are 'dummy' co-ordinates that simple adjust the angle of the start and end faces of the tube.
So you need to allow for these 'dummy' path points to get the correct end face angles.
Basically the last point (that you can't see) is a doubling of the co-ordinates for the second last point (that you can see).
This will set the angle of the last end plane perpendicular to the path.


Barry.
#324569
With TUBE you will have trouble defining the rotation along the axis. I recommend BRICK and trigonometry to calculate the rotation. You'd have to do the same for a correct TUBE too.
#324635
Peter Baksa wrote: Tue Apr 13, 2021 9:47 am With TUBE you will have trouble defining the rotation along the axis. I recommend BRICK and trigonometry to calculate the rotation. You'd have to do the same for a correct TUBE too.
That's what I ended up doing ultimately. I just had to relearned some trigo which I had forgotten :lol:

The result is as intended now and the display of the extrusion looks good. It actually made my code cleaner in the process so overall a good lesson learned from this issue.

Thanks for all the replies, they may help for some other hurdles I may find in the future.