Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component.glue_to can't assign component (only faces) #111

Open
NeilBurkholder opened this issue Aug 13, 2018 · 19 comments
Open

Component.glue_to can't assign component (only faces) #111

NeilBurkholder opened this issue Aug 13, 2018 · 19 comments

Comments

@NeilBurkholder
Copy link

NeilBurkholder commented Aug 13, 2018

  1. SketchUp/LayOut Version: 2017 - 2018 Make & Pro
  2. OS Platform: Windows 10

When placing a component in the UI it can be glued to either a face or another component.
When assigning the glued_to in the API however an error is displayed.

Error: #<ArgumentError: wrong type - expected Sketchup::Face>

Expected result is that the window component would be glued_to the wall compoent.

window_component.glued_to = wall_component
@thomthom
Copy link
Member

This is a limitation of the current API. To support this we'd have to allow for an instance path to be provided in order to correctly attach to faces across nested instances.

@NeilBurkholder
Copy link
Author

OK thanks. There are no work arounds as far as I know.

@DanRathbun
Copy link

+1 for implementing this. (It's basically in the GUI <-> API parity realm.)

@NeilBurkholder
Copy link
Author

Just to clarify. I'm talking about component instances.

window_component.glued_to == wall_component
true
window_component
#<Sketchup::ComponentInstance:0x00019f51426070>
wall_component
#<Sketchup::ComponentInstance:0x00019f51489d28>
window_component.glued_to = wall_component
ArgumentError: wrong type - expected Sketchup::Face

@Eneroth3
Copy link

Eneroth3 commented Apr 16, 2019

This is a limitation of the current API. To support this we'd have to allow for an instance path to be provided in order to correctly attach to faces across nested instances.

Judging from the model behavior and current getter return value no instance path is needed. It only glues to faces or instances in the same drawing context, not nested entities.

In time it could be cool to place a vase on a shelf in a bookcase, without being inside the bookcase component, and have it moved when the shelf moves, but just exposing what is already there to the Ruby API is enough in most cases.

@thomthom
Copy link
Member

We want to add support for instance path to this like we did for attaching dimensions.

@Eneroth3
Copy link

Before reworking the core, would it be possible to just expose what is already supported to the API?

@thomthom
Copy link
Member

Reworking the core? What do you mean? The core already uses instance paths - it's just the API that didn't expose that.

@Eneroth3
Copy link

Are you sure? From testing with the GUI it seems the core glues the instance to either a face or an instance, never a face inside of an instance. I don't think there is a path involved, just a reference to a single entity.

2019-04-23_21h35_05

@Eneroth3
Copy link

Is this logged internally as something that could be implemented without having glue-to support instance paths? I need the existing functionality in SketchUp for a project but it isn't exposed to the API. I don't want to glue to any individual face inside of a group/component, just the group/component as a whole, as you already can do from the UI.

@thomthom
Copy link
Member

hmm... maybe you are right. I might be confusing it with dimension-attachments.

@NeilBurkholder
Copy link
Author

Yup I can verify that dimensions reference geometry inside a group/component but glued objects never reference entities inside the object they are glued to.

@thomthom
Copy link
Member

I looked at the source, and it's not using instance paths at all. It's using a direct relationship to another entity. No 3d point references.

@Eneroth3
Copy link

This is great news! Then it should be relatively simple to expose it.

@thomthom
Copy link
Member

thomthom commented Jun 26, 2019

And Sketchup::Group also needs these methods. Related #250

@Eneroth3
Copy link

Eneroth3 commented Oct 9, 2019

This is also needed in the C API for exporters/importers, e.g. to map SketchUp gluing to 3ds Max parenting.

@NeilBurkholder
Copy link
Author

Has this been looked at any more? I'm using the work around posted here.

https://forums.sketchup.com/t/bug-in-glued-to/74535/43?u=neil_burkholder

This work around is a real pain because the original component is replaced, and this causes issues with references to deleted entities.

@thomthom
Copy link
Member

thomthom commented Mar 8, 2021

I'll bump it internally.

@NeilBurkholder
Copy link
Author

A big thank you for implementing this in 2021.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants