Jump to content
Developer Wiki and Function Reference Links ×

String2Name not working with CC devices


SAmmerman

Recommended Posts

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

Link to comment
  • Vectorworks, Inc Employee

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.

Link to comment
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?

Link to comment
  • Marionette Maven

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

Link to comment

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.

Screenshot 2024-12-11 144957.png

Link to comment
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! 

Link to comment

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.
Screenshot2024-12-12130339.png.c750a763c54ebcdb3e5572fa09eba9a2.png


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

Link to comment
  • Marionette Maven

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

Link to comment
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!

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...