Layout Ruby API

layoutapi

#1

Breaking this into a new topic to keep from getting off topic.

The Layout Ruby API is only available in Layout 2018. The SketchUp model in shown on the Layout page can be accessed from the Layout API. However ‘nothing’ can be done with the SketchUp model.

By nothing I mean that the SketchUp entities can’t be referenced (dynamic components, etc.)

I also haven’t figured out how to attach layout dimension leaders to a point in the model using the API.
For example if I dimension the width of a building in layout, the dimension moves with the model and stays connected. Perhaps this is still not possible using the API? @thomthom

I couldn’t see any way to get Dynamic Component info in Layout. Can you elaborate?


#2

It is in the label tool and since version 2018, you can ‘see’ the advanced attributes as well:


#3

Neat! I’ll have to try that.
It doesn’t seem like that info can be accessed from the API though?


#4

yes it can, but for now, only in SketchUp, the library is called dynamic_components


#5

Incorrect. It is available (at this time) only within SketchUp 2018.

To manipulate the model, you may need to load it into SketchUp. To update in the LayOut document, you may need to save the it’s bounds etc. and recreate it again, after having saved the modified SKP file.

Read example given for class …


#6

I was mistaken the Layout API is accessible only from within SketchUp.

OK my problem was I was looking at the Layout::LinearDimension.start_connection_point which only accepts a 2D point. Specifying a ConnectionPoint will generate an error.

Error: Cannot convert argument to Geom::Point2d

I did find that a Layout::ConnectionPoint can be provided to the Layout::LinearDimension.connect method though.

That is what I was looking for.


#7

Really? This is news to me. How does one access it?


#8

we shouldn’t talk about fight club…

john


#10

Hmm… I must have been dreaming. Too much coffee (or not enough)!


#11

Yup, as shown in the example I linked for ya’. It is a bit weird. You first draw it as a 2D paperspace object, then “connect” it to the 3D modelspace.