Choose your top Archicad wishes!

Read more
GDL
About building parametric objects with GDL.
SOLVED!

How to obtain the X and Y coordinates of vertices on curves or line segments in GDL programming

baixiaodong
Booster

How to obtain the X and Y coordinates of vertices on a curve or line segment in GDL writing, and drive a point on another line segment through these coordinates?

I am planning to use the REVOLVE command to create a jar model. The upper and lower materials of the jar model are different, and the REVOLVE command cannot allocate different materials for the weft part. Therefore, I need to use two REVOLVE commands to create the upper and lower parts of the jar separately, in order to meet the requirements of attaching different materials. As the jar model is parameterized, the upper and lower parts will be linked and seamlessly connected, This requires the vertex at the end of the lower part to drive the starting vertex of the upper part. I think so, but I haven't found a feasible method yet.

 

Please advise

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Solution

Only the first and last (base & top) surfaces.

Not surfaces in between.

 

But if you could there would be a gap and you could see into the bottle.

So I am not sure why you would want to do that?

 

I am lazy.

If you have the REVOLVE for the bottle, post it here and I will show you how to do the cap.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

View solution in original post

Solution

You have a very wide neck on your bottle - I did not alter this.

 

What I did was took your polylines and paste in the 2d script.

Viewed those in the 2D view.

Placed a marquee around it and copied.

Pasted this in the 2D symbol window.

Created a fill from the result but left a small gap above the y-axis - mask values in REVOLVE can close this gap.

Manually draw the fill from the start working anti-clockwise - this will give you the proper start and end point in the correct order.

Otherwise if you magic wand the fill, you will have to figure out the start and end points and re-arrange them in the script.

 

BarryKelly_0-1694507160987.png

 

I made a fill to represent the neck of the bottle (as I said it is a bit wide, but just went with what you had drawn).

Now select those fills and drag them into the 2D script - this will create code for those polygons.

I could have probably worked from your polygons, but I would have had to work out the order of the points - and as I said before I am lazy!

 

The polygon generated this way is what you need for the REVOLVEs.

You only need the x,y co-ordinates, so copy then to the 3D script and add the actual REVOLVE command instead of the POLY2

 

What you should end up with is this.

 

 

!!!neck
REVOLVE       7,      360,      1*0+2*0+4*1+8*1+16*1+32*1+64*0,

        -0.1553553390593, 0.02035533905933,      1, 		!!!bottom of cap
        -0.1773274563337, 0.02035533905933,      1, 
        -0.1773274563337, 0.02329906375881,      1,
        -0.1773274563337, 0.02329906375881,      1, 
        -0.1872900866456, 0.02329906375881,      1, 
        -0.1872900866456, 0.01835533905933,      1, 
        -0.1553553390593, 0.01835533905933,      1 

!!!bottle
REVOLVE       24,      360,      1*1+2*1+4*1+8*1+16*1+32*1+64*0,
 

        -0.009992499015367,        0.001,      1, 			!!!start point
        0.01857142857143, 0.0002857142857143,    900, 
                   0, -48.02837615769,   4001, 
                   0,        0.027,      1, 
              -0.008,        0.027,    900, 
                   0,           90,   4001, 
               -0.12,        0.035,      1, 
               -0.12,        0.005,    900, 
                   0,           45,   4001, 
        -0.1553553390593, 0.04035533905933,    900, 
                   0,          -45,   4001, 				!!!top of bottle
        -0.1553553390593, 0.02035533905933,      1,		 	!!!bottom of cap
        -0.1553553390593, 0.01835533905933,      1, 
        -0.1553553390593, 0.04035533905933,    900, 
                   0,           45,   4001,
        -0.1397989898732, 0.02479898987322,      1, 
               -0.12,        0.005,    900, 
                   0,          -45,   4001, 
               -0.02,        0.033,      1, 
               -0.02,        0.023,    900, 
                   0,          -90,   4001, 
               -0.01,        0.022,      1, 
        -0.001708278580815, 0.0002329172141919,    900, 
                   0, 67.25948321345,   4001				!!!end point

 

 

Adjusting the masking values to show the top and base for the bottle, but hide for the neck as you want that open.

If you want to close the top, then rearrange the co-ordinates so the first and last points are the 2 co-ordinates for the top of the neck and leave the top and bottom surface mask values as '1'.

 

You should have a bottle with a wide neck.

 

BarryKelly_1-1694507672669.png

 

 

Add another REVOLVE for the liquid inside.

 

If you want to make the bottle size parametric, that is a bit more involved.

You will have to work out the co-ordinates that you want to be parametric and replace them with parameters.

Or you can just use the MUL command to stretch x, y, and/or z axis.

 

Or just use the bottle objects in the default library?

Have a look at the scripts for the champagne bottle - that is all they have done for that one - REVOLVEs and MULs.

 

Barry.

 

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

View solution in original post

12 REPLIES 12
Barry Kelly
Moderator

I am not quite sure I understand your problem.

You must give the coordinates for the curve profile, so you already know them.

So if it was all one material, there would be no issue.

If using two materials, you just break the curve profile into two separate REVOLVEs.

The last point of the first REVOLVE is the first point of the second REVOLVE.

 

They will both be using the same center (axis) for the revolve, so there should be no issues.

 

Otherwise can you provide an image showing the problem?

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
baixiaodong
Booster

Hello: Thank you for your attention. That's what you mean, but I don't know how to operate it. Attached are the pictures below.

 

The length, diameter, and inclination of the bottle cap should all be linked with the bottle body, and when the bottle body changes, the cap also needs to change. To drive the first vertex of the bottle cap with the last vertex of the bottle body.

 

