Showing hidden line on selected scenes

scenes
backedges
ruby

#1

Hi,

I am trying to create construction drawings with ruby. I have created some scenes/pages and I want few of them (e.g. top_page) to show the hidden line (BackEdges) of the geometry. I haven’t came across any solution in the forum yet. Here is my code:

pages.selected_page = top_page
model.rendering_options["DrawBackEdges"] = true
model.rendering_options["RenderMode"] = 2
top_page.use_rendering_options = true
top_page.update(127)

The result is as below. It didn’t stick after applying use_rendering_options and update() on top_page. The hidden lines disappeared and the scene reverted back to the original scene without BackEdges as soon as I selected another scene in Sketchup. Any idea?

Thanks
lane

#Result:

EDIT: TLDR: page.update(127) doesn’t work as expected. Help!


#2

If you were doing this manually turning on Back Edges would result in a modification to the style. If you wanted the back edges to show only in that particular scene, you would need to create a new style. When you create a new scene or update an existing one, you should be prompted with a warning that the style has been changed. You would be asked to either update the existing style or create a new style. Updating the existing style would result in all other scenes using that style displaying the back edges. Most likely you would want to create a new style instead.

I suppose in your script you;ll need to make that happen.

It is possible to disable that warning window but doing so is usually not a wise idea.

Once you’ve created the style with the back edges displayed, though, you should reuse it for other scenes with back edges displayed rather than create a back edge style for each of the scenes.

What’s your plan for these scenes after you create them in SketchUp? Are you going to use LayOut to create your construction plans?


#3

Hi Dave,

Thanks for your response.

This is new to me, it sounds like a lots of work to be done, I’d be grateful if you could guide me through it.

Yes. My plan is to use them in LayOut later.


#4

It isn’t difficult to do without code. I’m not sure about a script for that but I expect it would be more complicated because it would need to be able to determine if there’s a suitable existing style and use it instead of creating another style.

Check your PMs.


#5

Hi Dave, I worked it out firstly by creating a new style and save it as a file, and then use it as a template style for the required scenes:

##load the template style for the first time
styles.add_style("C:/Users/PC03/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Styles/xray.style", false)

#apply the template style to the necessary pages before adding the pages
styles.selected_style = styles["xray"]
#add "top" page
top_page = pages.add "top"
#revert back to normal style
styles.selected_style = styles["[Construction Documentation Style]"]

Thanks again.
L


#6

I’m interested to see how the results look in LayOut. Can you show an example?


#7

@lanette, your original problem is that scene page specific rendering option attributes were replaced by styles (but the documentation was never updated.) It is also a pain that styles are not fully exposed in the Ruby API.


#8

@DaveR, I am working on the LayOut part, and it’s working fine. Here’s a screenshot example of two viewports with different styles:

@DanRathbun, so that’s the reason why I was lost. I hope this topic will help others with the same problem as mine. Thanks.


#9

That’s a tiny image and difficult to see. Can you show a larger image?


#10

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.