Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
Yancka

Topographic map 2D to 3D workflow

Recommended Posts

The purpose is to have correct Existing Site Model in order to design Proposed one and include it (Proposed) also in sections of building. The start is existing Site Model. I've identified the possible workflow to create existing Site Model in 3D from 2D topographic file received from surveyors. The trick is this task is required to be done rarely (once per project) and I'm lacking that level of programming knowledge to code it in reasonable time (comparing amount of time I should invest and time I would save). I assume the script allowing to make 3D from 2D would be advantageous to many architects & landscape architects and therefore some kind of collaboration here on developing it could be possible. If not, I hope at least to receive some coding advise (experienced programmer may find it relatively easy).

There are 2 ways how Z data is represented in 2D surveyor files I deal with (mostly created with Microstation and then exported to DWG):

1. Text object displaying Z value. Insertion point of text object (or upper left point of text objects bounding box) gives X and Y.

2. Multiple text objects combined with liner object (mostly polygon, sometimes line, few times polyline), I think in AutoCAD Civil 3D it was named "feature line". This line determines where the border between various relief types are. For example, it divides road, flat area, slope, ditch, hill.

Working with text objects only as 3D point source data gives very rough and sometimes inadequate result. Therefore usage of "feature lines" is a must-have. Polygons forming "feature line" have at least 2 text objects on them, sometimes they are closed and sometimes not. They are very varying, besides sometimes text isn't exactly on the line but some distance (6mm) away, if printed it looks like on the polygon but digitally it isn't. Additionally, sometimes length of segment is unreasonably small (3 mm).

For example, closed polygon forming lawn in the backyard has perimeter of 80m, has 115 segments and 16 text objects on it. Another closed polygon at the foot of hill has perim 45m, 51 segments and 6 text objects. Linear (unclosed) polygon forming side of the road has perimeter 51m, 5 segments and 6 text objects.

The meaning of 3D points (for convenience I'll call text objects 3D points) on polygon is as follows:

1. draw a 3D line from 1 3D point to another;

2. duplicate in Top view and move perpendicularly;

3. create plane using those 2 3D lines;

4. projection of polygon's segments (located between 2 3D points) on this plane would give Z value of each segment.

5. Then you take next 2 3D points (point No2 and point No3) and repeat.

My workflow is to create Stake Objects as source data for Site Model. Couldn't make much use of 3D Polys (since couldn't find reasonable way to create them from data given). Probably 3D Polys would be the way...

My vision on how it should work:

1. User selects a poly which is to be transformed into 3D Poly and fires the command (this script).

2. The script checks for text objects which lie on this polygon (with tolerance of 20 mm) and which are to be used as 3D points to create 3D Poly. PtOnLine could be used.

