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

    Retrieve import file name?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 75 Views 3 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.
    • L Offline
      lestercavey
      last edited by

      Is there some way to retrieve the "File -> Import..." file name that the user selects in the Import Browser? Perhaps some observer would have access to that name?

      My goal is to import a dxf file into Sketchup, and then run a script that parses that dxf text file, to obtain more information from it. I cannot use "model.import" directly though, because the user must have access to the Options dialog in the Import Browser. Also, Sketchup.send_action(21112) does not work for me. Even though send_action returns true, no Import Window appears.

      1 Reply Last reply Reply Quote 0
      • TIGT Online
        TIG Moderator
        last edited by

        Since you have
        filepath=UI.openpanel(...)
        The imported file is
        filename=File.basename(filepath)
        If an importer doesn't append the file-type then use
        filename=File.basename(filepath, ".*")
        However, the name isn't 100% guaranteed as there might be a similar existing component's name so
        filename=model.definitions.unique_name(filename)
        which will give the one that will be used...

        TIG

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

          @lestercavey said:

          Also, Sketchup.send_action(21112) does not work for me. Even though send_action returns true, no Import Window appears.

          Because the API Dictionary is way out of date, and that list of integers is erroneous.

          The proper integer (PC only,) to invoke the "File > &Import..." is 21933

          I do not know if there is a cross-platform string arg.

          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