Does anyone know if it’s possible to access a given Layout element’s tag, where that element is part of a SketchupModel placed onto a page and displayed as vectors? I cannot find any such method in the Layout API. The Entity instance method #layer_instance is for the Layout layer, not the Sketchup Tag.
My motivation here is that I want to export a Layout document as an SVG, which is really easy to style using CSS and plays nice with other graphics software. My script would reach into a Layout::SketchupModel object on a given page, get the Layout::Group entity that contains all the 2D vector graphics, and write each Layout::Path entity out as an SVG element. My hope is to style the SVG using classes mapped to the tags assigned within the Sketchup model, so that lineweights and colours can be updated just by typing into a CSS file.
I realize that a flattened 2D representation of a model isn’t the same as the original, but since layout maps tags in the model to specific linetypes and lineweights, the information should be there, at least for purely vectoral, hidden line drawings. If not, then I’ll have to resort to setting line color by material, setting materials to display by tag, and then assigning classes based on color.
I would think that the Layout::Entity properties should have already used what it can from the embedded model resource to set the properties. Other than this, you will need to set what is exposed to the viewport object and the LayOut entity’s style.
I think that there is also an open issue to refresh or update the SKP model file reference. So opening the model in SketchUp, changing the layer/tag assignments, etc. saving it and updating the reference in LayOut is probably not (yet) a workaround.
Thanks! Though I was hoping I’d missed something, unfortunately you’re correct the tag information is not passed down Layout’s pipeline into a Layout::Entity. Maybe it could be in the future, as a read-only attribute #tag?
I found this plugin Skema 2D Projection which produces a hidden line rendering entirely in model space, and preserves the tag of each edge. Exporting the result as a 3D dwg/dxf file also saves tags as layers.