3D-STEP Coloring App - Posted At GitHub (Released Prelim Version)

I have tested your program on Linux Mint 21.1 and it works like in your video.
I uploaded my own file step of an smd inductor and tried to vary the colors but the interface remained on the resistance mode.
How do I change the colors of any step object?

Thanks for the work done.

PS: Suggest that there are examples of how to edit generic .step files but on github I have not found such examples.

Thanks for checking out the App.

Not sure what you mean by “resistance mode” but, to clarify the changing GUI presentation:
• When either a “Resistor” or, “Select A Part” is selected in the List, the three color bands are available.

• When a “Capacitor”, “Jumper” or “LED” is selected in the List, only a Single color band is available because they are single color parts (as I defined them in code and in the provided STEP files).

Changing any STEP file is Not really doable, as-is.
Near the end of the Second video (posted on Github) I show how to do it by First preparing any STEP file by Changing it’s RGB color value to “1” by using most any other progam/app.
(Note: you may also think you can Text-Edit the value to “1” but, the STEP and my code-hooks use the value After it’s converted to decimal by exporting as STEP (many Drawing Apps that have color selections feature ability to set the values in Decimal, HEX, ARGB… etc. You can do it in FreeCAD, others…BUT, the set values GET Converted to Decimal during STEP Export by Magic. My Mac has Color format selection (screenshot below)

Doing it, in that sense, is no different than doing it in, say FreeCAD/other. Once done, and exported/saved as a STEP file, my Colorizer app will work on it. because it gets converted to Decimal RGB.

Naturally, a User would wonder “why bother, using the Colorizer app if I need to change the STEP in, say FreeCAD”. And, that is a valid point. So, the reason to prepare that STEP file and use the Colorizer app (and use the “Select A Part” feature is Simply to enable user’s ability to change the Color on that STEP file if using it in Kicad. on-the-fly.

The last examples in Second video shows doing it on a ‘Stock’ Kickad supplied STEP file.

Thanks ,
I thought I saw the second video but I was wrong.

Perfect I understand.
I used freecad to set the color of the faces.

I tried to add a screenshot but I can’t believe it.

One last thing, I was unable to load the plugin into kicad7 even though I corrected the path in the py file.
Maybe I did something wrong.

import sys
import pcbnew
import os
import subprocess
import wx

pcbnew.GetBoard()
from pcbnew import *

class SimplePlugin(pcbnew.ActionPlugin):
    
    def defaults(self):
        self.name = "STEP_Colorizer"
        self.category = "PCB_Parts"
        self.description = "STEP_Color_Changer"
        self.show_toolbar_button = True # Optional, defaults to False
        self.icon_file_name = os.path.join(os.path.dirname(__file__), '/home/tistructor/.local/share/kicad/7.0/scripting/plugins/3D_STEP-Colorizer-App-main/Plugin_For_Kicad/k_STEPcolor.png') # Optional, defaults to ""

    def Run(self):
        pass  # a Null command until there's executable code here...
  # This next line works from Kicad!!!!!! plugin
        subprocess.call(['/usr/bin/open','/home/tistructor/.local/share/kicad/7.0/scripting/plugins/3D_STEP-Colorizer-App-main/STEP_Colorizer_v1r0_MACwxLIN'])

SimplePlugin().register() # Instantiate and register to Pcbnew

Now I have succeeded.
Occasionally the edit screen hangs in “vivaldi”.

1 Like

I’m not quite clear on ‘succeeded’ and ‘hangs’…

So, you are able to use the Plugin?

You are able to set RGB values to ‘1’ and then are able to change the colors using my App?
(I’m assuming you set those three Faces to ‘1’ in FreeCAD then change them in my App ?). If so, Good job of understanding my confusing info…

The application works but kicad7 does not load the plugin.
No icon is shown and also in the list of plugins it is not detected.

I’m not a Linux guy but, in your Path string you show " .local " I’m not sure you should be using the ‘dot’ and, not sure about ’ - ’ dashes in the path… Underscores work.

Best to put the graphic icon file in the same folder as the script (then, there won’t be a need to set the Icon’s path (just set the file’s name). With the icon file in same folder, it should be found (I hope).

Re the List not detected. You call/run the App from some folder. The STEP files Must also be located in the same folder as the App so the App sees them.

I copied the path from the menager file “nemo” is correct…
the '.'refers to hidden directories.
You talk about kicad6 in the videos if I’m not mistaken.
Maybe with kicad7 the plugin is incorrect?

Well, Kicad v7 appears to have many bug’s but, I can’t say if that affects running the plugin.

Hidden on a Mac also means ‘Read Only’ and you may have access issue on Linux. It works fine on my Linux Mint 21.1

I get it. the .py file must be in the “plugins” directory and not in other subdirectories.
Now it works.
“/home/testructor/.local/share/kicad/7.0/scripting/plugins”

Schermata del 2023-03-31 17-16-56

1 Like

Excellent! Good job and followup! :smiley:

Bad,
I thought it worked but from kicad the application does not start.
I do some tests to understand the problem.

What is your path on linux mint?

I did a lot of tests by changing the path and editing the .py file but the app doesn’t start. inside kicad7

Let’s assume v7 is not the problem. Thus, a ‘Test’ consideration:

Just to see if problem is/isn’t file location and access

• Create a Folder on the Desktop, put the App and some of the listed STEP file in it.

Run the App from there to ensure all is good.

Then, Change the Path in the Plugin and see if plugin runs the App. On my system, it takes about 15 seconds to run after I click the Icon (why, I don’t know)

The Path on my Linux: Unfortunately, I was running Linux (with Kicad v6) in VirtualBox but, yesterday, I deleted Linux from VirtualBox and switched to UTM for running virtual machines and have not yet installed Kicad into Linux on this UTM virtual machine. Thus, cannot answer re the Plugin/Path question on Linux.

But, sounds like it’s not a Plugin or my App issue. Sounds more like a system file access issue…

We can do one simple test: I can post a Dumb Plugin - if you can get it running, that would confirm some aspects of the issue.

I’ll need some time to put it together and post it - should be within the next couple of hours (I have some things to attend to, first… and, more Black Coffee to drink)

Test done ,
if I start the app from the folder on the desktop it works but with the icon inside pcb_New with the modified .py file it does not start. I waited over 15 seconds but it doesn’t start.

Consider:

• The running App may be hidden behind the Kicad window (probably not but, worth checking)

• There are 3 or 4 different ways to run an External App from Python and a plugin. Using the “subprocess” method is the most-used, reliable way. But, you could try the “OS” approach - (change the necessary Path and App info):

os.system(‘/path_to_the_App/some_app’s.executable_file’)

Another Example - running a Java App:
subprocess.call([‘/usr/bin/open’,‘/Users/bruce/myJava_Out/Woof_R1.jar’])

Another Example - running a Windows App:
subprocess.call([‘/usr/bin/open’,‘/Users/bruce/Library/CopperCAM.exe’])

Another Example - running LibreOffice’s embedded DataBase App
subprocess.call([‘/usr/bin/open’,‘/Users/bruce/Documents/aDataBases/Project_Tracking1/Project_Tracking_1FORM.odt’])

Quick - test: Set the Path to Any App that works and try the OS approach (it may cause the App to keep running and/or close Kicad…) Machines/systems are not as smart as we think they should be…

You can Google around to find the others (probably quicker than my digging though stacks of paper)

Perfect,
With
os.system (“/home/tistructor/Scrivania/3D_STEP-Colorizer/STEP_Colorizer_v1r0_MACwxLIN”)

it worked properly.
Thanks

1 Like

Excellent! That saves me from digging through stacks of paper and re-loading Kicad into new UTM vm, I was very reluctant to do that because I just fully cleaned my system…)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.