Solved! Go to Solution.
Solved by kandennti. Go to Solution.
Solved by kandennti. Go to Solution.
Solved by kandennti. Go to Solution.
Solved by kandennti. Go to Solution.
@nubrandao -San.
I made this for now.
Post processing is performed for each selected NCProgram operation.
In actuality, an NCProgram is created for each operation, and post processing is performed by copying the settings, so be sure to set up the NCProgram.
The output file is created in the "Output folder" of the NCProgram.
The file name is in the following format
(NCProgram's "File Name")_(operation name).(extension set in cps)
The "Name/number" will be the same for all. Please let me know if there seems to be a problem.
We have not done much checking or testing, so there is a high possibility of errors, etc.
Please contact us if you find anything.
Hello thank you.
I think there's really a lot of potential here for a great script.
I tried your new script, but the new text is overwritten for me only in the first operation (and I think it's the same in your image).
And there could be an option in the settings to remove the old text.
I don't know why, but in the preview some tools write a lot of zeros after the decimal point and then a number (Dia 12.400000000000002)
@Tomas_V_cz -San.
It was a lack of confirmation. Fixed so that selected operations can be renamed.
In addition, to prevent the numerical values from becoming too detailed, they are now limited to three decimal places.
I forgot to tell you that the units for the numbers are the units used here.
Thanks, the fix works perfectly...
the zeros after the decimal point are removed and the script is applied to all operations.
Would it be possible to remove the original text? I mean the text that Fusion will generate.
I would have more ideas but I don't want to delay you, but this would be really important and beneficial.
@Tomas_V_cz -San.
Is this what you mean by deleting the original text?
Is it correct that this is how it works for remove?
I think it could be... Maybe remove could delete the whole text. The most important thing for me is Add...
I have one more idea. Could the output text change depending on the selected cycle or tool? Or at least the most important ones? drilling, reaming, boring, tapping, bore-milling, circular-pocket-milling?
Great work from you, thank you very much
I think it works perfectly, but would it be possible to edit the output (type of cycle)?
Some ini file or directly in the script? I don't know how complicated it is.
Deep drilling = drill a hole Dia
etc...
Awesome work from you
@Tomas_V_cz -San.
The API allows you to get the "Cycle Type" selection as a character. Until now, we have used that character.
Changed this character so that it can be set by itself.
"CycleType.json" is available in the script folder.
Please search for JSON format.
The contents of "CycleType.json" in the attached folder is shown in the left image, and the script is executed with the characters you set.
If you try to run the script without ["drilling": "drill a hole"], the result will be the same as before, as shown in the right image.
Thank you,
I think you have chosen a great and simple solution that works.
I made a small test for several cycles (some of them we wrote in CycleType.json)
{
"drilling":"vrtat otvor ",
"deep-drilling":"vrtat otvor ",
"tapping":"zavit M",
"bore-milling":"hrubovat otvor ",
"circular-pocket-milling":"otvor na hotovo",
"boring" : "protocit otvor ",
"reaming" : "vystruzit otvor "
}
And in:
return f"{cycleType}{diaStr}" I deleted the Dia text
for better output in my language
I think the script could be further improved
(for example output "zavit M10" would be better than "zavit M10.0"),
Or for some cycles to generate values other than the tool diameter (for example, to generate the diameter of the hole for bore-milling and circular-pocket-milling), but it would probably be very complicated.
I would have a lot of ideas, unfortunately I don't have knowledge of Python programming
Awesome work, thank you very much
Edit:
i managed to get the diameter of the hole but i don't know if it is spelled correctly... But it works.
def get_diameter_with_operation(
ope: cam.Operation) -> float:
global _app
camObj: cam.CAM = _app.activeProduct
unitsMgr: core.UnitsManager = camObj.unitsManager
ratio = unitsMgr.convert(
1,
unitsMgr.internalUnits,
unitsMgr.defaultLengthUnits,
)
if not hasattr(ope, "tool"):
return math.nan
tool: cam.Tool = ope.tool
# Získat parametr průměru nástroje
try:
param = tool.parameters.itemByName("tool_diameter")
except:
return math.nan
# Zkontrolovat typ cyklu
cycleType = ope.parameters.itemByName("cycleType").value.value
if cycleType in ["bore-milling", "circular-pocket-milling"]:
# Získat parametr průměru otvoru
try:
param = ope.parameters.itemByName("diameter")
except:
return math.nan
return round(param.value.value * ratio, 3)
edit:
I couldn't figure out how to get the condition:
if the "counter sink" tool is selected, send the output text:
"collapse hole edge" + value hole diameter
@Tomas_V_cz -San.
The output is now "M" if the tool used is a tap, and "Dia" otherwise.
Note that "M" is always used in the case of taps, and is incorrect when inch taps are used.
Thank you...
unfortunately, the syntax was broken when I wanted to insert my modification into the new code, which for the bore-milling and circular-pocket-milling cycles lists the diameter of the hole instead of the diameter of the tool. Could you implement my part of the code into yours? Or rather, to write the code correctly, as it should be.
I still can't understand it by text alone. That is the main reason why it is taking so long.
I wanted the "bore-milling" and "circular-pocket-milling" operations to output the value of the hole diameter - as
shown in the picture
.
It is the "diameter" parameter
Thank you, great job...
Can I have any ideas for any improvements?
I don't know how to thank you...
Hi @kandennti
When I have toolpaths that are inside of folders, the script to rename toolpath don't work, is there a way to fix this?
Can't find what you're looking for? Ask the community or share your knowledge.