# Convert 2D locii to 3D locii

## Recommended Posts

Hi,

Can anyone post a script to convert all 2D locii to 3D locii?

I have a survey file with over a thousand 2D locii. I want them to be 3D so I can create a terrain. Each 2D locus has a text box next to it with the height of the point. Would it be possible to tell the script to take the numeric value from each text box and insert it into the Z value of the 3D locus? The script would have to locate the nearest text box to each 2D locus. Might be a bit tricky.

I figured out a workaround:

The locii are part of a survey DWG file that I have imported. I re-imported it with 'convert all objects to 3D' enabled, so now all the 2D locii are 3D locii.

Still, would be interested to see what the script would look like as I would like to learn more about VectorScript.

I have had this problem with quite a few surveys that have only provided 2D information.

First of all I have a script that converts all 2D loci to 3D which I can post later.

Then the next script is still quite long winded.

What it does is if you select the text box with the spot height in it and the 3d loci, it will move the 3D loci in the Z axis to the value in the text box.

Surveys normally come in metres and I work millimetres so it times the value by 1000 to move it in mm you can delete that bit if you want.

{With a textbox and 3dloci selected it moves the 3D loci in the Z axis to the value in the text box}

PROCEDURE ConvTEXTto3DZ;

VAR

waldo,myHan,h,itemHdl : HANDLE;

index,colour : INTEGER;

Zme,locX,locY,locZ :REAL;

testString,criteria :STRING;

BEGIN

Locus(0,0);

waldo:=LNewObj;

myHan:=PrevObj(waldo);

DelObject(waldo);

itemHdl:= myHan;

colour:= 32;

WHILE (itemHdl <> NIL) DO BEGIN

CASE GetType(itemHdl) OF

10:BEGIN

testString:=GetText(itemHdl);

Zme:= Str2Num(testString);

locZ:= Zme * 1000; {converts meters to mm}

SetPenFore(itemhdl,colour);

END;

9:BEGIN

Move3DObj(itemHdl,0,0,locZ);

SetPenFore(itemhdl,colour);

END;

END;

itemHdl:= PrevSObj( itemhdl );

END;

END;

RUN(ConvTEXTto3DZ);

The script also colours both the text box and the 3D loci blue so I know which ones I have done.

It still leaves quite a bit of work to do but if you put the script on your right click menu you get through most surveys quite quickly.

If anyone has any other faster methods I would love to hear them.

Also thanks to waldo for the waldo handle method, I use it a lot.

Edited by amogle

Thanks a lot for this, it's an awesome tool! I had some trouble getting it to work but then I figured out that the locus has to be below the text object in the stacking order. Just select all locii, send to back, and Bob's your uncle.

Some times it is worth calling the surveyor and asking what they have used to create the survey. I had a crappy 2D survey come through recently. I could not get the info I needed for the DTM. I called the surveyor and asked what they could export. I think they just sent me a mesh. I was able to select the mesh and convert directly into the DTM.

I set the DTM to have the same intervals for contours as the 2D drawing sent. I overlaid the 2D contour drawing I originally received and incredibly the contours were exactly the same!.

Most surveys are now smart 3D models of the land. The info we get is a translation of the 3D into 2D for printing. We then get sent the DXF of the 2D out put. Thus it pays to always ask for both the 3D mesh and 2D drawing.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×