leisure Posted September 8, 2022 Share Posted September 8, 2022 (edited) Hi everyone 🙂 I am trying to write rectangles with an attached multistamp from an excel-roombook into vectorworks.  My excel looks like this:  It is my goal to create rectangles in the given size with an attached Multistamp-Object which works like this:  Actually I did not find a way to place a MultiStamp at all. I only found a way to place a rectangle and tried to place a datastamp-object instead, but it doesn´t work 😞  import vs origin = [0, 0] direction = [0, 1] width = 5 height = 2 rec = vs.RectangleN ( origin[0], origin[1], direction[0], direction[1], width, height ) hDataTag = vs.GetObject('Test_2') vs.DT_AssociateWithObj(hDataTag, rec)  Actually I get the following error. I am using Vectorworks 2019.  Edited September 8, 2022 by leisure Quote Link to comment
MullinRJ Posted September 8, 2022 Share Posted September 8, 2022 @leisure, Â Â I am not sure why vs.DT_AssociateWithObj() is not recognized as it is working on my machine, but there is a problem earlier in your script. vs.RectangleN() does not return a handle. You must get its handle by using vs.LNewObj(). Â vs.RectangleN ( origin[0], origin[1], direction[0], direction[1], width, height ) rec = vs.LNewObj() Â After you make the above change, if you still get an error with vs.DT_AssociateWithObj() not being recognized, please write back. Â Raymond Quote Link to comment
MullinRJ Posted September 8, 2022 Share Posted September 8, 2022 I just reread your post. You mentioned that you are using VW 2019. vs.DTAssociateWithObj() was introduced in VW 2020. You will have to upgrade to be able to use it.  Raymond Quote Link to comment
leisure Posted September 19, 2022 Author Share Posted September 19, 2022 (edited) Hey thanks a lot Raymond, Â do you know if there was any option like that in VW 2019? I checked back with my office management and there is to no real possibility to upgrade to a newer version. Â Is there a way to find the "API" of the older versions like apidocs.co for Revit / Rhino / Navisworks? Â And is there a way to write custom DataTagInfos when a tag is placed like "Roomnumber"? Â vs.RectangleN ( origin[0], origin[1], direction[0], direction[1], width, height ) rec = vs.LNewObj() vs.GetObject('Test_2') hDataTag = vs.LNewObj() vs.DT_AssociateWithObj(hDataTag, rec) // Fill custom object parameters hDataTag.SetParameter("Roomnumber","101.01") Â Kind regards, Jannis Edited September 19, 2022 by leisure Quote Link to comment
MullinRJ Posted September 19, 2022 Share Posted September 19, 2022 Hi @leisure,   I don't think there was any command in VW 2019 of a similar nature. It is not a command I have ever used, so I don't know if there is another way to make the association. If it is possible, hopefully someone else will chime in with their insight. Or, you could contact Tech Support to see if you can get an answer from VW Engineering.    Yes, there is an online Script Reference at Script Function Reference. It is organized by category (list shown on the right sided of the page), so if you don't know the category of your command, use the Search field at the top of the page to locate it. Also, there is a similar HTML copy that ships with your software, but it is limited to the calls found in you version and older. You can find it in the VW Application folder under /VWHelp/Script Reference/ScriptFunctionReference.html. I usually use the HTML version first, then if I can't find the function, or I think there may be more information available, I check the online version.    At the top of each command in the HTML version, the "Born On Date" is listed to the right of the command name. In the online version, it is listed at the bottom, under the section titled Version. If the function has been deprecated, that "date" is also listed. By "date" I mean VW version.  HTH, Raymond Quote Link to comment
MullinRJ Posted September 20, 2022 Share Posted September 20, 2022 Hi @leisure,   In your example above, your first two lines appear to be syntactically correct, but the rest are not. Originally, I think you had the first two correct.  vs.GetObject('Test_2') hDataTag = vs.LNewObj() should still be: hDataTag = vs.GetObject('Test_2') but this assumes there is a Data Tag on the drawing with the name 'Test_2'. If 'Test_2' is a name to another VW object, you'll get a handle to some other object type. You might want to test the handle you get to ensure it is a PIO instance (type = 86), and that the name of the PIO your handle points to is 'Data Tag'.   But, if you are wanting to PLACE a Data Tag, then you need to use: hDataTag = vs.CreateCustomObject('Data Tag', X, Y, 0) Note vs.CreateCustomObject() returns a handle so you do not need to use vs.LNewObj().   and the 5th line returns a boolean, so you might write it like: if vs.DT_AssociateWithObj(hDataTag, rec): hDataTag.SetParameter("Roomnumber", "101.01") # Fill custom object parameters assuming the hDataTag.SetParameter() line is syntactically correct, but I doubt Handles have the attribute "SetParameter". If I were to guess, I think you have to access the PIO's record with SetRField() and access the right parameter, but I'm guessing here as I've never played with Data Tags.  HTH, Raymond 2 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.