Search in Products
Help to run this brand-new forum and stay with us.
Ask your questions, we are here to help!
Quote from Dobbelju on 2 August 2023, 21:35Hello!
I have some trouble to fix some code in an macro i want to use. I tried in SimCNC 3.5 .
I want to use one macro (called M300) with 12 arguments (A1, A2, A3 ... and so on).
When i create following macro:
# M300.py
def M300_A1():
print("M300 A1.")
# Codedummy
def M300_A2():
print("M300 A2.")
# Codedummy
def M300_A3():
print("M300 A3.")
# Codedummy
def process_M300(arg):
if arg == "A1":
M300_A1()
elif arg == "A2":
M300_A2()
elif arg == "A3":
M300_A3()
else:
print("Invalid Argument. Choose A1, A2 or A3.")
if __name__ == "__main__":
import sys
if len(sys.argv) != 2:
print("Using: python M300.py <Argument>")
sys.exit(1)
arg = sys.argv[1]
process_M300(arg)
I tested to run it in the MDI. When i enter M300 A1 etc. i get following error message:
Warning
Motion (group 1) is not set
M300 A1
I cant figure out how to solve this.
Maybe you got an idea?
thanks!
Dobbelju
Hello!
I have some trouble to fix some code in an macro i want to use. I tried in SimCNC 3.5 .
I want to use one macro (called M300) with 12 arguments (A1, A2, A3 ... and so on).
When i create following macro:
# M300.py
def M300_A1():
print("M300 A1.")
# Codedummy
def M300_A2():
print("M300 A2.")
# Codedummy
def M300_A3():
print("M300 A3.")
# Codedummy
def process_M300(arg):
if arg == "A1":
M300_A1()
elif arg == "A2":
M300_A2()
elif arg == "A3":
M300_A3()
else:
print("Invalid Argument. Choose A1, A2 or A3.")
if __name__ == "__main__":
import sys
if len(sys.argv) != 2:
print("Using: python M300.py <Argument>")
sys.exit(1)
arg = sys.argv[1]
process_M300(arg)
I tested to run it in the MDI. When i enter M300 A1 etc. i get following error message:
Warning
Motion (group 1) is not set
M300 A1
I cant figure out how to solve this.
Maybe you got an idea?
thanks!
Dobbelju
Quote from CS-Lab Support on 4 August 2023, 06:47Hello,
Because of how Python scripts are internally implemented in simCNC, standard argument passing (through sys.argv) will not work.
You have to use machine params for that manner.
It works like this:
- set machine param or multiple params beforecalling a macro
- read these params in a macro using getMachineParam function
example m300.py:
#m300.py
value_a1 = d.getMachineParam( 1000 )
value_a2 = d.getMachineParam( 1001 )
print(value_a1)
print(value_a2)
execution example from gcode:
#1000=1 #1001=2 m300
Regards,
Andrew
Hello,
Because of how Python scripts are internally implemented in simCNC, standard argument passing (through sys.argv) will not work.
You have to use machine params for that manner.
It works like this:
example m300.py:
#m300.py
value_a1 = d.getMachineParam( 1000 )
value_a2 = d.getMachineParam( 1001 )
print(value_a1)
print(value_a2)
execution example from gcode:
#1000=1 #1001=2 m300
Regards,
Andrew
We and use cookies and other tracking technologies to improve your experience on our website. We may store and/or access information on a device and process personal data, such as your IP address and browsing data, for personalised advertising and content, advertising and content measurement, audience research and services development. Additionally, we may utilize precise geolocation data and identification through device scanning.
Please note that your consent will be valid across all our subdomains. You can change or withdraw your consent at any time by clicking the “Consent Preferences” button at the bottom of your screen. We respect your choices and are committed to providing you with a transparent and secure browsing experience.
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category . |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | Records the default button state of the corresponding category & the status of CCPA. It works only in coordination with the primary cookie. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
_ga | 2 years | The _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors. |
_ga_SJHLQ56JZN | 2 years | This cookie is installed by Google Analytics. |
_gat_gtag_UA_26364375_2 | 1 minute | Set by Google to distinguish users. |
_gat_UA-26364375-2 | 1 minute | A variation of the _gat cookie set by Google Analytics and Google Tag Manager to allow website owners to track visitor behaviour and measure site performance. The pattern element in the name contains the unique identity number of the account or website it relates to. |
_gid | 1 day | Installed by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously. |
CONSENT | 2 years | YouTube sets this cookie via embedded youtube-videos and registers anonymous statistical data. |
undefined | never | Wistia sets this cookie to collect data on visitor interaction with the website's video-content, to make the website's video-content more relevant for the visitor. |
Cookie | Duration | Description |
---|---|---|
_fbp | 3 months | This cookie is set by Facebook to display advertisements when either on Facebook or on a digital platform powered by Facebook advertising, after visiting the website. |
fr | 3 months | Facebook sets this cookie to show relevant advertisements to users by tracking user behaviour across the web, on sites that have Facebook pixel or Facebook social plugin. |
VISITOR_INFO1_LIVE | 5 months 27 days | A cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface. |
YSC | session | YSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages. |
yt-remote-connected-devices | never | YouTube sets this cookie to store the video preferences of the user using embedded YouTube video. |
yt-remote-device-id | never | YouTube sets this cookie to store the video preferences of the user using embedded YouTube video. |
yt.innertube::nextId | never | This cookie, set by YouTube, registers a unique ID to store data on what videos from YouTube the user has seen. |
yt.innertube::requests | never | This cookie, set by YouTube, registers a unique ID to store data on what videos from YouTube the user has seen. |
Cookie | Duration | Description |
---|---|---|
Ae_jOSkTZmdcNur | 1 day | No description |
loglevel | never | No description available. |
SqaVcQNCRge | 1 day | No description |
wp_woocommerce_session_f45d9cf14cfd0acfbd2fa51592448601 | 2 days | No description |
Click one of our contacts below to chat on WhatsApp
Social Chat is free, download and try it now here!