SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
38 stars 10 forks source link

Sketchup::Entity#parent doc issue #757

Open dezmoHU opened 2 years ago

dezmoHU commented 2 years ago

The #parent method documentation states that:

Returns:

( Sketchup::ComponentDefinition, Sketchup::Model) — a Entity object representing the parent of this entity.

However :

1)

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
page.parent

Returns: Sketchup::Pages

2)

Sketchup.active_model.layers[0].parent

Returns: Sketchup::Layers

3)

Sketchup.active_model.materials[0].parent

Returns: Sketchup::Materials

4)

Sketchup.active_model.styles.first.parent

Returns: Sketchup::Styles

5)

Sketchup.active_model.line_styles.first.parent

Returns: nil

DanRathbun commented 1 year ago

I would consider 5 to be a bug. (Should be probably be filed separately.)

Member objects of collections should always return their #parent, which is the collection object to which they belong. Collections should always have a #model method that returns the model object to which they belong.