Jump to content
Ultimaker Community of 3D Printing Experts

location of code which points cura to machine_instances


r0dnay
 Share

Recommended Posts

Posted · location of code which points cura to machine_instances

hi

 

i wondered if anyone could tell me which file contains the code which points cura to machine_instances with the following path

C:\Users\USERNAME\AppData\Roaming\Creality Slicer\4.8\machine_instances

 

thanks

  • Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    Uh. The code as developed by Creality. I have no idea what changes they made. Perhaps it's best to contact them for support / help regarding their fork of Cura.

    • Like 1
    Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    ok great, ill do that

     

    in the meantime, any idea whats the path for the code which checks machine configurations for the ultimaker cura software?

  • Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    ok thanks, would you be able to paste the path for the resources class file for ultimaker's cura? would be much appreciated

  • Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    i got the feeling help with what i need to do wouldnt be forthcoming and mentioning it might not cultivate an answer at all, but being as you asked,

     

    i am using creality's version of cura, i have 2 printers, ive learned that this software has issues with mixing comports/printer profiles etc

    what i thought id do is install two instances of the slicer, but regardless of where i install, the software will always only reference some kind of configuration from a central location, so every instance of the software would all reference the same files for printer configs etc

    to work around this, i thought i would change the code in one of the installations so that it references those 'config' files from another directory - thus each software will in theory (havnt done it yet to confirm) should automatically connect to the relevant printer, the only one set up on that particular installation.

     

    i figured that there must be a file somewhere that points to a path where the 'config' file is located, i though once i find it, i could edit the path and set up a printer solely on that installation.

     

    not sure if that makes any sense

     

    thanks for the name of the resources file name, but i was wondering where the file was put by the cura installation locally on my machine

     

     

  • Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    i found the file, it doesnt define a path to a file to reference machine_instance, thanks anyway, ill have a dig around and see if i can find where the software calls on machine_instances

     

  • Link to post
    Share on other sites

    Posted (edited) · location of code which points cura to machine_instances

    in the meantime if anyone else can point me in the right direction or knows python (im not a coder at all, but i can work some basic things out to a degree) well enough to scan through the files etc, itd be much appreciated.

     

    im sure plenty of cura/slicer users would love being able to use specific printers by opening seperate instances of the software, would be great to get a workaround

    Edited by r0dnay
  • Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances
    4 hours ago, r0dnay said:

    i am using creality's version of cura, i have 2 printers, ive learned that this software has issues with mixing comports/printer profiles etc

    Like @nallath I don't know what Creality changed in Ultimaker Cura to make it their own, so I can only talk about Ultimaker Cura.

     

    Ultimaker Cura has no issues with having multiple instances of the same or different printer profiles. You can add as many as you like, and switch between them within the application.

     

    Ultimaker Cura does however have only rudimentary support for USB printing because currently supported Ultimaker printers don't support USB printing. One of the things Ultimaker Cura does not habdle well is multiple COM ports. However, starting a new instance with a different configuration (which I think you want to do) will not solve that issue.

    • Like 1
    Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    thanks for that, noted.

     

    is there any way i can turn off com port sniffing/locking up, so cura only looks for the com port its holding on to?

    that way i can at least use another app for a different printer?

  • Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances
    1 hour ago, ahoeben said:

    One of the things Ultimaker Cura does not habdle well is multiple COM ports.

    which python files handle the hardware/com port side of things?  is there a particular reason/s why cura cant handle com ports well? what are the limitations cura faces? or is it human limitation? just trying to ascertain the best way to tackle this

     

    thanks again

  • Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    See https://github.com/Ultimaker/Cura/blob/4.13/plugins/USBPrinting/USBPrinterOutputDeviceManager.py#L111

     

    There is a (little known) environment variable you can set before starting Cura, that will let you limit what ports Cura "scans". CURA_DEVICENAMES. It accepts a resular expression pattern, but setting CURA_DEVICENAMES=COM4\: should limit Cura to only look at port COM4:. I am not 100% sure about the need for \:, and whether it actually works on Windows.

    • Thanks 1
    Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances
    8 hours ago, r0dnay said:

    is there a particular reason/s why cura cant handle com ports well?

    Like I said, no Ultimaker printers support printing over USB, so no development time is put in fixing it. What is there is just rudimentary, because the Ultimaker Original from almost 10 years ago still supported USB printing.

    • Like 1
    Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    Hello @r0dnay and @ahoeben.

    My one and only printer is a Creality Ender 3 Pro.  From what I've come across here and there on various sites, Creality made a decision to take both Marlin firmware, and Ultimaker Cura, and fork them into proprietary versions.

    Marlin can't support users who have problems with Creality firmware because no one at Marlin knows what Creality has done in their version.

    The same is true with Cura.  Creality has no doubt made changes to their version of Cura and so neither the in-house team at Ultimaker, nor the independent contributors (and AHoeben is a primary contributor) know what Creality has done because Creality doesn't share.  They aren't the only ones either.  Lulzbot and others have done the same thing.

     

    • Thanks 1
    Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    Lulzbot, when they were still active, actually contributed features back to Ultimaker Cura. The ability to load and visualize gcode in Cura was contributed by them.

    • Like 2
    Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances
    On 1/15/2022 at 8:07 AM, ahoeben said:

    See https://github.com/Ultimaker/Cura/blob/4.13/plugins/USBPrinting/USBPrinterOutputDeviceManager.py#L111

     

    There is a (little known) environment variable you can set before starting Cura, that will let you limit what ports Cura "scans". CURA_DEVICENAMES. It accepts a resular expression pattern, but setting CURA_DEVICENAMES=COM4\: should limit Cura to only look at port COM4:. I am not 100% sure about the need for \:, and whether it actually works on Windows.

     

    would it be CURA_DEVICENAMES or CURA_DEVICEINFOS for the com port location?

     

    i found this part in the code

     

    1            # set CURA_DEVICENAMES=USB[1-9] -> e.g. not matching /dev/ttyUSB0
    2            pattern = environ.get('CURA_DEVICENAMES')
    3            if pattern and not search(pattern, port[0]):

                  set CURA_DEVICENAMES=COM7<<<<<<<<added this line here but cura cant see the printer and wont make 'Print to USB' button available, so tried COM7\: which didnt work either is my syntax or location of code incorrect?
    4                continue

    5

    6            # set CURA_DEVICETYPES=CP2102 -> match a type of serial converter
    7            pattern = environ.get('CURA_DEVICETYPES')
    8            if pattern and not search(pattern, port[1]):
    9                continue

    10

    11            # set CURA_DEVICEINFOS=LOCATION=2-1.4 -> match a physical port
    12            # set CURA_DEVICEINFOS=VID:PID=10C4:EA60 -> match a vendor:product
    13            pattern = environ.get('CURA_DEVICEINFOS')
    14            set CURA_DEVICEINFOS=LOCATION=COM7
    <<<<<<<<<<<<<<<<<<<i added to this line also both ways, but that didnt work either
    15            if pattern and not search(pattern, port[2]):
    16                continue

     

     

     

     

  • Link to post
    Share on other sites

    Posted (edited) · location of code which points cura to machine_instances

    I did not suggest you edit the code. The file you are editing is written in Python, and set CURA_DEVICENAMES=COM7 is not python. Just putting stuff in random places without understanding does not often work. The way you edited the file, you just broke the entire USB printing plugin, hence Cura not "seeing" your printer. If you want to edit the code, I recommend you first look in to some basic Python tutorials.

     

    CURA_DEVICENAMES is meant to be an environment variable: https://en.wikipedia.org/wiki/Environment_variable

    You set an environment variable in Windows before starting Cura.

    Edited by ahoeben
    • Thanks 1
    Link to post
    Share on other sites

    Posted · location of code which points cura to machine_instances

    ah ok, didnt realise you meant OS environment variable, thanks for clarifying

    its ok, i hashed out what i added when it didnt work and it can see the printer, ill change the variable in windows and see how it goes, thanks

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    • Our picks

      • New here? Get ahead with a free onboarding course
        Hi,
         
        Often getting started is the most difficult part of any process. A good start sets you up for success and saves you time and energy that could be spent elsewhere. That is why we have a onboarding course ready for
        Ultimaker S5 Pro Bundle, Ultimaker S5, Ultimaker S3 Ultimaker 2+ Connect.   
        They're ready for you on the Ultimaker Academy platform. All you need to do to gain access is to register your product to gain free access. 
        Ready? Register your product here in just 60 seconds.
          • Like
        • 11 replies
    ×
    ×
    • Create New...