News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Fast Batch Properties Updater

Started by Yacine, June 30, 2024, 12:28:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine

Hey Guys!

I want to revise a tool I've been using for a while that's been a real time-saver, especially for P&ID work. It's a simple VBA script that helps me update shape properties in bulk. Here's the gist:

You input a property row name and a value, and the tool assigns that value to every selected shape that has that property. For example, I can set prop.machine = "ABC" for all selected shapes on a page, or prop.prefix = "Y" for all the solenoid valves I've selected. It's been a lifesaver when I'm dealing with dozens or hundreds of shapes that need the same update.

Now, with all this AI buzz going around, I thought, "Why not kick it up a notch?" So I'm rewriting the whole thing in Python with tkinter. The goal? Make it smarter, more flexible, and available to more folks who might find it useful.

Here's what I'm thinking of including:

1. Dynamic field selection from shapes
2. Updating multiple fields at once
3. Template-based updates (save your common tweaks!)
4. Conditional updates (only change if X is true)
5. Batch processing for multiple shapes
6. Undo feature (because we all make mistakes)
7. Logging changes (for when you need to track what happened)
8. User profiles to save your preferences
9. Incremental numbering option
10. Maybe even allow custom functions for advanced users

I'm pretty excited about this project, but I'd love to hear what you all think. Any features you'd like to see? Any potential pitfalls I should watch out for?

For those of you working with P&IDs or any diagrams with lots of properties to manage, what would make your life easier? I'm all ears for suggestions, critiques, or just general thoughts.

Cheers!

And a first mockup:
Unbenannt.PNG
Yacine

Thomas Winkel

We have several tools to deal with shape data:
"selection mask", "find & replace", "edit in Excel", ...

But the most used tool is a simple "select same" button:
If only one shape is selected, it selects all shapes of the same type on a page.
Else, it deselects all shapes that are not of the same type of the primary shape.
Then you can use Visios "Shape Data" window to edit the data of the selection.

I'm not sure if I completely understood your idea, but this will probably be a power tool for power users.

You cannot view this attachment.

Yacine

I like what you showed, but that is not my use case.

Example 1 - Allocation of pneumatic ports to process valves.
I start the dialog, give an intial value, then select one process valve after the other and get the prop.PORT populate with incremented values. That is something that I would otherwise have to type in a table or worse in the props window.

Example 2 - You draw a new diagram, with no data at all and want now to define the functional groups of the shapes.
You start the dialog, define the value of prop.FunctionalGroup and start clicking the shapes.
If you want an other value, you just modify the value in the dialog and continue, whithout having interrupted your workflow.
If you want to do something else in between, you uncheck the "active" checkbox, until you want to resume editing.

These are very common tasks in my workflow, where your tool could not help.
Yacine

Thomas Winkel

Sounds very similar to our use case.
But for electric schematics, not P&ID.

Good idea to increment click by click on select event.

We work a lot with numbers in string, like: Tank-1_Valve-001
Then we copy this channel several times until like: Tank-1_Valve-157
And then we copy the complete schematic for Tank-1:
* Tank-2_Valve-001 .. Tank-2_Valve-157
* Tank-3_Valve-001 .. Tank-3_Valve-157

For that reason we provide common increment patterns:
You cannot view this attachment.
But we can only increment "on copy", or position based (left > right, top > bot).

Such an "on click" solution would be a good enhancement.

Btw. do you use Visios "External Data" feature in your P&ID project?

Yacine

Using Regex for editing properties is indeed a nice one. I will steal that idea. ;)

External Data - no. I have my Access DB, which connects to an open Visio file, it imports the data into tables and modifies right away each change in Access to Visio.
Visio is the single source of truth. Access is for tabular editing and generating reports.
Yacine

Thomas Winkel

RegEx is really powerful, but also just as complicated ;D

We use the "External Data" feature a lot.
So, most projects consists of two files: The Visio document and a connected Excel workbook in the same folder.
Powerful, but medium usability. Sometimes I have to repair projects due to incorrect usage.

Your Access solution sounds interesting. Is this Visio / Access feature, or custom code?
Where can I read more about that?
We do similar with Excel, but this is specific export code and events in Excel VBA to transfer changes back to Visio.

Yacine

Regex, yes complicated, but you're not supposed to write it by yourself. In the past you had these online specialised sites, where you would tinker until fine. Now with AI, you describe roughly your need and get the according regex code. In the GUI you can show the code, but relevant is the title you give it.

I hade for a several years a combo of 3 files. Visio, a backend DB holding the project data and a frontend for the code, forms, reports and so one.
I misliked having two files for the project, specially when I had more than one drawing in a folder. So I now save the Metadata as tab separated texts on a "DATA" page. The text shapes are given descriptive names ("table_projectdata", "table_pneumatic", "Table_Ammendments", etc.). When I connect to Visio, I right the data of these shapes and populate the actual tables in Access.
I'm rather happy with the result. Only caveat, I should not forget to save back to Visio.

That whole thing is custom coded, I absolutely wanted full control over the functions, no cheap addins.

I would not mind sharing it, but we could begin with a presentation in Teams if you want. I'll have some spare time next week. You know my Email, just invite me per teams.
Yacine

Thomas Winkel

Good idea to exchange via teams, I'll contact you per mail.

I noticed that you experiment a lot with AI bots for brainstorming, etc.
I keep thinking about how to use that in my projects. But I can't think of anything that makes sense.
Maybe let the AI make decisions instead of complex IF or CASE statements ::)

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 259 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1116KB.
Tokens: post-login.
Cache hits: 13: 0.00172s for 26,721 bytes (show)
Cache misses: 3: (show)
Queries used: 17.

[Show Queries]