• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Send_to_layout or Layout::Document.open(filename)

Scheduled Pinned Locked Moved Developers' Forum
1 Posts 1 Posters 5.6k Views
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.
  • S Offline
    sjn001tvh
    last edited by 23 Jan 2019, 01:32

    Hi,

    I seemed to have hit another road block. This time in terms of trying to use the send_to_layout method within Sketchup.

    My objective is as follows:

    1. create a routine that creates a copy of any of the selected assembly to a single component
    2. save that component to a file
    3. open the file and separate each component so that it is viewed from a side view
    4. space them apart within a Scene based on predefined margins
    5. send each Scene to a Layout file, each Layout Page/Sketchup Scene
    6. then manipulate the Layout tools to attach the dimensions to each object

    But I can't seem to get past getting Sketchup to create a new Layout file.

    Using the console here's what happens. I created the directory and made sure it existed.

    x_layoutDir = x_dirPath + "/" + "LayoutSets" Dir.exist?(x_layoutDir) true

    Then used send_to_layout to create a new Layout file.

    x_result = Sketchup.send_to_layout(x_layoutDir + "/MyTestLayoutFile.layout") false

    No luck. Found another command and tried it.

    objLayout = Layout::Document.open(x_layoutDir + "/MyTestLayoutFile.layout") Error: #<ArgumentError: File does not exist> <main>:inopen'
    <main>:in <main>' SketchUp:1:in eval'`

    No Luck. Found another option by just using the send_action.

    Sketchup::send_action("sendToLayOut:") false

    Again no luck. So, I tried this from another angle. I first created the file.

    objLayout = Layout::Document.open(x_layoutDir + "/MyTestLayoutFile.layout") #<Layout::Document:0x0002751b936538>

    Success!!!

    However, it was somewhat short lived, because I couldn't view the file from Layout that I had just opened. And even though it appeared to be successful I couldn't get Layout to open so that I can view the results of using the methods.

    Plus, it brought up another question. Is there a way to have Sketchup create and open the Layout file, without having to have a file already existing?

    I tried...
    objLayout = Layout::Document.new(x_layoutDir + "/MyNewLayoutFile.layout") Error: #<ArgumentError: The template file could not be found> <main>:ininitialize'
    <main>:in new' <main>:in <main>'
    SketchUp:1:in eval'

    I couldn't find where I could implement Layout template file and when I created a Layout template file, there wasn't any type of method that would allow me to create new file using it.

    So, I would like to have 2 questions answered.

    1. How do I get Sketchup to create a new Layout file?

    2. Is there a method to open the Layout application and view the document that was just opened using the Layout::Document.open method?

    Thanks,
    Scott.

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

    Advertisement