SAmmerman Posted December 11, 2024 Share Posted December 11, 2024 I'm trying to pull ConnectCAD device names from records and use the resulting values to grab those devices, but it looks like I have to convert them to handles for it to work. I can't get the String2Name downloadable node to do that for me, and I don't know enough about scripting to figure out why. In the attached file, the node is using a static string containing the name of a device, rather than the sFieldValue output of the nearby Get Record node, so it's clear that the field value output isn't the source of the problem. Anybody have any ideas about how to make this work? VC Pickerington Campus - fka East - script experiment version.vwx Quote Link to comment
Vectorworks, Inc Employee SBarrettWalker Posted December 11, 2024 Vectorworks, Inc Employee Share Posted December 11, 2024 This node works with the Name field at the very bottom of the OIP, not the Device Name field. Without creating a custom node, the only node I can think of that will work is the Obj by Criteria node, but that doesn't have an input, you would have to create the criteria within the node. Quote Link to comment
Marionette Maven Marissa Farrell Posted December 11, 2024 Marionette Maven Share Posted December 11, 2024 A quick workaround with native nodes, though not as efficient as writing a new node, is attached here. VC Pickerington Campus - fka East - script experiment version_MFarrell.vwx Quote Link to comment
SAmmerman Posted December 11, 2024 Author Share Posted December 11, 2024 47 minutes ago, SBarrettWalker said: This node works with the Name field at the very bottom of the OIP, not the Device Name field. Without creating a custom node, the only node I can think of that will work is the Obj by Criteria node, but that doesn't have an input, you would have to create the criteria within the node. Huh... does that mean ConnectCAD devices don't normally have Object Names? I'm trying to map that field to my custom record and nothing's showing up. Would it break something if I tried to set a name for them? Or would that just not work? Quote Link to comment
Marionette Maven Marissa Farrell Posted December 11, 2024 Marionette Maven Share Posted December 11, 2024 I'm not super familiar with ConnectCAD objects at this point, but I'll ask the tester in that area to try to gather more information. I can't see any reason why you couldn't set a name in the OIP field for them. 1 Quote Link to comment
SAmmerman Posted December 11, 2024 Author Share Posted December 11, 2024 I'm currently testing out a run with the If and Filter commands, and it seems like it should work but will only add the Output Circuit Number to RELA-004. Definitely better than before, but not there yet. VC Pickerington Campus - fka East - script experiment version_MFarrell filter edited.vwx Quote Link to comment
Marionette Maven Marissa Farrell Posted December 11, 2024 Marionette Maven Share Posted December 11, 2024 Short answer - the If In String node doesn't absorb the lists, so it's comparing them 1 to 1 and not cross referencing. I'm not entirely sure what I'm looking for for results because I haven't explored your file in depth, but here's a possible fix using a Mix2 node. Let me know if I'm heading in the right direction. VC Pickerington Campus - fka East - script experiment version_MFarrell filter edited_MFarrell.vwx Quote Link to comment
SAmmerman Posted December 11, 2024 Author Share Posted December 11, 2024 This is closer! It got about 3 devices this time. The field circled in green is what I'm trying to copy from the circuit to the device. The screenshot shows one of the ones it did successfully. Also, I just noticed that I'm gonna have to do something to correct the data for multi-output devices. Might just pare the initial criteria down to selected circuits once it's working properly and handle the multi-output ones manually for the time being. Quote Link to comment
SAmmerman Posted December 11, 2024 Author Share Posted December 11, 2024 Y'know, the fact that this stuff is case-sensitive is probably one of my issues. I'm not used to that mattering in most situations! Quote Link to comment
Marionette Maven Marissa Farrell Posted December 11, 2024 Marionette Maven Share Posted December 11, 2024 I missed another spot that you needed a Mix2. Here's an updated file. It looks like it works. VC Pickerington Campus - fka East - script experiment version_MFarrell filter edited_MFarrell_2.vwx Quote Link to comment
SAmmerman Posted December 11, 2024 Author Share Posted December 11, 2024 1 minute ago, Marissa Farrell said: I missed another spot that you needed a Mix2. Here's an updated file. It looks like it works. VC Pickerington Campus - fka East - script experiment version_MFarrell filter edited_MFarrell_2.vwx 3.76 MB · 1 download Yes, that did it! Thanks! I also started exploring the option of assigning Object Names via get/set record commands, and that seems to be working! Quote Link to comment
SAmmerman Posted December 12, 2024 Author Share Posted December 12, 2024 I have now run into a problem: Some of the numbers are being assigned incorrectly. For example, the device "A Light 4" shows N 003 as its output circuit, but N 003 is not connected to it. Looking at how things are mismatched, it seems like 3 cables (N 001, D 002, and D 003) got skipped entirely. That corresponds with the number of devices in the drawing that act as destinations but not sources. This is a different file than the previous one (it was getting a bit too messy in there), but this file uses the same custom records data and many of the nodes are copy/pasted from the other file. It seemed like it was working at one point, and I'm not sure what exactly changed. Serious script experiments - what is wrong here.vwx Quote Link to comment
Marionette Maven Marissa Farrell Posted December 12, 2024 Marionette Maven Share Posted December 12, 2024 I rearranged some things here - moved the Mix2 node so you only need one, added another filter. Just a quick note on the Print Debug nodes, if you weren't aware, if you put 0 for Max Items to Print, it will give you the input whole list. If you want to suppress the output text, you can disable them (as long as they don't have anything necessary attached to the output port). Figured I'd mention it just in case. Serious script experiments - what is wrong here_MFarrell.vwx Quote Link to comment
SAmmerman Posted December 12, 2024 Author Share Posted December 12, 2024 31 minutes ago, Marissa Farrell said: I rearranged some things here - moved the Mix2 node so you only need one, added another filter. That looks SO much better! And it also seems to be working perfectly. Thanks so much for your help - this kind of thing is going to save my team a lot of work over the next few years! 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.