Jump to content

Turn text into stake - possible?


Recommended Posts

Hi all,


I've never used Vectorscript (but do have a compsci degree and could cobble together code if need be!) but I was wondering if you think it would be possible to achieve the below, and if so if you have any tips on where to start.


I would like to take a landscape site survey (AutoCAD DWG import) and turn the text fields for spot heights into stakes, where the value of the text would become the stakes Z value. 


For ease, I think the location of the stake would have to be the text's centerpoint - they usually come in with an X (symbol) marking where they are, but there is nothing to link the text and this symbol together apart from proximity, so I don't think it would be easily doable.


This would in effect give me a terrain for a 2D drawing.


I could easily enough isolate the level text onto their own layer.


Your thoughts would be appreciated!


Thank you.

  • Like 1
Link to comment

This should get you started. It creates 3D loci not stakes, but maybe someone else will offer that bit:


Procedure ReplaceTextWith3DLoci;
Procedure DoIt(h1 : HANDLE);
    pX, pY, rAng : REAL;
    r1 : REAL;
    Flag : BOOLEAN;
    i1 : INTEGER;
    s1 : STRING;
    s1 := GetText(FSActLayer);
    i1 := Pos(' ', s1);
    IF i1 = 1 THEN Delete(s1, i1, 1);
    i1 := Pos(' ', s1);
    IF i1 > 0 THEN BEGIN
        Insert('.', s1, i1);
        Delete(s1, i1 + 1, 1);
    IF NOT ValidNumStr(s1, r1) THEN r1 := RealDialog('Z value:', s1);
    GetTextOrientation(h1, pX, pY, rAng, Flag);
    Locus3D(pX, pY, r1);
    IF h1 <> Nil THEN DelObject(h1);
    IF YNDialog('Replace text blocks with 3d loci?') THEN BEGIN
        ForEachObject(DoIt, (T = 10) & (Sel = True));


  • Like 4
Link to comment
  • 4 weeks later...
  • 1 year later...

Hi, i realise this is an old post however i was also trying to convert lots of text points on a survey file into actual z values or a 3d loci. But when i try the above the a small table then appears and wants me to enter a Z value (and seems to want one for every point) so it's not actually transferring the number in the text as the value. Any ideas what i'm doing wrong here?


Link to comment

The script is not reading the way your text is formatted properly to be able to make it into a valid number so it is asking for the value instead.


Post a small file with a sample of how your text is formatted (what unit marks, any prefix or suffix that is not a number, etc.) and we should be able to give you a version that will work for your need.

Link to comment

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.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

  • Create New...