GDL
About building parametric objects with GDL.
SOLVED!

Face display of a SWEEP command

MetalFingerz
Advocate
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)

And both codes
BRICK LA, LA, HT
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
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Peter Baksa
Graphisoft
Graphisoft
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.
Péter Baksa
Software Engineer, Library
Graphisoft SE, Budapest

View solution in original post

8 REPLIES 8
Pertti Paasky
Expert
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
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
MetalFingerz
Advocate
Pertti wrote:
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
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
Pertti Paasky
Expert
Ok, there is still one command, "RULED". Why don´t You try it?
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
MetalFingerz
Advocate
Pertti wrote:
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.
Pertti Paasky
Expert
-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.
!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
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
Barry Kelly
Moderator
MetalFingerz wrote:
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
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.
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
Solution
Peter Baksa
Graphisoft
Graphisoft
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.
Péter Baksa
Software Engineer, Library
Graphisoft SE, Budapest
MetalFingerz
Advocate
Peter wrote:
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

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.