phin Posted July 30, 2021 Share Posted July 30, 2021 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. 1 Quote Link to comment
Popular Post Julian Carr Posted July 30, 2021 Popular Post Share Posted July 30, 2021 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); 6 Quote Link to comment
phin Posted August 22, 2021 Author Share Posted August 22, 2021 Realised I never replied to this - thank you so much @Julian Carr - your code works perfectly 🙂 I really appreciate it - have used it a couple of times now. Thank you Quote Link to comment
GeorgeWL Posted August 25, 2021 Share Posted August 25, 2021 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! Quote Link to comment
Julian Carr Posted August 26, 2021 Share Posted August 26, 2021 I think you will find the problem is only with the decimal precision you have set in the Units dialogue. Increase this to 2 or 3 and you should see the decimal places correctly. Quote Link to comment
mtrinca Posted November 18, 2022 Share Posted November 18, 2022 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? Quote Link to comment
Pat Stanford Posted November 18, 2022 Share Posted November 18, 2022 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. Quote Link to comment
kwik Posted January 15 Share Posted January 15 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 Quote Link to comment
Poot Posted January 15 Share Posted January 15 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 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. Quote Link to comment
kwik Posted January 15 Share Posted January 15 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 Quote Link to comment
Poot Posted January 15 Share Posted January 15 (edited) 8 minutes ago, kwik said: That's strange... I get this dialogue box that prompts for a Z-value for every text-object 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 January 15 by Poot Quote Link to comment
kwik Posted January 15 Share Posted January 15 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! 1 Quote Link to comment
unearthed Posted Tuesday at 02:17 AM Share Posted Tuesday at 02:17 AM 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! Quote Link to comment
Recommended Posts
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.