Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Help with editing a post in VS code

JeffreyTKomorowski
Participant

Help with editing a post in VS code

JeffreyTKomorowski
Participant
Participant

Hey everyone, I am currently working off my dads plasma cutter / water jet machine and Im trying to match his codes to my post. 

 

One of the issues I am having is that I tried to download Autodesk Fusion 360 Post Processor Utility and on mac I can't seem to get it to work but finding a line in. my Gcode where I need to edit the post. That is 1 problem I am having but very minor I would say. Im not sure if it matters but I am on a mac. I can't seem to find help really on youtube videos for mac setup for this. 

 

The big issue I am having is that I am trying to add in the line that is a subprogram for the feed rates on his controller / machine. 

P0119 L1
I want the machine to run M98 and when it does run that I want it to add "P0119 L1" with it. 
 
I was able to go into the code and see where it calls either M98 or M9. I tired to add a string to the ternary operator as shown in the picture but when I run the post it all comes back as an error. I'm not super good with JS but I know a little and my guess is that it's because it's returning M format
 
Screenshot 2022-12-18 at 7.28.38 PM.png
(block of code where it determines M98 or M9)
 
Screenshot 2022-12-18 at 7.36.10 PM.png
(an edit by adding a string at the end of the ternary hoping it would work but it just caused an error every time I tried to set up the post processor and generate g code) 
 
Screenshot 2022-12-18 at 7.28.44 PM.png
(an image of the code that is being generated from fusion)
 
Screenshot 2022-12-18 at 7.34.57 PM.png\
(what I want to achieve in the M98 line)
0 Likes
Reply
Accepted solutions (1)
325 Views
5 Replies
Replies (5)

Sq_14
Enthusiast
Enthusiast

try this ...

writeBlock(mFormat.format(power ? 98 : 9)) + writeBlock("P0119 L1");

 

or, depending on the output line 

writeBlock(mFormat.format(power ? 98 : 9)) + writeBlock(" P0119 L1");

1 Like

JeffreyTKomorowski
Participant
Participant

this works partially, it's generating a new block of code regardless of the ternary outcome. What I am looking for is if its M98, I want the code to follow to be P0119 L1 (in the same line I believe?? if not I can maybe make it work on separate lines 

0 Likes

carl.j.barker
Collaborator
Collaborator
Accepted solution

Using a + after a numerical literal will be trying to do a mathematic addition rather then a concatenation.

 

try 

writeBlock(mFormat.format(power ? 98 : 9) , power ?  "P0119 L1" : "");
or
writeBlock(mFormat.format(power ? 98 : 9) + conditional(power == true, " P0119 L1"));
 
If you need the option to separate blocks with a space then -
 
 
writeBlock(mFormat.format(power ? 98 : 9) , power ?  "P0119" : "" , power ?  "L1" : "");   may be better
 

 

2 Likes

Sq_14
Enthusiast
Enthusiast

thank you for posting this, the power of conditional and it's syntax helps a lot ..

 

In regards to my '+' error .... i guess i shouldn't post at 4,30 am right before having the coffee  

0 Likes

JeffreyTKomorowski
Participant
Participant

I used this as the correct solution. I was able to achieve my goal by creating a new function that runs within the original function to add it. However, after trying your last block of code it works better by keeping it all on the same line. ss.png

0 Likes