捕获.JPG

The bottom coordinate for the cap is the same for the top of the glass.

So it would be as if you have one profile, but you just break it where the glass and cap meet.

 

BarryKelly_0-1694412134116.png

 

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Hi @baixiaodong ,

 

Why not just drawing it in your 2D plan view and drag and dropping the linework in your 2D script ? Then you could just make it parametric by changing the coordinates accordingly. Don't forget to base the sketch around the origin of your plan view.

baixiaodong
Booster

When drawing lines in a plan view, the data of the points is too large and irregular, often exceeding ten decimal places. Additionally, it is not very convenient to parameterize

Or is there a possibility that the REVOLVE command can hide rotating faces that do not need to be displayed, and hide the faces generated between two vertices

Solution

Only the first and last (base & top) surfaces.

Not surfaces in between.

 

But if you could there would be a gap and you could see into the bottle.

So I am not sure why you would want to do that?

 

I am lazy.

If you have the REVOLVE for the bottle, post it here and I will show you how to do the cap.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
baixiaodong
Booster

Water needs to be placed inside, and the water and bottle body will interact under the influence of parameters

 

poly2_ 11,15,
-0.025,0,1,
-0.01,1,800,
-0.01,0.022,1001,
-0.01,0.023,1,
0.01,90,2001,
-0.1,0,301, !Bottle height
-0.1-0.02,0.005,900,
0,45,4001,
0.022,- 45,2001,
0,0,300, ! Bottle mouth height
0,0,-1



poly2_ 10,15, ! Outer bottle
-0.01,0,1,
-0.01,1,800,
0,0.022,1001,
0,0.022+0.005,1,
0.008,90,2001,
-0.1-0.012,0,301,
-0.1-0.02,0.005,900,
0,45,4001,
0.022-0.002,- 45,2001,
0,0,300     ! Bottle mouth height
Solution

You have a very wide neck on your bottle - I did not alter this.

 

What I did was took your polylines and paste in the 2d script.

Viewed those in the 2D view.

Placed a marquee around it and copied.

Pasted this in the 2D symbol window.

Created a fill from the result but left a small gap above the y-axis - mask values in REVOLVE can close this gap.

Manually draw the fill from the start working anti-clockwise - this will give you the proper start and end point in the correct order.

Otherwise if you magic wand the fill, you will have to figure out the start and end points and re-arrange them in the script.

 

BarryKelly_0-1694507160987.png

 

I made a fill to represent the neck of the bottle (as I said it is a bit wide, but just went with what you had drawn).

Now select those fills and drag them into the 2D script - this will create code for those polygons.

I could have probably worked from your polygons, but I would have had to work out the order of the points - and as I said before I am lazy!

 

The polygon generated this way is what you need for the REVOLVEs.

You only need the x,y co-ordinates, so copy then to the 3D script and add the actual REVOLVE command instead of the POLY2

 

What you should end up with is this.

 

 

!!!neck
REVOLVE       7,      360,      1*0+2*0+4*1+8*1+16*1+32*1+64*0,

        -0.1553553390593, 0.02035533905933,      1, 		!!!bottom of cap
        -0.1773274563337, 0.02035533905933,      1, 
        -0.1773274563337, 0.02329906375881,      1,
        -0.1773274563337, 0.02329906375881,      1, 
        -0.1872900866456, 0.02329906375881,      1, 
        -0.1872900866456, 0.01835533905933,      1, 
        -0.1553553390593, 0.01835533905933,      1 

!!!bottle
REVOLVE       24,      360,      1*1+2*1+4*1+8*1+16*1+32*1+64*0,
 

        -0.009992499015367,        0.001,      1, 			!!!start point
        0.01857142857143, 0.0002857142857143,    900, 
                   0, -48.02837615769,   4001, 
                   0,        0.027,      1, 
              -0.008,        0.027,    900, 
                   0,           90,   4001, 
               -0.12,        0.035,      1, 
               -0.12,        0.005,    900, 
                   0,           45,   4001, 
        -0.1553553390593, 0.04035533905933,    900, 
                   0,          -45,   4001, 				!!!top of bottle
        -0.1553553390593, 0.02035533905933,      1,		 	!!!bottom of cap
        -0.1553553390593, 0.01835533905933,      1, 
        -0.1553553390593, 0.04035533905933,    900, 
                   0,           45,   4001,
        -0.1397989898732, 0.02479898987322,      1, 
               -0.12,        0.005,    900, 
                   0,          -45,   4001, 
               -0.02,        0.033,      1, 
               -0.02,        0.023,    900, 
                   0,          -90,   4001, 
               -0.01,        0.022,      1, 
        -0.001708278580815, 0.0002329172141919,    900, 
                   0, 67.25948321345,   4001				!!!end point

 

 

Adjusting the masking values to show the top and base for the bottle, but hide for the neck as you want that open.

If you want to close the top, then rearrange the co-ordinates so the first and last points are the 2 co-ordinates for the top of the neck and leave the top and bottom surface mask values as '1'.

 

You should have a bottle with a wide neck.

 

BarryKelly_1-1694507672669.png

 

 

Add another REVOLVE for the liquid inside.

 

If you want to make the bottle size parametric, that is a bit more involved.

You will have to work out the co-ordinates that you want to be parametric and replace them with parameters.

Or you can just use the MUL command to stretch x, y, and/or z axis.

 

Or just use the bottle objects in the default library?

Have a look at the scripts for the champagne bottle - that is all they have done for that one - REVOLVEs and MULs.

 

Barry.

 

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!