krakdustten / PyAltiumRun

MIT License
8 stars 3 forks source link

Altium_scripts/generate_docs.pas #3

Open sebo83910 opened 10 months ago

sebo83910 commented 10 months ago

Hello,

I'm interestd by your project. Where could I find the files: Altium_scripts/generate_docs.pas ? Thanks.

DylanGybels commented 10 months ago

Sadly the generate_docs.pas file is not really something that exists. Here are some scripts and python functions that should work (never tested them on other systems) Altium_run_example_scripts.zip

This project was something I made for a bigger project that I cannot disclose. I thought that it might be usefull for others with the same problem.

Due to the performance of Altium I'm looking into better solutions. I checked the ALTIUM DXP DEVELOPER but I'm not sure it can do what I need and Altium does not want to give me acces to it. So for now I'm looking into making my own interface into the Altium system but this is not easy to do and might create some copy-right problems. This is also a project that I only work on in my free time so it might take a while before anything real comes out of it.

sebo83910 commented 10 months ago

Thanks Dylan for your answer. I'm looking for some projects or example combining python and Altium. First I wish to use it for the following:

  1. open project
  2. generate outputs files (Gerbers, Pick and place,...)
  3. Close project.
krakdustten commented 10 months ago

Hey Sebo, I think I have some good news (and some bad). The "run_altium_output_job_no_variant" function in the zip file that I sent you can do this exact thing. You only need an output job file that defines how these files should be generated.

One of the downsides is that Altium does not like to do this. So, make only one output container per output job file and make multible output job files if more are needed. Try not to add the project to a git repository as this will give some errors when the script is running. (You see why I stopped working on this 😅)

I'm not sure how skilled you are in Altium but you can find more info on output job files here https://www.altium.com/documentation/altium-designer/streamlining-generation-of-manufacturing-data-with-output-jobs https://my.altium.com/altium-designer/getting-started/creating-outjob-file

This is one of the things I used in the program I made. It is also one of the main reasons I said "Due to the performance of Altium I'm looking into better solutions." So you can use it and it will work but don't expect a lot of performance.

sebo83910 commented 10 months ago

I'm not really an expert but my coleagues are. So, I'll talk to them. Performance would be nice but not really an issue here (I guess). Before trying live, my python script should look like this:


run = AltiumRun(use_internal_logger=True)                       #Create runner object
run.clear_log_file()                                            #Clear the logs of the previous run
run.set_project_to_open(r"Altium_project/MY_PROJECT.PrjPcb")   #Define an Altium project to open
run.add_script(r"Altium_scripts/run_altium_job_file_no_variant.pas")             #Add a script to the runner
run.set_function("RunOutputJob", "MY_JOB_FILE.OutJob")                     #Set the function to run
run.run()                                                       #Run

Is that correct?

Many thanks.

krakdustten commented 10 months ago

That should work. Good luck

sebo83910 commented 10 months ago

Hi,

I do have a problem. I got an error stating "Undeclared identifier: write_str_to_log" I've checked, I couldn't find the definition of this function in the project.

S/

krakdustten commented 10 months ago

Hey, that is a problem that should have been fixed but I forgot to update the PyPi repository. If you update the package it should be fixed

sebo83910 commented 10 months ago

Thanks. It seems to solve the situation. I think I have two other problems but might be linked: Class Document Source Message Time Date No.

[Error] CAO Project CAO could not be found. It remains in the project script_project.PrjScr but has been marked as missing. 14:19:12 25/10/2023 1

[Error] run_altium_job_file_no_variant.pas Project run_altium_job_file_no_variant.pas could not be found. It remains in the project script_project.PrjScr but has been marked as missing. 14:19:12 25/10/2023 2

How to specify the path to the project or the Altium scripts?

Thanks.

sebo83910 commented 10 months ago

Ok. I made progress. I resolved the path problems. My outjob is not correct for now.