Jump to content
Developer Wiki and Function Reference Links ×

Turn text into stake - possible?


phin

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
  • 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
  • 1 year later...
On 11/18/2022 at 12:16 PM, mtrinca said:

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?

 

Hi. I'm new to scripts but was able to create this (i think) and try it out on a file I have received. It seems that I experience the same problem as mtrinca. 

Are you able to do something with this @Pat Stanford?

OV_Anleggsvei.vwx

Link to comment
36 minutes ago, kwik said:

Hi. I'm new to scripts but was able to create this (i think) and try it out on a file I have received. It seems that I experience the same problem as mtrinca. 

Are you able to do something with this @Pat Stanford?

OV_Anleggsvei.vwx 6.64 MB · 0 downloads


I'm able to convert the text into 3d loci using the script in the file you uploaded. I used magic wand to select all the text objects, then ran the script from the Resource Manager, and got all of the text objects as 3d loci

image.thumb.png.1b47346674ec09bfa16639bff0fd5225.png

 

I've also used the same script on other files I have where the text/height values are in Brackets, and it worked no problem.
 

Link to comment
10 minutes ago, Poot said:

then ran the script from the Resource Manager, and got all of the text objects as 3d loci

That's strange... I get this dialogue box that prompts for a Z-value for every text-object

image.png.52e8a33143df93d83a8d5c17bb5d22bf.png

Link to comment
8 minutes ago, kwik said:

That's strange... I get this dialogue box that prompts for a Z-value for every text-object

image.png.52e8a33143df93d83a8d5c17bb5d22bf.png


Have you doublechecked that nothing but text is selected? If I have a single instance of another type of non-text object I get the same error/prompt for z-values. Maybe check your magic wand settings?  

Or try a test by manually selecting a single/few text blocks directly and running the script.

Edited by Poot
Link to comment
24 minutes ago, Poot said:

Or try a test by manually selecting a single/few text blocks directly and running the script.

It worked by manually selecting. Behaves a bit strange. Sometimes it works, sometimes not. Even with the magic wand tool.

Anyway, i was able to complete it. Thanks!

  • Like 1
Link to comment
  • 2 months later...

Thanks Pat

On 7/30/2021 at 9:38 PM, Julian Carr said:

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);
VAR 
    pX, pY, rAng : REAL;
    r1 : REAL;
    Flag : BOOLEAN;
    i1 : INTEGER;
    s1 : STRING;
BEGIN
    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);
    END;
    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);
END;
BEGIN
    IF YNDialog('Replace text blocks with 3d loci?') THEN BEGIN
        ForEachObject(DoIt, (T = 10) & (Sel = True));
    END;
END;
Run(ReplaceTextWith3DLoci);

 

Thanks Julian, That's a remarkably useful script, runs very sweetly!

Success _ ReplaceTextWith3DLoci.JPG

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.

Guest
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...