sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

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

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 5.3k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      AlexMS
      last edited by Gábor

      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

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        @alexms said:

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

        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-realize-the-drag-effect/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:")

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement