How to make a list as one value
The first attachment is my first design for calcuating on 555 timer. But as you see, I did not finish the circuit diagram. To finish the diagram, I have to connect all the lines between the ndoes of the components. So I want to create many node objects to keep the nodes' infomation. I try to implement it by the zip node and combine node.
But after I combining two ContactNodes(output node is zip map), the combine node outputed into two values as the zip node's two inputs. So the zip map's keys and values mismatched.
If there is a node can output a list as one value not as multi-value, the problem would solved.
Anybody can give me some advice?
- 屏幕截图_2021-01-04_125156.png 176 KB
- 屏幕截图_2021-01-04_125249.png 146 KB
- 屏幕截图_2021-01-04_125343.png 152 KB
- 屏幕截图_2021-01-04_125424.png 16 KB
Comments are currently closed for this discussion. You can start a new one.
|?||Show this help|
|ESC||Blurs the current field|
|r||Focus the comment reply box|
|^ + ↩||Submit the comment|
You can use
Command ⌘ instead of
Control ^ on Mac
Support Staff 1 Posted by john on 04 Jan, 2021 07:19 AM
Looks like a fun project - and perfect for Nodebox!
I'm having a hard time understanding exactly what it is you are trying to do. (In future, when asking for help, please attached a zipped ndbx file so I can see the settings of each node and see more clearly how they are all connected - MUCH easier than trying to puzzle that out through squinting at multiple screenshots).
If you are trying to build a lookup table, instead of zipping zipmaps together, try thinking about everything as a table.
A zipmap is just a table row, and a table is just a list of zipmaps. So if you want, you can leave your component subnetworks as they are now - each one a zipmap - and then just use a combine node (as you are already doing), to build up a multi-row table. If you render the your combine2 node you should already see a two-row table. No need to feed that into another zipmap node.
Tables are extremely useful. Depending on what you want to do you could represent each component in your circuit board as a row in your lookup table, or even each "node" of each component as a separate row. You could then filter your lookup table to pull out info about all the components of a certain type, or isolate a single component. You could then use a lookup node to retrieve information about that component.
If the overall grouped shape of your component is a group in the "shape" column of your lookup table, once you retrieve it you could then hook that to a centroid to determine its current position, or ungroup it to recover the little rectangles of each "node" in that component. Once you have filtered and used lookups to get a pair of component nodes, you can just feed those into a link node to draw a wire between them.
If you want to keep track of each pair of connected nodes, you can use another lookup table just for that. Each row would list the component number and position of the start node and end node (plus maybe an ID and additional information about that wire). You could then draw all the wires at once by simply feeding the rows of the pair table into a subnetwork which would lookup both start and end nodes from your main lookup table and then return the links as outputs.
As you build your tables, you may find it more convenient to use the make_table node instead of combining individual zipmaps. Just feed the raw data (a list of each type, a list of each number, etc.) into the make_table node and build the entire lookup table all at once.
ANOTHER great thing about tables is that you can import and export them as CSVs. I will say more about that in my answer to your other question.
Does that help? If not, please tell me more. I can share some example code if that would clarify things.
Good luck and thanks for sharing your project. Keep those questions coming!
2 Posted by ahuman on 04 Jan, 2021 12:23 PM
Thanks for your reply. Your reply is detailed and clear. I read your reply twice. I understand what you said basicly. I need to digest it.
The reason why I didn't upload my ndbx file is because that I had not organized those nodes enough. It's a little mess.
About the stateless feature of the Nodebox node, I've already found it before. And I had read your other posts memtioning it. But I still want to implement a feature: outputing a list as a list type value not separated parts. The Group Node just serves for the geometry objects, not the other type values.
Support Staff 3 Posted by john on 04 Jan, 2021 11:00 PM
I know what you mean about the group only working for geometric objects. There are several workarounds.
One, which you are already using, is using zipmaps (or table rows). This lets you store heterogeneous types of information in a single unit. You can't break them back into their constituent parts with a single node, as you can with the ungroup node, but instead can use lookup nodes to retrieve each part. It would be easy to make a general purpose subnetwork to do this automatically (take in one zipmap or table row at a time and spit out all its parts as a list).
Another option is to simply output the parts separately using a combine node. If your component nodes did this, you could retrieve individual parts using the "first" node to get the first part, the "second" node to get the second, and a slice node to get any other parts you might need.
Regarding the larger issue of how to structure your templates, components, and wires it might be worth taking a step back and focus on exactly what you are trying to accomplish with this project.
Do you want to:
I can see ways of doing all these things in Nodebox. The strategy you use in how and where to represent chip templates, update specs, draw wires, etc. depends on what exactly you are trying to do.
Please keep me posted on this interesting project!
4 Posted by ahuman on 05 Jan, 2021 04:07 AM
Thanks for your reply. I haven't thought that far ahead.
I uploaded a screenshot which I took of half year ago. When I was at junior middle school, I didn't have my own computer, but I found a software called PCB Wizard 3.6 in an electronic magazine. Then I buyed this software. It took a month and a half of my salary. I did summer jobs then to pay it. At that time I used to use Protel 99SE , but its symbols are ugly. And the symbols of PCB Wizard 3.6 is beautiful, just like the attachment. I buyed that software, but I didn't have my own cumputer. So I installed it into my classmate's computer. I registered the software three times and got three activative codes. But after I reinstalled the system in my first cumpter, I have to apply for a new activative code. And it was impossible to get a new code. There is three times registering limitation.
I couldn't use that software anymore. When I went to university, I could connect to the internet. I started trying to find the cracked version of this software. But what I found is version 3.5 and not version 3.6.
When I get older, I realize that I can create such software by myself. Because I could program 20 years ago already. Half of year ago I try to implement it by using NodeBox, but ran into some diffcult. I just finished drawing some symbols as the first attachment shows.
In the second attachment, I used a mouseposition node. It makes me can select any part of the PCB components and the selected part would be highlighted. I can change the pins' number of the IC dynamicly. It's funny.
Support Staff 5 Posted by john on 05 Jan, 2021 07:05 AM
Thanks for sharing these details and screenshots. This sounds like a fascinating project.
I spent some time looking at other screenshots from PCB Wizard 3.6. Attached is a typical example showing both a symbolic and photorealistic representations of the same circuit. You could absolutely do both of these representation styles in Nodebox - and even make them look a little better (if you wanted).
My hunch is that making the components is the easy part. Doing the wiring may be a little harder. Label placement can also be surprisingly tricky to do in an automated way.
Is there a particular circuit board you want to recreate? Or would you like to make a wide variety of significantly different designs built from a large set of possible components? In other words, do you want to make a loving one-off which you would bring to a high polish? Or are you trying to make a system that can produce acceptable circuit boards at scale?
Another way of asking this is: "Who is your audience?" Are you doing this purely for your own pleasure (what I call a "ponarv")? Or do you want to go into the business of producing custom circuit boards for other people?
Your answers to these questions might help you decide what kind of balances to strike in your design. For a one-off you could save time by optimizing for that particular design and do hand work to make it just right. For a system you would need a much more robust and generalized way of defining parts and might need to make some compromises to normalize the way you define templates so that one system can produce a wide variety of different components.
Either way, I would be happy to help you. I could even recreate a particular circuit so that you can study how I would do it. But I am reluctant to do too much for you since the fun of this project may be to figure out how to do it yourself.
Let me know how I can help. And if you do get stuck, as you did last summer, please don't hesitate to ask specific questions so I can help you get unstuck.
6 Posted by ahuman on 05 Jan, 2021 07:23 AM
Yes, I just do this for pleasure. There are too many PCB software. It is not likely that I promote this kind of software. Of course, NodeBox may be my tools daily. Perhaps I use it in my work in the future.
ahuman closed this discussion on 05 Jan, 2021 07:27 AM.