Send_to_layout or Layout::Document.open(filename)
-
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:
- create a routine that creates a copy of any of the selected assembly to a single component
- save that component to a file
- open the file and separate each component so that it is viewed from a side view
- space them apart within a Scene based on predefined margins
- send each Scene to a Layout file, each Layout Page/Sketchup Scene
- 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) trueThen used send_to_layout to create a new Layout file.
x_result = Sketchup.send_to_layout(x_layoutDir + "/MyTestLayoutFile.layout") falseNo 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:ineval'`No Luck. Found another option by just using the send_action.
Sketchup::send_action("sendToLayOut:") falseAgain 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>:innew' <main>:in<main>'
SketchUp:1:ineval'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.
-
How do I get Sketchup to create a new Layout file?
-
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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement