kduncan Posted May 21, 2020 Share Posted May 21, 2020 (edited) Hello, Although I have been using Vectorworks for many years I have never had cause to venture in to the world of Marionette and am looking for a little guidance. I have an imported DWG file that has a number of focus positions denoted by a circle and a text numerical reference. I would like to try to write a Marionette script that will take the centre point of these text objects and create focus points at those coordinates, and ideally take the text and use it as the focus point name. Id be grateful for any pointers to set me in the right direction. Cheers. Keith Edited May 21, 2020 by kduncan Correction Quote Link to comment
Pat Stanford Posted May 21, 2020 Share Posted May 21, 2020 Unless there is something special about those object (color, layer, class, attached record or field value), you are not going to have much luck with scripting them beyond manually selecting them and running the script. Unless the circle and text are in a block of some kind, it is going to be very hard to script getting the correct text Data to use as the focus point name. Unless you get these files on a regular basis or this file has a huge number of points, I doubt it is worth it unless you really want to use it as a learning exercise. My first guess is that you will spend at least 4 to 10 hours to make a script or marionette that will work. I would think you could manually create a lot of focus points in that time. HTH. If you really want to do it, post a file with a couple of the circles and text blocks and we can see if there is a way to automate it. https://imgs.xkcd.com/comics/is_it_worth_the_time.png https://xkcd.com/1205/ Quote Link to comment
kduncan Posted May 21, 2020 Author Share Posted May 21, 2020 Pat. Thanks for the response. This is primarily a learning exercise, but for the current project I am involved with there will be quite a few of these files coming in with varying numbers of text blocks up to the many hundreds, so it would be nice to streamline the process. Getting the relevant text (I discarded the circles) isolated in to their own class is quick and easy. I have been working on a script using reference from a script by Timothy Besada another member on here who made a script for generating focus points for arrays of lights. (I hope that isn't agains board rules) So far I have managed to make it create focus points at the text block locations but can not get the text to become the focus point name. Once again many think for any help, and no worries if not. Cheers. Keith Focus Points from Text test .vwx Quote Link to comment
Pat Stanford Posted May 22, 2020 Share Posted May 22, 2020 Hi Keith, You have made a great start. I don't have enough time (or maybe enough skill) to figure out the full marionette tonight, but one thing I did see is that you have the wrong field name. The String node setting the field name is passing Text instead of the Field Name which is just Name. The other field and record names look correct. I made the change on my copy and still got focus points names A to H. Good luck and ask again. I am sorry I was a bummer earlier. I am always glad to help anyone who is trying to help themselves. I just occasionally get frustrated at the people who want 40 hours of someone else's time to solve a 10 minute problem for them. Quote Link to comment
kduncan Posted May 22, 2020 Author Share Posted May 22, 2020 Hi Pat. Thanks for taking a look, I have updated the field name String that you mention and am still seeing the names A to H also, I have played about with the Replace String node and a few others, but seem to be getting nowhere. No worries, appreciate you having a look, am enjoying starting to understand a bit about Marionette, having never had to venture in to a scripting world before its very interesting. Quote Link to comment
Pat Stanford Posted May 23, 2020 Share Posted May 23, 2020 My guess is the the focus point is actually being created after you name it. In Vectorscript, there is a Redraw command that will kind of update/create objects before the script ends. I don't think there is a similar function in Marionette. Try moving the naming step to the very end of the network and see if that works. HTH. Quote Link to comment
kduncan Posted May 24, 2020 Author Share Posted May 24, 2020 I have tried shuffling the nodes around to put the name at the end, but it still isn't happy, I wonder if there is an link in the Focus Point that requires there to be a lighting instrument in order to assign the name. Thanks again for the help, but your chart in your first relay is definitely looking more true. K Quote Link to comment
kduncan Posted May 25, 2020 Author Share Posted May 25, 2020 (edited) Hi again Pat. I got it, 3rd cup of coffee moment. Thanks again for the prodding, it was actually that the naming step had to be nearer the beginning. Its not very elegant and still a few things that aren't quite right but it does what I set out to do. Which is lucky as I have just had a DWG sent over that as over 1300 points on it that need converting. I think my time to productivity ratio just improved. Cheers. Focus Points from Text Working .vwx Edited May 25, 2020 by kduncan Completing the message 1 Quote Link to comment
Pat Stanford Posted May 25, 2020 Share Posted May 25, 2020 Congratulations!! You have now passed the first test of being a programmer. Are you willing to be more stubborn than the computer until you force it to bend to your will!! ;-) 1 Quote Link to comment
Vectorworks, Inc Employee SBarrettWalker Posted June 11, 2020 Vectorworks, Inc Employee Share Posted June 11, 2020 I am coming in a little late to this conversation but I created a network for Landmark users a while ago that sounds very similar to what you want. Now that you have gotten started, you may not need this, but it might still be a helpful resource. Quote Link to comment
kduncan Posted June 11, 2020 Author Share Posted June 11, 2020 Thanks for that Sarah. Ill have a look, it does read like its quite similar. Even to look at the script and see what you have done will be good. Cheers. Quote Link to comment
dhu Posted August 20, 2020 Share Posted August 20, 2020 Hi Guys I'm struggling with a very similar issue. I have a textfield and a 2D symbol. The textfield shows the hight (z-coordinate). So it's basically a cross in form of an 2D symbol and next to it, there's the textfield with the numbers. It's a classical example of showing highpoints in 2D like anno 1864. What i need is a script which takes first the x- and y-coordinate from the textfield. Then takes the content from the textfield and converts it into the z-coordinate. And then I want to convert the textfield into an intellegent object like the focus points. is there a way to modify the script of kduncan? or should i start from the beginning? Quote Link to comment
Nico_be Posted August 26, 2020 Share Posted August 26, 2020 Hello, Take a look to my script, I think it does what you want https://forum.vectorworks.net/index.php?/topic/69234-convert-string-to-real-number/&do=findComment&comment=341470 1 Quote Link to comment
dhu Posted August 26, 2020 Share Posted August 26, 2020 that's perfect! thanks! 1 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.