Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

How to Programmatically Import Image? Using skImage(...)?

brian_guanbrian_guan Member Posts: 10
I am trying to use FeatureScript to programmatically import a logo image into my model but I can't seem to find any example.

Doing so manually in Part Studio by importing the logo in DXF and inspecting the underlying FeatureScript code, it seems to be essentially re-sketching the logo line by line, arc by arc, instead of dealing with the logo image as a logical unit.

Browsing FeatureScript documentation I found https://cad.onshape.com/FsDoc/library.html#module-sketch.fs which mentions skImage(...) but it is unclear to me what the parameter "blobInfo" is supposed to take, and I can't find any example of it. I was able to make skText(...) work as comparison.

I wrote a little FeatureScript code to illustrate my point:


Can someone from OnShape comment?  Thanks.


  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 504
    Blob info of an image blob will come from an import of another tab. It will contain the right thing if the tab you import is a png, jpg, svg, etc (More info on imports here)

    Here's a working example of that:

    If you want to insert your dwg as an image using a custom feature, I'd recommend convert your dwg to an svg and use the method described above to insert the image.

    If you want to use the dwf as geometric entities, that will be more difficult, but possible. Let me know if that's your goal, I can expand more on what the right strategy is.

  • brian_guanbrian_guan Member Posts: 10
    Thanks, I am hoping to extrude the logo so to use it to engrave on a surface of another solid.  I try to expand on your example solution but extruding the image I get only a cube, rather than a solid logo.
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 504
    I believe the right way to approach this task is to import the DXF into another Part Studio named e.g. "Sketch DXF". Then, import that Part Studio into a Feature Studio defining your custom feature.

    This custom feature can then build the underlying DXF, move it around, and use the resulting geometric entities.

    Here's an example of that workflow:

Sign In or Register to comment.