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);
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);

 

  • Like 3
Link to comment
  • 4 weeks later...

Hi Guys, 

 

Hoping you can help - this script is exactly what I need, however when I run the script it doesn't grab the decimals of the text box - any ideas?

 

i.e. a text box of 13.82 returns a 3d loci with a Z height of 13 

 

Thank you for any help! 

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