Sketchup::model#import : Force "Use Image As" Image

Sketchup::model#import : Force "Use Image As" Image

Postby AlexMS » Mon May 04, 2020 9:28 am

Hi everyone,

I'm trying to make a tool to import an image of my choice (not the user's), but keeping functionalities of the standard tool (placing & scaling with preview), that's why I use Sketchup::model#import and not Sketchup::Entities#add_image.

But, when I do like that, I'm depending on the last choice of Use image as the user's made in import dialog. I didn't find any ImporterOption to control it, or something else.

Any idea how to control it ? Or should I make a full tool and use add_image :| ?

Thanks
0

AlexMS 
 

Re: Sketchup::model#import : Force "Use Image As" Image

Postby Dan Rathbun » Sat Jun 06, 2020 3:17 pm

AlexMS wrote:But, when I do like that, I'm depending on the last choice of Use image as the user's made in import dialog.

You are correct there are no importer options for image file types exposed in the Ruby API.

If you are still using SU2017 Make, then there is no way to change what the user's last setting was, whilst SketchUp is running. It is saved in the registry, and although SketchUp will immediately update the user's setting (if it changes,) SketchUp core will still use it's internal memory of the setting instead of checking the registry.
This means if you attempt to tweak the registry whilst SketchUp is open, it will have no effect.

AlexMS wrote:Or should I make a full tool and use add_image ?

This is likely your only option. I did post an example of dragging objects around within a tool at the SketchUp forums ... See links in this post:
https://forums.sketchup.com/t/how-to-re ... t/125758/4

Once the image is placed, you might try to push it's reference into the selection set alone and activate the ScaleTool.
Sketchup.send_action("selectScaleTool:")
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    SketchUcation One-Liner Adverts

    by Ad Machine » 5 minutes ago



    Ad Machine 
    Robot
     



     

    Return to Developers' Forum

    Who is online

    Users browsing this forum: No registered users and 7 guests

    Visit our sponsors: