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
Julian Carr Posted July 30, 2021 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); 4 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
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.