Author Topic: Connect contour lines...  (Read 405 times)

jym_ing

  • Newbie
  • *
  • Posts: 42
Connect contour lines...
« on: February 05, 2019, 05:46:44 AM »
Dear DesignCad friends,
I am making a 3D model of an old castle in France, with the environning terrain.
I got a DXF in 2D of the contour lines of the area (every 50cm ~ about 20"), and put it in DC 3D (see attached file)
How can I connect contour lines and make a (rather) smooth surface?
At the moment, I converted lines to planes, and then extrude (see the result in jpg).
Can someone help??
Many thanks....

JYM

Bob P

  • Hero Member
  • *****
  • Posts: 1219
    • Era Replica Automobiles
Re: Connect contour lines...
« Reply #1 on: February 05, 2019, 09:49:13 AM »
Each contour must be a single (combined) line.
Menu: Draw>Surface Connect will create smooth surfaces (using the proper options) between the contours.
You may have to try various options in the command, including reversing the order of points on some contours beforehand.

jym_ing

  • Newbie
  • *
  • Posts: 42
Re: Connect contour lines...
« Reply #2 on: February 05, 2019, 10:16:44 AM »
Thank you Bob for your reply
Yes, I tried Surface Connect, but it gives fancy results....
I'll try again

Dr PR

  • Hero Member
  • *****
  • Posts: 5653
Re: Connect contour lines...
« Reply #3 on: February 05, 2019, 11:02:06 AM »
JYM,

You can create a grid surface using the contour lines as the "template" for the grid. The "Draw/Surface Connect" function allows you to define the number of intermediate "breaks" or lines between the original lines and the number of "planes" along each contour line. The result is a fishnet grid surface that can be shaded. See the attached pictures.

However, it is not as easy as it looks!

1. You can create grids between lines (V) and curves (C). Normally curves will produce better results.

2. In the "contour grid" image the red contour curves were drawn by setting the starting points randomly. Each curve is defined by a collection of sequentially numbered points. With "Surface Connect" the first point (1) on each line is the starting point for grid creation along the curve. The program connects the numbered points on each curve with the same numbered points on the other curves.

As you can see the points on the red curves do not align so the resulting grid is twisted and distorted into a wrinkled surface.

The points on the blue curves are all ordered in the same direction, with the first points (1) aligned. The result is a smooth grid that shades properly ("shaded contours" image).

It also helps if each curve has about the same number of points, and the smoothest and most orderly grid results if all of the same numbered points on each curve line up nicely.

Also, you MUST select each curve near point 1 and in the same direction around the curves from point 1. Failure to be meticulous about this can produce some extremely distorted grids!

If at first you do not succeed, UNDO, and try again!

3. Notice the hole at the top of the "hill." You cannot create a grid between a curve and a point mark. The innermost element must be a curve. Make the innermost curve relatively small and then fill in the hole with a plane (P). After all grids and planes have been created, select them (but do not select the original curves!) and use "Solids/Solid Define" to make them all a solid. This will cause the transition between the grid and the plane to render smoothly.

4. What about the parts of a rectangular surface outside the closed contour curves? This is VERY tricky!

In addition to "Surface Connect" there is also the "Surface Patch" function.

"Surface Connect" works well with open ended curves and closed loop curves that are more or less parallel, like the loop contours on a hill. It does not work with irregular areas.

"Surface Patch" works with a collection of lines and curves that encloses an irregular space. You can use this to close the gaps between the edges of the "map" and the closed contour curves. Again, this is very tricky, and can be quite frustrating until you eventually figure it out.

Basically, you draw three or four separate lines/curves to enclose the area. Then start "Surface Patch" and select the lines and curves. You have the option to define the number of planes "across" and "down." I have never been able to figure out what "across" and "down" mean! They define the number of planes in perpendicular directions across the grid, but how "across" and "down" are applied differs depending upon the first line/curve you pick and the order you select the other lines. Just think of it as random, and if the grid doesn't look right try again by selecting a different line first and changing the order you select the other lines. Good luck!

Patience is a virtue hard to come by!

In the "contour map grids" image (with four instances shown) the original lines and curves for a map are shown in blue in part 1.

In part 2 I have recreated the original light blue grid with the closed contour curves using "Surface Connect." I have also added a plane at the top center. Around the edges I have used "Surface Patch" to make orange grids at the corners.

5. When filling gaps between the original closed curves and the surrounding irregular areas, you cannot use the original closed curves - the grid will stretch all the way around the original curve. You must create new curve segments along the part of the original curve you want to use.

In part 3 I have created four new curves (two green and two red) where the original outermost blue closed curve was. Again, I was careful to set the points in the same direction as the points in the original closed curve. Then I used "Surface Patch" to create the corresponding red and green grids between the outer map edge and the closed contour  curve.

Part 4 shows all of the different grids placed together.

6. The "contour map shaded" image shows the grids in their original colors on the left, and all grids shaded light blue, collected and defined as a solid.

As you can see, the result is not perfect. But it is a start. Here are several things to consider.

First, the gaps between the inner grid and the outer grids are the result of not having the same number of points in the lines used to define the grids.

Second, even though all grids are combined as a single solid, there are sharp transitions in places where they do not blend smoothly as a single curved surface. This is because there are not enough individual contour curves forming the grids surrounding the inner grid. The program needs more curves, at proper elevations, in order to make all of the grids align correctly.

You can use the initial set of grids to create a new set of contour curves, and repeat the process until you get a smooth map surface.

When drawing curves more points are better than fewer points.

Phil

« Last Edit: February 06, 2019, 10:24:44 AM by Dr PR »
DesignCAD user since 1987

Dr PR

  • Hero Member
  • *****
  • Posts: 5653
Re: Connect contour lines...
« Reply #4 on: February 05, 2019, 11:31:30 AM »
OK, the process so far is pretty crude. Here is the next step to get a good map surface.

1. In the "new template lines" image I have used the "Draw/Lines/Contour Line" function to create a new set pf parallel contour lines over the grids. In the lower part of the image you see the grids with the new parallel template lines. The upper part shows just the new parallel lines.

However, these new lines are just a bunch of short line segments where the "Contour Line" function crossed each individual grid.

2. The "new curves" image illustrates the problem. At the top the new contour line parts are shown as green, blue and magenta line segments.

I used these line segments to draw new smooth curves, as shown in red in the middle. I changed to an empty layer and then started the "Draw/Lines/Curve" (C) function. I moved the cursor along the old line segments and used "Point/Line Snap" to set points on the lines. Each new curve is a continuous smooth curve. These are just what you need to generate a new continuous grid surface with the "Surface Connect" function. The new single grid is shown with the new curves at the bottom.

3. The "shaded map" image shows the result.

Remember, you can always use an existing grid or collection of grids to generate new template lines for another grid. It is a process of successive approximation to get from a crude first result to a polished finished piece.

It is a good idea to change to an empty layer before starting each new step in the process. After you have the result you want all the layers with unnecessary lines and grids can be deleted.

Phil
« Last Edit: February 05, 2019, 08:29:35 PM by Dr PR »
DesignCAD user since 1987

Dr PR

  • Hero Member
  • *****
  • Posts: 5653
Re: Connect contour lines...
« Reply #5 on: February 05, 2019, 11:58:12 AM »
JYM,

If you do  not want the  smooth surface that results from this process, but want the stepped architectural model as shown in the image you posted initially, you can now generate a new set of contour curves at any desired elevation stepping.

Use the "Draw/Lines/Contour Lines" function to produce a new set of curves stepped at the desired vertical increment. You can select the option to make each new contour a plane instead of a curve. See the "horizontal slices" image. I used the vertical scale (red) as the reference points for each contour slice.

Then you can "Draw/Extrude" to extrude each slice to create a 3D layer. The "stacked layers" image shows the result. Again, I used the red vertical scale as references for each extrude operation.

Phil
« Last Edit: February 05, 2019, 08:18:22 PM by Dr PR »
DesignCAD user since 1987

Rob S

  • Hero Member
  • *****
  • Posts: 4549
    • Construction Estimating Program for General Contractors
Re: Connect contour lines...
« Reply #6 on: February 05, 2019, 07:06:23 PM »
I did not ask the question, but let me be the first to thank you for that very detailed explanation. 
User since Pro-design

bdeck

  • Hero Member
  • *****
  • Posts: 925
Re: Connect contour lines...
« Reply #7 on: February 05, 2019, 08:24:48 PM »
OK, then, let me be the second.  ;D

jym_ing

  • Newbie
  • *
  • Posts: 42
Re: Connect contour lines...
« Reply #8 on: February 05, 2019, 11:22:59 PM »
Well.... sorry to be the third!
OK, I will make a try with my model, and let you know.

Thank you so much...
JYM

jym_ing

  • Newbie
  • *
  • Posts: 42
Re: Connect contour lines...
« Reply #9 on: February 08, 2019, 05:29:24 AM »
Thank you so much, Phil.
However, I think I will give up.
I attached the original file (converted from pdf to dwg and then to DesignCad).
As you can see, it's a huge work! I will spend my life with this file...

Anyhow, thank you again for your clear explanations, that would be useful for other purposes....
JYM

Dr PR

  • Hero Member
  • *****
  • Posts: 5653
Re: Connect contour lines...
« Reply #10 on: February 08, 2019, 10:24:02 AM »
JYM,

That is a bunch of contour lines!

You can shortcut the entire process, but it will still be a lot of work.

1. First you need to move each contour line to the proper elevation in the drawing.

2. Create a vertical plane the length of the long side of the map and a bit higher than the highest elevation.

3. Move the vertical plane step by step along the short side of the map. At each position draw curves between points where the plane intercepts each contour line. This will produce parallel curves that can be used to generate a grid with "Surface Connect."

4. Use the new curves to generate the surface grid.

This is a lot of work but it avoids trying to create bazillions of individual grids with "Surface Connect" and "Surface Patch." What else do you have to do for the rest of your life?

Phil
DesignCAD user since 1987

jym_ing

  • Newbie
  • *
  • Posts: 42
Re: Connect contour lines...
« Reply #11 on: February 09, 2019, 12:22:22 AM »
Well, I'm retired, and doing the job for free.
The target is to make a reconstitution of the castle at various periods (XII / XVI / XIX centuries), and put the PDF files in 3D on the website of the municipality.
I have time; your suggestions look great, I'm gonna try and keep you posted.
And yes, I have some other projects, like a full 3D of the cathedral Notre-Dame de Paris (I'm french), and my main job is to create a 3D of the chapel that can be seen in the painting "Holly Trinity" in Florence, by Masaccio (XV century), supposed to be the first painting that used full perspective.

JYM

Dr PR

  • Hero Member
  • *****
  • Posts: 5653
Re: Connect contour lines...
« Reply #12 on: February 09, 2019, 01:58:49 PM »
JYM,

Those are nice projects. Please do show us your results!

I have a similar, but less spectacular, project on my list that will entail modelling land contours. Fort Hoskins, in western Oregon, was  just about as far west as you could go in the American frontier in the 1850s. The fort was built on a hill overlooking one of the main trails through the Coast Range Mountains to the Pacific Ocean. It was also very unusual in that it was established to protect Indian reservations from white settlers! That is an odd twist of history!!

Today the property is in the Benton County Fort Hoskins Historical Park. I am Chair of the the county park board, and we have ongoing plans for reconstructing the fort. I want to make a 3D CAD model of the fort as it was in about 1860, just before the American Civil War. Images from the model will be used to solicit grants to help reconstruct the park.

We have restored one of the original officers houses at the fort, and it is almost unmodified and mostly original materials from when it was built in 1857. I have a complete detailed CAD model of this house. It is one of the oldest original structures in Oregon - our "western civilization" history is very short compared to the old world (the Native Americans have been here at least 18,000 years, and that is another part of the history of our park). There were about a dozen other buildings at the fort and these will be represented as metal frame "ghost structures."

I haven't started on the full model of the fort yet, but I may begin sometime this year (lots of other things in the cue). But my initial attempts to model the land are where I got the ideas from for creating the 3D terrain from 2D contour maps.

Phil
DesignCAD user since 1987

jym_ing

  • Newbie
  • *
  • Posts: 42
Re: Connect contour lines...
« Reply #13 on: February 12, 2019, 12:03:44 AM »
Hi Phil
I'm of course highly interested to see the model, and how you deal with the terrain from 2D contour lines!
You can download my model of the castle here: www.archistructures.org/downloads/perso/Talmont/Talmont_chateau_modele3D_1.pdf
The file must be downloaded on your computer first, and open with Adobe Acrobat (I'm not sure that 3D features work with other softwares).

JYM