3. Performs some really nice calculations (don't have clue on this part) which uses all given data and creates 3DPoly on another layer.

4. Deletes text objects which were used as 3D points.

* A step further would be to perform this command automatically on all polygons in specific class and in current layer.

Currently I'm doing these actions to have Stake Objects as valid data:

1. Select all polygons forming 1 linear object and all texts lying on that "feature line".

2. Run the script TOPO STEP 1:

PROCEDURE TopoApstradesSkripts;
VAR
Criteria, InitialLayerName: STRING;

PROCEDURE SelectObjectsInCurrentLayer(DeSelect: BOOLEAN; ObjectType: STRING);
VAR
Criteria: STRING;
BEGIN???
Criteria:=concat('(L=',chr(39),GetLName(ActLayer),chr(39),') & (T=',ObjectType,')');
IF DeSelect=true THEN DSelectAll;
SelectObj(Criteria);
END;
{---- ---- ---- ---- ---- ---- ---- ----}
BEGIN???
DoMenuTextByName('Cut',0);
Layer('paligmodelis');
DoMenuTextByName('Select All',0);
DoMenuTextByName('Clear',0);
DoMenuTextByName('Paste In Place',0);
SelectObjectsInCurrentLayer(true,'Poly');
SelectObjectsInCurrentLayer(false,'Polyline');
SelectObjectsInCurrentLayer(false,'Line');
DoMenuTextByName('Cut',0);

Layer('teritorijas konturas');
DoMenuTextByName('Paste In Place',0);
DoMenuTextByName('Compose',0);
IF NumSObj(ActLayer)>1 THEN AlertCritical('Par daudz objektu!','Izveido 1 veselu!') ELSE
	BEGIN
		IF GetLS(LSActLayer)<>2 THEN SetLS(LSActLayer,2);
		DoMenuTextByName('Copy',0);
		DSelectAll;
		Layer('paligmodelis');
		DoMenuTextByName('Paste In Place',0);
		DSelectAll;
	END;
END;
RUN(TopoApstradesSkripts);

3. Duplicate Text Objects to create temporary Site Model giving approx correct planes for "feature line" segments. This Site Model has to be wider that the poly in order via Duplicating Along Path... (this poly) Stake Objects they could display elevation.

4. Run the script TOPO STEP 2. Thanks to dspearman for Text 2 Stake conversion script (it's adapted here):

PROCEDURE TopoApstradesSkripts;
VAR
Criteria, InitialLayerName: STRING;

PROCEDURE SelectObjectsInCurrentLayer(DeSelect: BOOLEAN; ObjectType: STRING);
VAR
Criteria: STRING;
BEGIN???
Criteria:=concat('(L=',chr(39),GetLName(ActLayer),chr(39),') & (T=',ObjectType,')');
IF DeSelect=true THEN DSelectAll;
SelectObj(Criteria);
END;

PROCEDURE SelectPIOsInCurrentLayer(DeSelect: BOOLEAN; ObjectType: STRING);
VAR
Criteria: STRING;
BEGIN???
Criteria:=concat('(L=',chr(39),GetLName(ActLayer),chr(39),') & (PON=',chr(39),ObjectType,chr(39),')');
IF DeSelect=true THEN DSelectAll;
SelectObj(Criteria);
END;


FUNCTION Text2Stake(h :HANDLE) :BOOLEAN;VAR???r, g, b :LONGINT;
p1X, p1Y, p2X, p2Y ,p2Z:REAL; NewStake:HANDLE;
Objtext:STRING;
BEGIN
IF GetType(h)=10 THEN
	BEGIN
		Objtext:=GetText(h);
		p2z:=Str2Num(Objtext);
		GetBBox(h,p1X, p1Y, p2X, p2Y );
		NewStake:=CreateCustomObjectN('Stake Object',p1x,p1y,0,False);
		SetRField(NewStake,'Stake Object','Mode', 'Include as site model data');
		SetRField(NewStake,'Stake Object','Style', 'Triangle');
		SetRField(NewStake,'Stake Object','Scale Factor', '0.2');
		Move3DObj(NewStake,0,0,p2z);
	END;
END;
{---- ---- ---- ---- ---- ---- ---- ----}
BEGIN???
SelectObjectsInCurrentLayer(true, 'Text');
ForEachObjectInLayer(Text2Stake, 2, 0, 0);
SelectObjectsInCurrentLayer(true, 'Text');
DoMenuTextByName('Clear',0);
SelectPIOsInCurrentLayer(true, 'Stake Object');
END;
RUN(TopoApstradesSkripts);

5. Create Site Model, select polygon and 1 stake.

6. Run the script TOPO STEP 3:

PROCEDURE TopoApstradesSkripts;
FUNCTION SetStakeNoLabelElevationMode(h :HANDLE) :BOOLEAN;
BEGIN
SetRField(h,'Stake Object','Mode', 'Set elev to site model');
SetRField(h,'Stake Object','Label Reference', 'No Label');
ResetObject(h);
END;
{---- ---- ---- ---- ---- ---- ---- ----}
BEGIN
ForEachObjectInLayer(SetStakeNoLabelElevationMode, 2, 0, 0);
{	DoMenuTextByName('Duplicate Along Path',0);}
END;
RUN(TopoApstradesSkripts);

7. Duplicate along path (I was trying to get some help do this programmatically):

8. Run the script TOPO STEP 4:

PROCEDURE TopoApstradesSkripts;

FUNCTION SetStakeNoLabelSiteDataMode(h :HANDLE) :BOOLEAN;
BEGIN
SetRField(h,'Stake Object','Mode', 'Include as site model data');
SetRField(h,'Stake Object','Label Reference', 'No Label');
ResetObject(h);
END;
{---- ---- ---- ---- ---- ---- ---- ----}
BEGIN
ForEachObjectInLayer(SetStakeNoLabelSiteDataMode, 2, 0, 0);
DoMenuTextByName('Cut',0);
Layer('reljefa modelis');
DoMenuTextByName('Paste In Place',0);
Layer('paligmodelis');
DoMenuTextByName('Select All',0);
DoMenuTextByName('Clear',0);
Layer('starta topo');
END;
RUN(TopoApstradesSkripts);

9. Repeat until done. Then create my Site Model from stakes in DL "reljefa modelis".

For having clear picture I attach also VW file of my topo data. Take it as is (some names in Latvian). Any thoughts are welcome!

Share this post


Link to post

I do not know if I missed something but it seems a bit more complicated than it should be. In my workflow, I would ask the surveyor for a text file with the coordinates and other attributes for each point. They should be able to provide this information because how else would they get the points into Microstation. Then use the import survey to create the stake objects and finally, create the DTM.

However, I do find the VW tools very limiting and had to develop my own which add the features needed for my line of work. Nevertheless, the general workflow remains the same.

There may also be some adjustments required to the resulting DTM in order to render a more precise model. I design roads and the DTM cannot model the 7 inch drop at the curb line with just 3D points. I accomplish this by adding 3D polylines for the curb line to the DTM.

Share this post


Link to post

As far as I know, the trick is in money. If surveyors are required for 2D topography (and mostly they are required 2D) they survey lesser points than they would if were required to make more pricy 3D topography. Somehow all of conversation I've had with surveyors haven't resulted in anything usable to me. I find it easier to push the button and have 3D points from 2D texts.

I just tried to create ditch using 3 3D polygons and random Stakes as meadow. Obviously 3D polygons are used just for having 3D points in DTM. The putcome wasn't the ditch. Obviously there isn't such a thing as "feature line" which would force sides of triangles in TIN generated by DTM lie along this "feature line" and only way to have element like ditch to be created correctly is to have additional 3D points where I want the "feature line".

Miguel, somehow I don't succeed to create anything like curb using 3D polys. May be you have VW 2010 and some difference is there? Could you share an example DTM with curbs 3D polys?

Share this post


Link to post

How do they get the Z values into the text objects? If manually, you could save a lot of money by asking for the text file only. Most survey equipment software can export the data to a text file.

But let's assume that you get this 2D file with the Z data in text objects. You could just create a script that searchess all text objects and assigns the z values to the 3D locus or stake objects without user interaction.

As I mentioned before, I do not use the VW stake objects. I import the data into my own objects and then with a script, I create 3D Locus with the x,y,z values for each point in another layer. To force the DTM to draw straight lines between curb points, I add the 3D polygons. So to answer your question, the trick is to provide both the 3D points and the 3D polygons to create the DTM.

The use of a "feature line" has nothing to do with the version since I was doing this back with VW 11. I will try to cleanup one of the street reconstructions with just the DTM and 3D data because most of them are fairly large as complete projects.

Share this post


Link to post

Generating 3D points (stakes) with a script is what I do already and what I meant with "I find it easier to push the button and have 3D points from 2D texts".

I played a bit more around with 3D locuses and 3D polys combined as source data for DTM. In plan view it really draws as needed. The problem is with 3D Display. The only 2 modes that seem to be doing it in correct direction are 3D Grid (blur) and 3D Triangulated Contours (bottom of ditch is filled up) and the outcome I succeed to get (see section VPs) is not what I'd expect from 3D points + 3D polys. Miguel, what 3D Display mode and settings you use to have your sections correct?

Share this post


Link to post

Keep in mind that the tools I developed date back to VW 9 when there was no viewports. I used the "3D Triangles" display style for the sole purpose of calculating the z value at any point in the DTM, which at the time was a 2D/3D symbol.

As you may guess, I use custom plug-ins rather than VW section viewports for the street profiles and cross sections that are based on centerline stations. Nowadays, it really does not matter what display settings I use because I can get the z value from the VS function DTM6_GetZatXY.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×