Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Imported SVG scale is wrong

#3
RoboDK may be unable to properly retrieve the size of your image in some circumstances, such as when you load the SVG image you shared. One workaround is to use a PNG file instead (as you mentioned). If you want better resolution you can load a larger image, then, scale it down using the Scale option.

另一个选择would be to scale the image object to obtain your desired size after you loaded the image. For example, once you loaded the image in RoboDK as an object, you can retrieve the size and scale accordingly:
Code:
my_desired_width = 100 # Set the desired image width in mm
import json

# Get the current width and calculate the scale
img_size = object.setParam("BoundingBox")
img_size = json.loads(img_size) # Convert the JSON formatted string to a dict
scale = my_desired_size / img_size['max'][0]

# You can also provide a per-axis scale
object.Scale(scale)


Messages In This Thread
Imported SVG scale is wrong - byj_cso- 05-12-2022, 04:17 AM
RE: Imported SVG scale is wrong - byj_cso- 05-12-2022, 05:49 AM
RE: Imported SVG scale is wrong - byAlbert- 05-31-2022, 01:23 PM



Users browsing this thread:
1 Guest(s)