-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of a cropmark editor to the extension #31
base: master
Are you sure you want to change the base?
Conversation
First version of a working editor with presets needs better comments
Changed id of the cropmark layer to be easily removable by the editor
re upload
A cheap workaround for inability to control the way cutstudio defines the number of cropmarks from Inkscape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your great suggestion! I tested it and it looks like some bugs still need to be fixed: unit handling, cropmark position calculation and default margins. See the detailed review comments.
# TODO add tool marks for manual alingment | ||
|
||
# TODO impemnent a way to emmbedd the custom XML from template to any file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these comments still up to date?
# Preset margins for machines | ||
machine_margins = { | ||
"gx_24_gs_24": {"top": 40.0, "bottom": 20.0, "left": 20.0, "right": 20.0}, | ||
"gr_g": {"top": 30.0, "bottom": 45.0, "left": 10.0, "right": 10.0}, | ||
"sv_series": {"top": 6.0, "bottom": 30.0, "left": 23.0, "right": 23.0}, | ||
"sv_8": {"top": 6.0, "bottom": 30.0, "left": 25.0, "right": 24.0}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values do not match what I found in the Roland documentation. I successfully used the values from there with the GX24, which allows for a slightly larger cutting area:
H (float): Height in user units. | ||
x (float): X-coordinate for the text. | ||
y (float): Y-coordinate for the text. | ||
font_size (str): Font size for the text. Default is "9pt". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
font_size is no argument of the function.
Order of arguments is mixed up in the documentation ("parent" is at the end)
txt = parent.add(inkex.TextElement(**txt_attribs)) | ||
|
||
|
||
# Construct the cropmark settings string without the extra {{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean with "without the extra {{"?
"id": re.sub(r'\W+', '_', name), # Replace non-alphanumeric characters with underscores | ||
"cx": str(x), # X position | ||
"cy": str(y), # Y position | ||
"r": "5" # Radius is half of the 10mm diameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and in other places you assume that the document unit is millimeters. If I set the unit in the extension dialog e.g. to pt and choose page size A4 then the generated template is very wrong.
# Convert numeric values to integers to remove decimal points | ||
pageW = int(pageW) | ||
pageH = int(pageH) | ||
dx = int(dx) | ||
dy = int(dy) | ||
W = int(W) | ||
H = int(H) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you convert to integer here? Custom pagesizes are not guaranteed to be in full millimeters.
offset_left = bbox.left + margin_left + 10 | ||
offset_right = bbox.right - margin_right - 10 | ||
offset_top = bbox.top + margin_top + 10 | ||
offset_bottom = bbox.bottom - margin_bottom - 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. ~~You now have an example file with DIN A4 pagesize and crop marks that should work on a Roland GX-24 (and hopefully many other plotters). Changing the page size and cropmark position is currently not possible.~~ | ||
You can edit the example file by Extensions -> Roland CutStudio -> Roland Cropmark Editor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. ~~You now have an example file with DIN A4 pagesize and crop marks that should work on a Roland GX-24 (and hopefully many other plotters). Changing the page size and cropmark position is currently not possible.~~ | |
You can edit the example file by Extensions -> Roland CutStudio -> Roland Cropmark Editor. | |
3. You now have an example file with DIN A4 pagesize and crop marks that should work on a Roland GX-24 (and hopefully many other plotters). You can change the page size and cropmark position with Extensions -> Roland CutStudio -> Roland Cropmark Editor. |
# TODO impemnent a way to emmbedd the custom XML from template to any file | ||
|
||
def add_arguments(self, pars): | ||
pars.add_argument("--preset", help="Apply crop marks to...", default="gx_24_gs_24") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pars.add_argument("--preset", help="Apply crop marks to...", default="gx_24_gs_24") | |
pars.add_argument("--preset", help="Machine type (or 'custom' to use custom margins)", default="gx_24_gs_24") | |
|
||
def add_arguments(self, pars): | ||
pars.add_argument("--preset", help="Apply crop marks to...", default="gx_24_gs_24") | ||
pars.add_argument("--page_size", help="Apply crop marks to...", default="A1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pars.add_argument("--page_size", help="Apply crop marks to...", default="A1") | |
pars.add_argument("--page_size", help="Page size (or 'custom' to use custom new_width and new_height, or 'keep' to keep old page size)", default="A1") | |
In order to mitigate the difficulty of changing the default template I have created a cropmark editor the takes care of the needed changes to the document.
As TBH I did not fully understand the mechanism of the roland_cutsudio.py and was unable to edit the document to add the required data from the template to the current open document the addition is fully independent to the existing code and simply adds the ability for the user to edit the template once opened in any way they see fit.
The addition has been tested on a Roland GS2-24 with very good user feedback.
A behavior I was unable to understand caused the existing 3 cropmark template when sent to CutStudio to show as a four cropmark one, so for the lack of a better solution the editor offers the user 3 or 4 cropmark settings.
Test for the 3 cropmark performance were not carried out due to the issue mentioned above.