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

Imported SVG scale is wrong

The attached SVG file is 100x100mm, and the attached STL is 100x100x3mm, but when I import them both and stack them on top of each other, the SVG looks smaller.  (I'm also using the SVG to test the Cam2D function in the API, and likewise getting indications that it's smaller than it should be and not centering as expected).

I'm on x86 Ubuntu 22.0, RoboDK  v5.4.1 (64 bit).

Trying again to attach the files.

Attached Files
.zip (Size: 650 bytes / Downloads: 202)
If I convert the SVG to a PNG using linux "convert" (ImageMagick 6), RoboDK renders the PNG more accurately, although the ArUco tag still reveals about 1-2mm of error. This isn't a bad approach for testing the accuracy of your renderer, so if you have OpenCV or another way to get pose from April / ArUco tags, you might consider adding it to your test suite.
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.

Another 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:
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

Users browsing this thread:
1 Guest(s)